Bounds.h
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 #ifndef QPOASES_BOUNDS_H
37 #define QPOASES_BOUNDS_H
38 
39 
40 #include <qpOASES_e/Indexlist.h>
41 
42 
44 
45 
56 typedef struct
57 {
58  int n;
66  Indexlist freee;
67  Indexlist fixed;
68 } Bounds;
69 
70 
71 
73 void BoundsCON( Bounds* _THIS,
74  int _n
75  );
76 
79 void BoundsCPY( Bounds* FROM,
80  Bounds* TO
81  );
82 
83 
88  int _n
89  );
90 
91 
99  int number,
100  SubjectToStatus _status
101  );
102 
109  );
110 
117  );
118 
125  );
126 
127 
133  int number
134  );
135 
141  int number,
142  SubjectToStatus _status
143  );
144 
150  int number
151  );
152 
157  int number1,
158  int number2
159  );
160 
161 
164 static inline int Bounds_getNV( Bounds* _THIS
165  );
166 
169 static inline int Bounds_getNFV( Bounds* _THIS
170  );
171 
174 static inline int Bounds_getNBV( Bounds* _THIS
175  );
176 
179 static inline int Bounds_getNUV( Bounds* _THIS
180  );
181 
184 static inline int Bounds_getNFR( Bounds* _THIS
185  );
186 
189 static inline int Bounds_getNFX( Bounds* _THIS
190  );
191 
192 
195 static inline Indexlist* Bounds_getFree( Bounds* _THIS
196  );
197 
200 static inline Indexlist* Bounds_getFixed( Bounds* _THIS
201  );
202 
203 
206 static inline int Bounds_getNumberOfType( Bounds* _THIS,
207  SubjectToType _type
208  );
209 
210 
214 static inline SubjectToType Bounds_getType( Bounds* _THIS,
215  int i
216  );
217 
221 static inline SubjectToStatus Bounds_getStatus( Bounds* _THIS,
222  int i
223  );
224 
225 
229 static inline returnValue Bounds_setType( Bounds* _THIS,
230  int i,
231  SubjectToType value
232  );
233 
237 static inline returnValue Bounds_setStatus( Bounds* _THIS,
238  int i,
239  SubjectToStatus value
240  );
241 
242 
244 static inline void Bounds_setNoLower( Bounds* _THIS,
245  BooleanType _status
246  );
247 
249 static inline void Bounds_setNoUpper( Bounds* _THIS,
250  BooleanType _status
251  );
252 
253 
256 static inline BooleanType Bounds_hasNoLower( Bounds* _THIS
257  );
258 
261 static inline BooleanType Bounds_hasNoUpper( Bounds* _THIS
262  );
263 
264 
277  int offset
278  );
279 
288  int offset
289  );
290 
291 
297  );
298 
299 
306  SubjectToStatus _status
307  );
308 
309 
315  Indexlist* const indexlist,
316  int newnumber,
317  SubjectToStatus newstatus
318  );
319 
325  Indexlist* const indexlist,
326  int removenumber
327  );
328 
334  Indexlist* const indexlist,
335  int number1,
336  int number2
337  );
338 
339 
340 
341 /*
342  * g e t N u m b e r O f T y p e
343  */
344 static inline int Bounds_getNumberOfType( Bounds* _THIS, SubjectToType _type )
345 {
346  int i;
347  int numberOfType = 0;
348 
349  if ( _THIS->type != 0 )
350  {
351  for( i=0; i<_THIS->n; ++i )
352  if ( _THIS->type[i] == _type )
353  ++numberOfType;
354  }
355 
356  return numberOfType;
357 }
358 
359 
360 /*
361  * g e t T y p e
362  */
363 static inline SubjectToType Bounds_getType( Bounds* _THIS, int i )
364 {
365  if ( ( i >= 0 ) && ( i < _THIS->n ) )
366  return _THIS->type[i];
367 
368  return ST_UNKNOWN;
369 }
370 
371 
372 /*
373  * g e t S t a t u s
374  */
375 static inline SubjectToStatus Bounds_getStatus( Bounds* _THIS, int i )
376 {
377  if ( ( i >= 0 ) && ( i < _THIS->n ) )
378  return _THIS->status[i];
379 
380  return ST_UNDEFINED;
381 }
382 
383 
384 /*
385  * s e t T y p e
386  */
387 static inline returnValue Bounds_setType( Bounds* _THIS, int i, SubjectToType value )
388 {
389  if ( ( i >= 0 ) && ( i < _THIS->n ) )
390  {
391  _THIS->type[i] = value;
392  return SUCCESSFUL_RETURN;
393  }
394  else
396 }
397 
398 
399 /*
400  * s e t S t a t u s
401  */
402 static inline returnValue Bounds_setStatus( Bounds* _THIS, int i, SubjectToStatus value )
403 {
404  if ( ( i >= 0 ) && ( i < _THIS->n ) )
405  {
406  _THIS->status[i] = value;
407  return SUCCESSFUL_RETURN;
408  }
409  else
411 }
412 
413 
414 /*
415  * s e t N o L o w e r
416  */
417 static inline void Bounds_setNoLower( Bounds* _THIS, BooleanType _status )
418 {
419  _THIS->noLower = _status;
420 }
421 
422 
423 /*
424  * s e t N o U p p e r
425  */
426 static inline void Bounds_setNoUpper( Bounds* _THIS, BooleanType _status )
427 {
428  _THIS->noUpper = _status;
429 }
430 
431 
432 /*
433  * h a s N o L o w e r
434  */
435 static inline BooleanType Bounds_hasNoLower( Bounds* _THIS )
436 {
437  return _THIS->noLower;
438 }
439 
440 
441 /*
442  * h a s N o U p p p e r
443  */
444 static inline BooleanType Bounds_hasNoUpper( Bounds* _THIS )
445 {
446  return _THIS->noUpper;
447 }
448 
449 
450 
451 /*
452  * g e t N V
453  */
454 static inline int Bounds_getNV( Bounds* _THIS )
455 {
456  return _THIS->n;
457 }
458 
459 
460 /*
461  * g e t N F V
462  */
463 static inline int Bounds_getNFV( Bounds* _THIS )
464 {
465  return Bounds_getNumberOfType( _THIS,ST_EQUALITY );
466 }
467 
468 
469 /*
470  * g e t N B V
471  */
472 static inline int Bounds_getNBV( Bounds* _THIS )
473 {
474  return Bounds_getNumberOfType( _THIS,ST_BOUNDED );
475 }
476 
477 
478 /*
479  * g e t N U V
480  */
481 static inline int Bounds_getNUV( Bounds* _THIS )
482 {
483  return Bounds_getNumberOfType( _THIS,ST_UNBOUNDED );
484 }
485 
486 
487 /*
488  * g e t N F R
489  */
490 static inline int Bounds_getNFR( Bounds* _THIS )
491 {
492  return Indexlist_getLength( &(_THIS->freee) );
493 }
494 
495 
496 /*
497  * g e t N F X
498  */
499 static inline int Bounds_getNFX( Bounds* _THIS )
500 {
501  return Indexlist_getLength( &(_THIS->fixed) );
502 }
503 
504 
505 /*
506  * g e t F r e e
507  */
508 static inline Indexlist* Bounds_getFree( Bounds* _THIS )
509 {
510  return &(_THIS->freee);
511 }
512 
513 
514 /*
515  * g e t F i x e d
516  */
517 static inline Indexlist* Bounds_getFixed( Bounds* _THIS )
518 {
519  return &(_THIS->fixed);
520 }
521 
522 
524 
525 #endif /* QPOASES_BOUNDS_H */
526 
527 
528 /*
529  * end of file
530  */
returnValue Bounds_rotate(Bounds *_THIS, int offset)
Definition: Bounds.c:329
returnValue Bounds_setupBound(Bounds *_THIS, int number, SubjectToStatus _status)
Definition: Bounds.c:125
static int Bounds_getNumberOfType(Bounds *_THIS, SubjectToType _type)
Definition: Bounds.h:344
static Indexlist * Bounds_getFree(Bounds *_THIS)
Definition: Bounds.h:508
SubjectToStatus status[NVMAX]
Definition: Bounds.h:61
int n
Definition: Bounds.h:58
static BooleanType Bounds_hasNoLower(Bounds *_THIS)
Definition: Bounds.h:435
returnValue Bounds_setupAllLower(Bounds *_THIS)
Definition: Bounds.c:170
static void Bounds_setNoUpper(Bounds *_THIS, BooleanType _status)
Definition: Bounds.h:426
static int Bounds_getNFV(Bounds *_THIS)
Definition: Bounds.h:463
returnValue Bounds_setupAllFree(Bounds *_THIS)
Definition: Bounds.c:161
static SubjectToStatus Bounds_getStatus(Bounds *_THIS, int i)
Definition: Bounds.h:375
Allows to pass back messages to the calling function.
static BooleanType Bounds_hasNoUpper(Bounds *_THIS)
Definition: Bounds.h:444
returnValue Bounds_shift(Bounds *_THIS, int offset)
Definition: Bounds.c:265
returnValue Bounds_moveFreeToFixed(Bounds *_THIS, int number, SubjectToStatus _status)
Definition: Bounds.c:208
#define ST_UNDEFINED
static void Bounds_setNoLower(Bounds *_THIS, BooleanType _status)
Definition: Bounds.h:417
returnValue Bounds_setupAllUpper(Bounds *_THIS)
Definition: Bounds.c:179
static int Bounds_getNBV(Bounds *_THIS)
Definition: Bounds.h:472
returnValue Bounds_init(Bounds *_THIS, int _n)
Definition: Bounds.c:87
returnValue Bounds_removeIndex(Bounds *_THIS, Indexlist *const indexlist, int removenumber)
Definition: Bounds.c:522
static returnValue Bounds_setType(Bounds *_THIS, int i, SubjectToType value)
Definition: Bounds.h:387
returnValue Bounds_setupAll(Bounds *_THIS, SubjectToStatus _status)
Definition: Bounds.c:441
returnValue Bounds_addIndex(Bounds *_THIS, Indexlist *const indexlist, int newnumber, SubjectToStatus newstatus)
Definition: Bounds.c:492
returnValue Bounds_swapIndex(Bounds *_THIS, Indexlist *const indexlist, int number1, int number2)
Definition: Bounds.c:546
static int Bounds_getNFX(Bounds *_THIS)
Definition: Bounds.h:499
static int Indexlist_getLength(Indexlist *_THIS)
Definition: Indexlist.h:183
static int Bounds_getNV(Bounds *_THIS)
Definition: Bounds.h:454
static int Bounds_getNUV(Bounds *_THIS)
Definition: Bounds.h:481
BooleanType noUpper
Definition: Bounds.h:64
BooleanType noLower
Definition: Bounds.h:63
static int Bounds_getNFR(Bounds *_THIS)
Definition: Bounds.h:490
returnValue Bounds_moveFixedToFree(Bounds *_THIS, int number)
Definition: Bounds.c:188
returnValue Bounds_flipFixed(Bounds *_THIS, int number)
Definition: Bounds.c:229
void BoundsCPY(Bounds *FROM, Bounds *TO)
Definition: Bounds.c:59
returnValue Bounds_print(Bounds *_THIS)
Definition: Bounds.c:404
SubjectToType type[NVMAX]
Definition: Bounds.h:60
Manages working sets of bounds (= box constraints).
static SubjectToType Bounds_getType(Bounds *_THIS, int i)
Definition: Bounds.h:363
returnValue Bounds_swapFree(Bounds *_THIS, int number1, int number2)
Definition: Bounds.c:250
static returnValue Bounds_setStatus(Bounds *_THIS, int i, SubjectToStatus value)
Definition: Bounds.h:402
static Indexlist * Bounds_getFixed(Bounds *_THIS)
Definition: Bounds.h:517
void BoundsCON(Bounds *_THIS, int _n)
Definition: Bounds.c:50


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