example3.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 
39 #include <qpOASES_e.h>
40 
41 
43 int main( )
44 {
46 
47  /* 1) Define benchmark arguments. */
48  BooleanType isSparse = BT_FALSE;
49  BooleanType useHotstarts = BT_TRUE;
50 
51  int maxAllowedNWSR = 600;
52  real_t maxNWSR, avgNWSR, maxCPUtime, avgCPUtime;
53  real_t maxStationarity, maxFeasibility, maxComplementarity;
54 
55  static Options options;
56  Options_setToMPC( &options );
57  options.printLevel = PL_LOW;
58 
59  /* 2) Run benchmark. */
60  if ( runOQPbenchmark( "./chain80w/",
61  isSparse,useHotstarts,
62  &options,maxAllowedNWSR,
63  &maxNWSR,&avgNWSR,&maxCPUtime,&avgCPUtime,
64  &maxStationarity,&maxFeasibility,&maxComplementarity
65  ) != SUCCESSFUL_RETURN )
66  {
67  qpOASES_myPrintf( "In order to run this example, you need to download example no. 02\nfrom the Online QP Benchmark Collection website first!\n" );
68  fprintf( stderr,"error\n" );
69  return -1;
70  }
71 
72  /* 3) Print results. */
73  fprintf( stderr,"\n\n" );
74  fprintf( stderr,"OQP Benchmark Results:\n" );
75  fprintf( stderr,"======================\n\n" );
76  fprintf( stderr,"maximum stationary error: %.3e\n",maxStationarity );
77  fprintf( stderr,"maximum feasibility error: %.3e\n",maxFeasibility );
78  fprintf( stderr,"maximum complementary error: %.3e\n",maxComplementarity );
79  fprintf( stderr,"\n" );
80  fprintf( stderr,"maximum CPU time: %.3f milliseconds\n\n",1000.0*maxCPUtime );
81 
82  return 0;
83 }
84 
85 
86 /*
87  * end of file
88  */
returnValue runOQPbenchmark(const char *path, BooleanType isSparse, const Options &options, int &nWSR, real_t &maxCPUtime, real_t &maxStationarity, real_t &maxFeasibility, real_t &maxComplementarity)
Provides a generic way to set and pass user-specified options.
Definition: options.hpp:65
returnValue qpOASES_myPrintf(const char *s)
Definition: Utils.c:269
#define PL_LOW
returnValue Options_setToMPC(Options *_THIS)
Definition: Options.c:214
#define BT_TRUE
Definition: acado_types.hpp:47
#define BT_FALSE
Definition: acado_types.hpp:49
double real_t
Definition: AD_test.c:10
int main()
Definition: example3.c:43


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