qpOASES-3.0beta/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-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/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 __XPCTARGET__
99  #endif
100 
110 
111  terminationTolerance = 1.0e7 * EPS;
112  boundTolerance = 1.0e6 * EPS;
113  boundRelaxation = 1.0e4;
114  epsNum = -1.0e3 * EPS;
115  epsDen = 1.0e3 * EPS;
116  maxPrimalJump = 1.0e8;
117  maxDualJump = 1.0e8;
118 
119  initialRamping = 0.5;
120  finalRamping = 1.0;
121  initialFarBounds = 1.0e4;
122  growFarBounds = 1.0e3;
124  epsFlipping = 1.0e4 * EPS;
126  epsRegularisation = 5.0e3 * EPS;
127  numRefinementSteps = 1;
128  epsIterRef = 1.0e2 * EPS;
129  epsLITests = 1.0e5 * EPS;
130  epsNZCTests = 1.0e5 * EPS;
131 
132  return SUCCESSFUL_RETURN;
133 }
134 
135 
136 /*
137  * s e t T o R e l i a b l e
138  */
140 {
141  setToDefault( );
142 
145 
146  numRefinementSteps = 2;
147 
148  return SUCCESSFUL_RETURN;
149 }
150 
151 
152 /*
153  * s e t T o F a s t
154  */
156 {
157  setToDefault( );
158 
166 
167  terminationTolerance = 1.0e9 * EPS;
168 
171  numRefinementSteps = 0;
172 
173  return SUCCESSFUL_RETURN;
174 }
175 
176 
177 
178 /*
179  * e n s u r e C o n s i s t e n c y
180  */
182 {
183  /* flipping bounds require far bounds */
186 
187  if( enableDriftCorrection < 0 )
189 
192 
193 
194  if ( terminationTolerance <= 0.0 )
196 
197  if ( epsIterRef <= 0.0 )
198  epsIterRef = EPS;
199 
200  if ( epsRegularisation <= 0.0 )
202 
203  if ( boundTolerance <= 0.0 )
205 
206  if ( boundRelaxation <= 0.0 )
208 
209  if ( maxPrimalJump <= 0.0 )
210  maxPrimalJump = EPS;
211 
212  if ( maxDualJump <= 0.0 )
213  maxDualJump = EPS;
214 
215 
216  if ( initialRamping < 0.0 )
217  initialRamping = 0.0;
218 
219  if ( finalRamping < 0.0 )
220  finalRamping = 0.0;
221 
224 
225  if ( growFarBounds < 1.1 )
226  growFarBounds = 1.1;
227 
228  if ( epsFlipping <= 0.0 )
229  epsFlipping = EPS;
230 
231  if ( numRegularisationSteps < 0 )
233 
234  if ( epsRegularisation < 0.0 )
236 
237  if ( numRefinementSteps < 0 )
238  numRefinementSteps = 0;
239 
240  if ( epsIterRef < 0.0 )
241  epsIterRef = EPS;
242 
243  if ( epsLITests < 0.0 )
244  epsLITests = EPS;
245 
246  if ( epsNZCTests < 0.0 )
247  epsNZCTests = EPS;
248 
249  return SUCCESSFUL_RETURN;
250 }
251 
252 
253 /*
254  * p r i n t
255  */
257 {
258  #ifndef __XPCTARGET__
259  #ifndef __DSPACE__
260  char myPrintfString[160];
261  char info[20];
262 
263  myPrintf( "\n################### qpOASES -- QP OPTIONS ##################\n" );
264  myPrintf( "\n" );
265 
267  snprintf( myPrintfString,80,"printLevel = %s\n",info );
268  myPrintf( myPrintfString );
269 
270  myPrintf( "\n" );
271 
273  snprintf( myPrintfString,80,"enableRamping = %s\n",info );
274  myPrintf( myPrintfString );
275 
277  snprintf( myPrintfString,80,"enableFarBounds = %s\n",info );
278  myPrintf( myPrintfString );
279 
281  snprintf( myPrintfString,80,"enableFlippingBounds = %s\n",info );
282  myPrintf( myPrintfString );
283 
285  snprintf( myPrintfString,80,"enableRegularisation = %s\n",info );
286  myPrintf( myPrintfString );
287 
289  snprintf( myPrintfString,80,"enableFullLITests = %s\n",info );
290  myPrintf( myPrintfString );
291 
293  snprintf( myPrintfString,80,"enableNZCTests = %s\n",info );
294  myPrintf( myPrintfString );
295 
296  snprintf( myPrintfString,80,"enableDriftCorrection = %d\n",enableDriftCorrection );
297  myPrintf( myPrintfString );
298 
299  snprintf( myPrintfString,80,"enableCholeskyRefactorisation = %d\n",enableCholeskyRefactorisation );
300  myPrintf( myPrintfString );
301 
303  snprintf( myPrintfString,80,"enableEqualities = %s\n",info );
304  myPrintf( myPrintfString );
305 
306  myPrintf( "\n" );
307 
308  snprintf( myPrintfString,80,"terminationTolerance = %e\n",terminationTolerance );
309  myPrintf( myPrintfString );
310 
311  snprintf( myPrintfString,80,"boundTolerance = %e\n",boundTolerance );
312  myPrintf( myPrintfString );
313 
314  snprintf( myPrintfString,80,"boundRelaxation = %e\n",boundRelaxation );
315  myPrintf( myPrintfString );
316 
317  snprintf( myPrintfString,80,"epsNum = %e\n",epsNum );
318  myPrintf( myPrintfString );
319 
320  snprintf( myPrintfString,80,"epsDen = %e\n",epsDen );
321  myPrintf( myPrintfString );
322 
323  snprintf( myPrintfString,80,"maxPrimalJump = %e\n",maxPrimalJump );
324  myPrintf( myPrintfString );
325 
326  snprintf( myPrintfString,80,"maxDualJump = %e\n",maxDualJump );
327  myPrintf( myPrintfString );
328 
329  myPrintf( "\n" );
330 
331  snprintf( myPrintfString,80,"initialRamping = %e\n",initialRamping );
332  myPrintf( myPrintfString );
333 
334  snprintf( myPrintfString,80,"finalRamping = %e\n",finalRamping );
335  myPrintf( myPrintfString );
336 
337  snprintf( myPrintfString,80,"initialFarBounds = %e\n",initialFarBounds );
338  myPrintf( myPrintfString );
339 
340  snprintf( myPrintfString,80,"growFarBounds = %e\n",growFarBounds );
341  myPrintf( myPrintfString );
342 
344  snprintf( myPrintfString,80,"initialStatusBounds = %s\n",info );
345  myPrintf( myPrintfString );
346 
347  snprintf( myPrintfString,80,"epsFlipping = %e\n",epsFlipping );
348  myPrintf( myPrintfString );
349 
350  snprintf( myPrintfString,80,"numRegularisationSteps = %d\n",numRegularisationSteps );
351  myPrintf( myPrintfString );
352 
353  snprintf( myPrintfString,80,"epsRegularisation = %e\n",epsRegularisation );
354  myPrintf( myPrintfString );
355 
356  snprintf( myPrintfString,80,"numRefinementSteps = %d\n",numRefinementSteps );
357  myPrintf( myPrintfString );
358 
359  snprintf( myPrintfString,80,"epsIterRef = %e\n",epsIterRef );
360  myPrintf( myPrintfString );
361 
362  snprintf( myPrintfString,80,"epsLITests = %e\n",epsLITests );
363  myPrintf( myPrintfString );
364 
365  snprintf( myPrintfString,80,"epsNZCTests = %e\n",epsNZCTests );
366  myPrintf( myPrintfString );
367 
368  myPrintf( "\n\n" );
369  #endif
370  #endif
371 
372  return SUCCESSFUL_RETURN;
373 }
374 
375 
376 
377 /*****************************************************************************
378  * P R O T E C T E D *
379  *****************************************************************************/
380 
381 /*
382  * c o p y
383  */
385  )
386 {
387  printLevel = rhs.printLevel;
388 
398 
402  epsNum = rhs.epsNum;
403  epsDen = rhs.epsDen;
405  maxDualJump = rhs.maxDualJump;
406 
412  epsFlipping = rhs.epsFlipping;
416  epsIterRef = rhs.epsIterRef;
417  epsLITests = rhs.epsLITests;
418  epsNZCTests = rhs.epsNZCTests;
419 
420  return SUCCESSFUL_RETURN;
421 }
422 
423 
425 
426 
427 /*
428  * end of file
429  */
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)
#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:54