test_c_example1b.c
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-2015 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 
34 #include <stdio.h>
35 
36 #include <qpOASES_wrapper.h>
37 
38 
40 int main( )
41 {
42  /* Setup data of first QP. */
43  real_t H[2*2] = { 1.0, 0.0, 0.0, 0.5 };
44  real_t g[2] = { 1.5, 1.0 };
45  real_t lb[2] = { 0.5, -2.0 };
46  real_t ub[2] = { 5.0, 2.0 };
47 
48  /* Setup data of second QP. */
49  real_t g_new[2] = { 1.0, 1.5 };
50  real_t lb_new[2] = { 0.0, -1.0 };
51  real_t ub_new[2] = { 5.0, -0.5 };
52 
53  int_t nWSR;
55 
56  real_t xOpt[2];
57  real_t yOpt[2];
58  real_t obj;
59  int_t status;
60 
61  qpOASES_Options_init( &options,0 );
62  /*options.enableFlippingBounds = 0; */
64  options.numRefinementSteps = 1;
66 
67 
69 
70  /* Solve first QP. */
71  nWSR = 10;
72  QProblemB_init( H,g,lb,ub,
73  &nWSR,0,&options,
74  xOpt,yOpt,&obj,&status
75  );
76 
77  /* Print solution of first QP. */
78  printf( "\nxOpt = [ %e, %e ]; yOpt = [ %e, %e ]; objVal = %e\n\n",
79  xOpt[0],xOpt[1],yOpt[0],yOpt[1], obj );
80 
81 
82  /* Solve second QP. */
83  nWSR = 10;
84  QProblemB_hotstart( g_new,lb_new,ub_new,
85  &nWSR,0,
86  xOpt,yOpt,&obj,&status
87  );
88 
89  /* Print solution of first QP. */
90  printf( "\nxOpt = [ %e, %e ]; yOpt = [ %e, %e ]; objVal = %e\n\n",
91  xOpt[0],xOpt[1],yOpt[0],yOpt[1], obj );
92 
93 
95 
96  return 0;
97 }
98 
99 
100 /*
101  * end of file
102  */
int_t enableCholeskyRefactorisation
Manages all user-specified options for solving QPs.
int_t QProblemB_cleanup()
USING_NAMESPACE_QPOASES int_t qpOASES_Options_init(qpOASES_Options *const options, int_t mode)
int_t QProblemB_setup(int_t nV, int_t hessianType)
#define ST_INACTIVE
int_t QProblemB_hotstart(const real_t *const g, const real_t *const lb, const real_t *const ub, int_t *const nWSR, real_t *const cputime, real_t *const x, real_t *const y, real_t *const obj, int_t *const status)
int main()
int_t QProblemB_init(const real_t *const H, const real_t *const g, const real_t *const lb, const real_t *const ub, int_t *const nWSR, real_t *const cputime, const qpOASES_Options *const options, real_t *const x, real_t *const y, real_t *const obj, int_t *const status)
#define HST_UNKNOWN
double real_t
Definition: AD_test.c:10


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