00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00036 #include <qpOASES.hpp>
00037 
00038 
00040 int main( )
00041 {
00042         USING_NAMESPACE_QPOASES
00043 
00044         
00045         real_t H[5*5] = {       1.224642131370767e+01, 2.908638763113702e+00, 0.0, 0.0, 0.0,
00046                                                 2.908638763113702e+00, 2.497106275003180e+00, 0.0, 0.0, 0.0,
00047                                                 0.0, 0.0, 1.0, 0.0, 0.0,
00048                                                 0.0, 0.0, 0.0, 5.158460640334052e-02, 4.723556059962540e-02,
00049                                                 0.0, 0.0, 0.0, 4.723556059962540e-02, 4.325317843302175e-02 };
00050         real_t A[2*5] = {       -1.404358970692652e+00, -2.556613491156063e+00, 3.202524559238066e+00, -1.0, 0.0,
00051                                                 6.587910295430314e-01, -5.349454475937998e-01, 4.391976356955536e-01, 0.0, -1.0 };
00052         real_t g[5] = {         2.474135331302147e+01,
00053                                                 5.857286430296258e+00,
00054                                                 2.359382646348721e-01,
00055                                                 1.721047069188781e-01,
00056                                                 1.575947337774199e-01 };
00057         real_t lb[5] = { -10.0, -10.0, -10.0, -10.0, -10.0 };
00058         real_t ub[5] = {  10.0,  10.0,  10.0,  10.0,  10.0 };
00059         real_t lbA[2] = { 1.643135416077167e+00, 1.056813028189597e+00 };
00060         real_t ubA[2] = { 1.643135416077167e+00, 1.056813028189597e+00 };
00061 
00062         
00063         QProblem example( 5,2 );
00064 
00065         Options options;
00066 
00067         options.initialStatusBounds = ST_INACTIVE;
00068         example.setOptions( options );
00069         
00070         
00071         int nWSR = 10;
00072         example.init( H,g,A,lb,ub,lbA,ubA, nWSR,0 );
00073 
00074         
00075         real_t xOpt[5];
00076         example.getPrimalSolution( xOpt );
00077         printf( "\nxOpt = [ %e, %e, ... ];  objVal = %e\n\n", xOpt[0],xOpt[1],example.getObjVal() );
00078 
00079         return 0;
00080 }
00081 
00082 
00083 
00084 
00085