Go to the documentation of this file.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 A[1*2] = { 1.0, 1.0 };
00046         real_t g[2] = { 1.5, 1.0 };
00047         real_t lb[2] = { 0.5, -2.0 };
00048         real_t ub[2] = { 5.0, 2.0 };
00049         real_t lbA[1] = { -1.0 };
00050         real_t ubA[1] = { 2.0 };
00051 
00052         
00053         real_t g_new[2] = { 1.0, 1.5 };
00054         real_t lb_new[2] = { 0.0, -1.0 };
00055         real_t ub_new[2] = { 5.0, -0.5 };
00056         real_t lbA_new[1] = { -2.0 };
00057         real_t ubA_new[1] = { 1.0 };
00058 
00059 
00060         
00061         QProblem example( 2,1,HST_ZERO );
00062 
00063         Options options;
00064 
00065         example.setOptions( options );
00066 
00067         
00068         int nWSR = 10;
00069         example.init( 0,g,A,lb,ub,lbA,ubA, nWSR,0 );
00070 
00071         
00072         nWSR = 10;
00073         example.hotstart( g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,0 );
00074 
00075 
00076         
00077         real_t xOpt[2];
00078         example.getPrimalSolution( xOpt );
00079         printf( "\nxOpt = [ %e, %e ];  objVal = %e\n\n", xOpt[0],xOpt[1],example.getObjVal() );
00080 
00081         return 0;
00082 }
00083 
00084 
00085 
00086 
00087