example6.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
6  * Christian Kirches et al. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
36 #include <qpOASES.hpp>
37 
38 
40 int main( )
41 {
43 
44  /* Setup data of first QP. */
45  real_t H[5*5] = { 1.224642131370767e+01, 2.908638763113702e+00, 0.0, 0.0, 0.0,
46  2.908638763113702e+00, 2.497106275003180e+00, 0.0, 0.0, 0.0,
47  0.0, 0.0, 1.0, 0.0, 0.0,
48  0.0, 0.0, 0.0, 5.158460640334052e-02, 4.723556059962540e-02,
49  0.0, 0.0, 0.0, 4.723556059962540e-02, 4.325317843302175e-02 };
50  real_t A[2*5] = { -1.404358970692652e+00, -2.556613491156063e+00, 3.202524559238066e+00, -1.0, 0.0,
51  6.587910295430314e-01, -5.349454475937998e-01, 4.391976356955536e-01, 0.0, -1.0 };
52  real_t g[5] = { 2.474135331302147e+01,
53  5.857286430296258e+00,
54  2.359382646348721e-01,
55  1.721047069188781e-01,
56  1.575947337774199e-01 };
57  real_t lb[5] = { -10.0, -10.0, -10.0, -10.0, -10.0 };
58  real_t ub[5] = { 10.0, 10.0, 10.0, 10.0, 10.0 };
59  real_t lbA[2] = { 1.643135416077167e+00, 1.056813028189597e+00 };
60  real_t ubA[2] = { 1.643135416077167e+00, 1.056813028189597e+00 };
61 
62  /* Setting up QProblem object. */
63  QProblem example( 5,2 );
64 
66 // options.enableFlippingBounds = BT_FALSE;
68  example.setOptions( options );
69 
70  /* Solve first QP. */
71  int nWSR = 10;
72  example.init( H,g,A,lb,ub,lbA,ubA, nWSR,0 );
73 
74  /* Get and print solution of second QP. */
75  real_t xOpt[5];
76  example.getPrimalSolution( xOpt );
77  printf( "\nxOpt = [ %e, %e, ... ]; objVal = %e\n\n", xOpt[0],xOpt[1],example.getObjVal() );
78 
79  return 0;
80 }
81 
82 
83 /*
84  * end of file
85  */
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
int main()
Definition: example6.cpp:40
#define ST_INACTIVE
returnValue setOptions(const Options &_options)
Provides a generic way to set and pass user-specified options.
Definition: options.hpp:65
double real_t
Definition: AD_test.c:10
Implements the online active set strategy for QPs with general constraints.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:33