test_hs268.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-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 
36 #include <dirent.h>
37 #include <cstring>
38 #include <cstdlib>
39 #include <qpOASES.hpp>
40 #include <qpOASES/UnitTesting.hpp>
41 
42 
44 int main( int argc, char *argv[] )
45 {
47 
48  /* 1) Define benchmark arguments. */
49  BooleanType isSparse = BT_FALSE;
50  //BooleanType isSparse = BT_TRUE;
52  options.setToDefault();
53  //options.setToMPC();
54  //options.setToReliable();
55  //options.printLevel = PL_LOW;
56  //options.printLevel = PL_MEDIUM;
57  options.printLevel = PL_TABULAR;
58 
59 
60  int_t nWSR;
61  int_t npass = 0;
62  real_t maxCPUtime; /* seconds */
63  real_t maxStationarity = 0.0, maxFeasibility = 0.0, maxComplementarity = 0.0;
64 
65  char oqpProblem[MAX_STRING_LENGTH];
66  char problem[] = "HS268";
67  returnValue returnvalue;
68 
69 
70  /* 3) Run benchmark. */
71  fprintf(stdFile, "%-10s ", problem);
72  fflush(stdFile);
73 
74  snprintf(oqpProblem, MAX_STRING_LENGTH, "../testing/cpp/data/problems/%s/", problem);
75  maxCPUtime = 100.0;
76  nWSR = 100;
77 
78  returnvalue = runOqpBenchmark( oqpProblem, isSparse, options,
79  nWSR, maxCPUtime, maxStationarity, maxFeasibility, maxComplementarity
80  );
81 
82  if(returnvalue == SUCCESSFUL_RETURN) {
83  npass += 1;
84  }
85 
86  QPOASES_TEST_FOR_TRUE( npass >= 1 );
87 
88  printf( "\n" );
89  printf( "stat: %e\n", maxStationarity );
90  printf( "feas: %e\n", maxFeasibility );
91  printf( "cmpl: %e\n", maxComplementarity );
92 
93  QPOASES_TEST_FOR_TOL( maxStationarity, 1e-11 );
94  QPOASES_TEST_FOR_TOL( maxFeasibility, 1e-14 );
95  QPOASES_TEST_FOR_TOL( maxComplementarity, 1e-14 );
96 
97 
98  return 0;
99 }
100 
101 
102 /*
103  * end of file
104  */
returnValue setToDefault()
Allows to pass back messages to the calling function.
#define stdFile
Provides a generic way to set and pass user-specified options.
Definition: options.hpp:65
#define QPOASES_TEST_FOR_TOL(x, tol)
Definition: UnitTesting.hpp:61
returnValue runOqpBenchmark(const char *path, BooleanType isSparse, const Options &options, int_t &nWSR, real_t &maxCPUtime, real_t &maxStationarity, real_t &maxFeasibility, real_t &maxComplementarity)
int main(int argc, char *argv[])
Definition: test_hs268.cpp:44
#define BT_FALSE
Definition: acado_types.hpp:49
#define PL_TABULAR
double real_t
Definition: AD_test.c:10
#define QPOASES_TEST_FOR_TRUE(x)
Definition: UnitTesting.hpp:64


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