qpOASES-3.2.0/src/Options.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 <qpOASES/Options.hpp>
37 
38 
40 
41 
42 /*****************************************************************************
43  * P U B L I C *
44  *****************************************************************************/
45 
46 
47 /*
48  * O p t i o n s
49  */
51 {
52  setToDefault( );
53 }
54 
55 
56 /*
57  * O p t i o n s
58  */
60 {
61  copy( rhs );
62 }
63 
64 
65 /*
66  * ~ O p t i o n s
67  */
69 {
70 }
71 
72 
73 /*
74  * o p e r a t o r =
75  */
77 {
78  if ( this != &rhs )
79  {
80  copy( rhs );
81  }
82 
83  return *this;
84 }
85 
86 
87 
88 /*
89  * s e t T o D e f a u l t
90  */
92 {
94  #ifdef __DEBUG__
96  #endif
97  #ifdef __SUPPRESSANYOUTPUT__
99  #endif
100 
110 
111  #ifdef __USE_SINGLE_PRECISION__
112  terminationTolerance = 1.0e2 * EPS;
113  boundTolerance = 1.0e2 * EPS;
114  #else
115  terminationTolerance = 5.0e6 * EPS;
116  boundTolerance = 1.0e6 * EPS;
117  #endif
118  boundRelaxation = 1.0e4;
119  #ifdef __USE_SINGLE_PRECISION__
120  epsNum = -1.0e2 * EPS;
121  epsDen = 1.0e2 * EPS;
122  #else
123  epsNum = -1.0e3 * EPS;
124  epsDen = 1.0e3 * EPS;
125  #endif
126  maxPrimalJump = 1.0e8;
127  maxDualJump = 1.0e8;
128 
129  initialRamping = 0.5;
130  finalRamping = 1.0;
131  initialFarBounds = 1.0e6;
132  growFarBounds = 1.0e3;
134  #ifdef __USE_SINGLE_PRECISION__
135  epsFlipping = 5.0e1 * EPS;
136  #else
137  epsFlipping = 1.0e3 * EPS;
138  #endif
140  #ifdef __USE_SINGLE_PRECISION__
141  epsRegularisation = 2.0e1 * EPS;
142  numRefinementSteps = 2;
143  #else
144  epsRegularisation = 1.0e3 * EPS;
145  numRefinementSteps = 1;
146  #endif
147  epsIterRef = 1.0e2 * EPS;
148  #ifdef __USE_SINGLE_PRECISION__
149  epsLITests = 5.0e1 * EPS;
150  epsNZCTests = 1.0e2 * EPS;
151  #else
152  epsLITests = 1.0e5 * EPS;
153  epsNZCTests = 3.0e3 * EPS;
154  #endif
155 
157  dropBoundPriority = 1;
158  dropEqConPriority = 1;
160 
162  rcondSMin = 1.0e-14;
163 
164  return SUCCESSFUL_RETURN;
165 }
166 
167 
168 /*
169  * s e t T o R e l i a b l e
170  */
172 {
173  setToDefault( );
174 
177 
178  #ifdef __USE_SINGLE_PRECISION__
179  numRefinementSteps = 3;
180  #else
181  numRefinementSteps = 2;
182  #endif
183 
184  return SUCCESSFUL_RETURN;
185 }
186 
187 
188 /*
189  * s e t T o M P C
190  */
192 {
193  setToDefault( );
194 
202 
203  #ifdef __USE_SINGLE_PRECISION__
204  terminationTolerance = 1.0e3 * EPS;
205  #else
206  terminationTolerance = 1.0e9 * EPS;
207  #endif
208 
211  #ifdef __USE_SINGLE_PRECISION__
212  numRefinementSteps = 2;
213  #else
214  numRefinementSteps = 0;
215  #endif
216 
217  return SUCCESSFUL_RETURN;
218 }
219 
220 
221 /*
222  * s e t T o F a s t
223  */
225 {
226  return setToMPC( );
227 }
228 
229 
230 
231 /*
232  * e n s u r e C o n s i s t e n c y
233  */
235 {
236  BooleanType needToAdjust = BT_FALSE;
237 
238  /* flipping bounds require far bounds */
239  /* (ckirches) Removed this as per filter's trust region
240  if( enableFlippingBounds == BT_TRUE )
241  enableFarBounds = BT_TRUE;
242  */
243 
244  if( enableDriftCorrection < 0 )
245  {
247  needToAdjust = BT_TRUE;
248  }
249 
251  {
253  needToAdjust = BT_TRUE;
254  }
255 
256  if ( terminationTolerance <= 0.0 )
257  {
259  needToAdjust = BT_TRUE;
260  }
261 
262  if ( epsIterRef <= 0.0 )
263  {
264  epsIterRef = EPS;
265  needToAdjust = BT_TRUE;
266  }
267 
268  if ( epsRegularisation <= 0.0 )
269  {
271  needToAdjust = BT_TRUE;
272  }
273 
274  if ( boundTolerance <= 0.0 )
275  {
277  needToAdjust = BT_TRUE;
278  }
279 
280  if ( boundRelaxation <= 0.0 )
281  {
283  needToAdjust = BT_TRUE;
284  }
285 
286  if ( maxPrimalJump <= 0.0 )
287  {
288  maxPrimalJump = EPS;
289  needToAdjust = BT_TRUE;
290  }
291 
292  if ( maxDualJump <= 0.0 )
293  {
294  maxDualJump = EPS;
295  needToAdjust = BT_TRUE;
296  }
297 
298 
299  if ( initialRamping < 0.0 )
300  {
301  initialRamping = 0.0;
302  needToAdjust = BT_TRUE;
303  }
304 
305  if ( finalRamping < 0.0 )
306  {
307  finalRamping = 0.0;
308  needToAdjust = BT_TRUE;
309  }
310 
312  {
314  needToAdjust = BT_TRUE;
315  }
316 
317  if ( growFarBounds < 1.1 )
318  {
319  growFarBounds = 1.1;
320  needToAdjust = BT_TRUE;
321  }
322 
323  if ( epsFlipping <= 0.0 )
324  {
325  epsFlipping = EPS;
326  needToAdjust = BT_TRUE;
327  }
328 
329  if ( numRegularisationSteps < 0 )
330  {
332  needToAdjust = BT_TRUE;
333  }
334 
335  if ( epsRegularisation < 0.0 )
336  {
338  needToAdjust = BT_TRUE;
339  }
340 
341  if ( numRefinementSteps < 0 )
342  {
343  numRefinementSteps = 0;
344  needToAdjust = BT_TRUE;
345  }
346 
347  if ( epsIterRef < 0.0 )
348  {
349  epsIterRef = EPS;
350  needToAdjust = BT_TRUE;
351  }
352 
353  if ( epsLITests < 0.0 )
354  {
355  epsLITests = EPS;
356  needToAdjust = BT_TRUE;
357  }
358 
359  if ( epsNZCTests < 0.0 )
360  {
361  epsNZCTests = EPS;
362  needToAdjust = BT_TRUE;
363  }
364 
365  if ( needToAdjust == BT_TRUE)
367 
368  return SUCCESSFUL_RETURN;
369 }
370 
371 
372 /*
373  * p r i n t
374  */
376 {
377  #ifndef __SUPPRESSANYOUTPUT__
378 
379  char myPrintfString[MAX_STRING_LENGTH];
380  char info[MAX_STRING_LENGTH];
381 
382  myPrintf( "\n################### qpOASES -- QP OPTIONS ##################\n" );
383  myPrintf( "\n" );
384 
386  snprintf( myPrintfString,MAX_STRING_LENGTH,"printLevel = %s\n",info );
387  myPrintf( myPrintfString );
388 
389  myPrintf( "\n" );
390 
392  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableRamping = %s\n",info );
393  myPrintf( myPrintfString );
394 
396  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFarBounds = %s\n",info );
397  myPrintf( myPrintfString );
398 
400  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFlippingBounds = %s\n",info );
401  myPrintf( myPrintfString );
402 
404  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableRegularisation = %s\n",info );
405  myPrintf( myPrintfString );
406 
408  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFullLITests = %s\n",info );
409  myPrintf( myPrintfString );
410 
412  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableNZCTests = %s\n",info );
413  myPrintf( myPrintfString );
414 
415  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableDriftCorrection = %d\n",(int)enableDriftCorrection );
416  myPrintf( myPrintfString );
417 
418  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableCholeskyRefactorisation = %d\n",(int)enableCholeskyRefactorisation );
419  myPrintf( myPrintfString );
420 
422  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableEqualities = %s\n",info );
423  myPrintf( myPrintfString );
424 
426  snprintf( myPrintfString,MAX_STRING_LENGTH,"enableInertiaCorrection = %s\n",info );
427  myPrintf( myPrintfString );
428 
429  snprintf( myPrintfString,MAX_STRING_LENGTH,"rcondSMin = %e\n",rcondSMin );
430  myPrintf( myPrintfString );
431 
432  myPrintf( "\n" );
433 
434  snprintf( myPrintfString,MAX_STRING_LENGTH,"terminationTolerance = %e\n",terminationTolerance );
435  myPrintf( myPrintfString );
436 
437  snprintf( myPrintfString,MAX_STRING_LENGTH,"boundTolerance = %e\n",boundTolerance );
438  myPrintf( myPrintfString );
439 
440  snprintf( myPrintfString,MAX_STRING_LENGTH,"boundRelaxation = %e\n",boundRelaxation );
441  myPrintf( myPrintfString );
442 
443  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsNum = %e\n",epsNum );
444  myPrintf( myPrintfString );
445 
446  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsDen = %e\n",epsDen );
447  myPrintf( myPrintfString );
448 
449  snprintf( myPrintfString,MAX_STRING_LENGTH,"maxPrimalJump = %e\n",maxPrimalJump );
450  myPrintf( myPrintfString );
451 
452  snprintf( myPrintfString,MAX_STRING_LENGTH,"maxDualJump = %e\n",maxDualJump );
453  myPrintf( myPrintfString );
454 
455  myPrintf( "\n" );
456 
457  snprintf( myPrintfString,MAX_STRING_LENGTH,"initialRamping = %e\n",initialRamping );
458  myPrintf( myPrintfString );
459 
460  snprintf( myPrintfString,MAX_STRING_LENGTH,"finalRamping = %e\n",finalRamping );
461  myPrintf( myPrintfString );
462 
463  snprintf( myPrintfString,MAX_STRING_LENGTH,"initialFarBounds = %e\n",initialFarBounds );
464  myPrintf( myPrintfString );
465 
466  snprintf( myPrintfString,MAX_STRING_LENGTH,"growFarBounds = %e\n",growFarBounds );
467  myPrintf( myPrintfString );
468 
470  snprintf( myPrintfString,MAX_STRING_LENGTH,"initialStatusBounds = %s\n",info );
471  myPrintf( myPrintfString );
472 
473  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsFlipping = %e\n",epsFlipping );
474  myPrintf( myPrintfString );
475 
476  snprintf( myPrintfString,MAX_STRING_LENGTH,"numRegularisationSteps = %d\n",(int)numRegularisationSteps );
477  myPrintf( myPrintfString );
478 
479  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsRegularisation = %e\n",epsRegularisation );
480  myPrintf( myPrintfString );
481 
482  snprintf( myPrintfString,MAX_STRING_LENGTH,"numRefinementSteps = %d\n",(int)numRefinementSteps );
483  myPrintf( myPrintfString );
484 
485  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsIterRef = %e\n",epsIterRef );
486  myPrintf( myPrintfString );
487 
488  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsLITests = %e\n",epsLITests );
489  myPrintf( myPrintfString );
490 
491  snprintf( myPrintfString,MAX_STRING_LENGTH,"epsNZCTests = %e\n",epsNZCTests );
492  myPrintf( myPrintfString );
493 
494  myPrintf( "\n\n" );
495 
496  #endif /* __SUPPRESSANYOUTPUT__ */
497 
498  return SUCCESSFUL_RETURN;
499 }
500 
501 
502 
503 /*****************************************************************************
504  * P R O T E C T E D *
505  *****************************************************************************/
506 
507 /*
508  * c o p y
509  */
511  )
512 {
513  printLevel = rhs.printLevel;
514 
524 
528  epsNum = rhs.epsNum;
529  epsDen = rhs.epsDen;
531  maxDualJump = rhs.maxDualJump;
532 
538  epsFlipping = rhs.epsFlipping;
542  epsIterRef = rhs.epsIterRef;
543  epsLITests = rhs.epsLITests;
544  epsNZCTests = rhs.epsNZCTests;
545 
547  rcondSMin = rhs.rcondSMin;
548 
553 
554  return SUCCESSFUL_RETURN;
555 }
556 
557 
559 
560 
561 /*
562  * end of file
563  */
returnValue convertPrintLevelToString(PrintLevel value, char *const string)
Options()
Definition: options.cpp:45
#define ST_LOWER
virtual ~Options()
Definition: options.cpp:58
returnValue setToDefault()
returnValue copy(const Options &rhs)
BEGIN_NAMESPACE_ACADO const double EPS
Allows to pass back messages to the calling function.
returnValue print() const
#define PL_MEDIUM
#define PL_NONE
returnValue myPrintf(const char *s)
returnValue convertSubjectToStatusToString(SubjectToStatus value, char *const string)
#define ST_INACTIVE
#define PL_HIGH
Provides a generic way to set and pass user-specified options.
Definition: options.hpp:65
Options & operator=(const Options &rhs)
void rhs(const real_t *x, real_t *f)
#define BT_TRUE
Definition: acado_types.hpp:47
returnValue convertBooleanTypeToString(BooleanType value, char *const string)
returnValue setToMPC()
#define BT_FALSE
Definition: acado_types.hpp:49
returnValue setToReliable()
returnValue ensureConsistency()


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