example6.cpp
Go to the documentation of this file.
00001 /*
00002  *      This file is part of qpOASES.
00003  *
00004  *      qpOASES -- An Implementation of the Online Active Set Strategy.
00005  *      Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
00006  *      Christian Kirches et al. All rights reserved.
00007  *
00008  *      qpOASES is free software; you can redistribute it and/or
00009  *      modify it under the terms of the GNU Lesser General Public
00010  *      License as published by the Free Software Foundation; either
00011  *      version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *      qpOASES is distributed in the hope that it will be useful,
00014  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  *      See the GNU Lesser General Public License for more details.
00017  *
00018  *      You should have received a copy of the GNU Lesser General Public
00019  *      License along with qpOASES; if not, write to the Free Software
00020  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  *
00022  */
00023 
00024 
00036 #include <qpOASES.hpp>
00037 
00038 
00040 int main( )
00041 {
00042         USING_NAMESPACE_QPOASES
00043 
00044         /* Setup data of first QP. */
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         /* Setting up QProblem object. */
00063         QProblem example( 5,2 );
00064 
00065         Options options;
00066 //      options.enableFlippingBounds = BT_FALSE;
00067         options.initialStatusBounds = ST_INACTIVE;
00068         example.setOptions( options );
00069         
00070         /* Solve first QP. */
00071         int nWSR = 10;
00072         example.init( H,g,A,lb,ub,lbA,ubA, nWSR,0 );
00073 
00074         /* Get and print solution of second QP. */
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  *      end of file
00085  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:09