external_packages/qpoases/INCLUDE/QProblemB.hpp
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-2008 by Hans Joachim Ferreau et al. All rights reserved.
6  *
7  * qpOASES is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * qpOASES is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with qpOASES; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 
37 #ifndef QPOASES_QPROBLEMB_HPP
38 #define QPOASES_QPROBLEMB_HPP
39 
40 
41 #include <Bounds.hpp>
42 
43 
44 
45 class SolutionAnalysis;
46 
55 class QProblemB
56 {
57  /* allow SolutionAnalysis class to access private members */
58  friend class SolutionAnalysis;
59 
60  /*
61  * PUBLIC MEMBER FUNCTIONS
62  */
63  public:
65  QProblemB( );
66 
68  QProblemB( int _nV
69  );
70 
72  QProblemB( const QProblemB& rhs
73  );
74 
76  ~QProblemB( );
77 
80  );
81 
82 
86  returnValue reset( );
87 
88 
101  returnValue init( const real_t* const _H,
102  const real_t* const _g,
103  const real_t* const _lb,
105  const real_t* const _ub,
107  int& nWSR,
109  const real_t* const yOpt = 0,
110  real_t* const cputime = 0
111  );
112 
113 
126  returnValue init( const real_t* const _H,
127  const real_t* const _R,
128  const real_t* const _g,
129  const real_t* const _lb,
131  const real_t* const _ub,
133  int& nWSR,
135  const real_t* const yOpt = 0,
136  real_t* const cputime = 0
137  );
138 
139 
153  returnValue hotstart( const real_t* const g_new,
154  const real_t* const lb_new,
156  const real_t* const ub_new,
158  int& nWSR,
160  real_t* const cputime
161  );
162 
163 
166  inline returnValue getH( real_t* const _H
167  ) const;
168 
171  inline returnValue getG( real_t* const _g
172  ) const;
173 
176  inline returnValue getLB( real_t* const _lb
177  ) const;
178 
182  inline returnValue getLB( int number,
183  real_t& value
184  ) const;
185 
188  inline returnValue getUB( real_t* const _ub
189  ) const;
190 
194  inline returnValue getUB( int number,
195  real_t& value
196  ) const;
197 
198 
201  inline returnValue getBounds( Bounds* const _bounds
202  ) const;
203 
204 
207  inline int getNV( ) const;
208 
211  inline int getNFR( );
212 
215  inline int getNFX( );
216 
219  inline int getNFV( ) const;
220 
223  int getNZ( );
224 
225 
229  real_t getObjVal( ) const;
230 
233  real_t getObjVal( const real_t* const _x
234  ) const;
235 
240  ) const;
241 
245  returnValue getDualSolution( real_t* const yOpt
246  ) const;
247 
248 
251  inline QProblemStatus getStatus( ) const;
252 
253 
257  inline BooleanType isInitialised( ) const;
258 
262  inline BooleanType isSolved( ) const;
263 
267  inline BooleanType isInfeasible( ) const;
268 
272  inline BooleanType isUnbounded( ) const;
273 
274 
277  inline PrintLevel getPrintLevel( ) const;
278 
281  returnValue setPrintLevel( PrintLevel _printlevel
282  );
283 
284 
287  inline HessianType getHessianType( ) const;
288 
291  inline returnValue setHessianType( HessianType _hessianType
292  );
293 
294 
295  /*
296  * PROTECTED MEMBER FUNCTIONS
297  */
298  protected:
303 
308 
314 
315 
326  returnValue solveInitialQP( const real_t* const xOpt,
328  const real_t* const yOpt,
330  const Bounds* const guessedBounds,
332  int& nWSR,
334  real_t* const cputime
335  );
336 
337 
345  const real_t* const yOpt,
347  const Bounds* const guessedBounds,
348  Bounds* auxiliaryBounds
350  ) const;
351 
359  returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds,
360  BooleanType setupAfresh
362  );
363 
368  const real_t* const yOpt
370  );
371 
377 
384  );
385 
386 
390  returnValue addBound( int number,
391  SubjectToStatus B_status,
392  BooleanType updateCholesky
393  );
394 
399  returnValue removeBound( int number,
400  BooleanType updateCholesky
401  );
402 
403 
407  returnValue backsolveR( const real_t* const b,
408  BooleanType transposed,
409  real_t* const a
410  );
411 
416  returnValue backsolveR( const real_t* const b,
417  BooleanType transposed,
418  BooleanType removingBound,
419  real_t* const a
420  );
421 
422 
426  const real_t* const g_new,
427  const real_t* const lb_new,
428  const real_t* const ub_new,
429  real_t* const delta_g,
430  real_t* const delta_lb,
431  real_t* const delta_ub,
432  BooleanType& Delta_bB_isZero
433  );
434 
435 
440  BooleanType areBoundsConsistent( const real_t* const delta_lb,
441  const real_t* const delta_ub
442  ) const;
443 
444 
448  returnValue setupQPdata( const real_t* const _H,
449  const real_t* const _R,
450  const real_t* const _g,
451  const real_t* const _lb,
453  const real_t* const _ub
455  );
456 
457 
460  inline returnValue setH( const real_t* const H_new
461  );
462 
465  inline returnValue setG( const real_t* const g_new
466  );
467 
470  inline returnValue setLB( const real_t* const lb_new
471  );
472 
476  inline returnValue setLB( int number,
477  real_t value
478  );
479 
482  inline returnValue setUB( const real_t* const ub_new
483  );
484 
488  inline returnValue setUB( int number,
489  real_t value
490  );
491 
492 
495  inline void computeGivens( real_t xold,
496  real_t yold,
497  real_t& xnew,
498  real_t& ynew,
499  real_t& c,
500  real_t& s
501  ) const;
502 
505  inline void applyGivens( real_t c,
506  real_t s,
507  real_t xold,
509  real_t yold,
511  real_t& xnew,
513  real_t& ynew
515  ) const;
516 
517 
518  /*
519  * PRIVATE MEMBER FUNCTIONS
520  */
521  private:
526  const int* const FX_idx,
527  const real_t* const delta_g,
528  const real_t* const delta_lb,
529  const real_t* const delta_ub,
530  BooleanType Delta_bB_isZero,
531  real_t* const delta_xFX,
532  real_t* const delta_xFR,
533  real_t* const delta_yFX
534  );
535 
539  const int* const FX_idx,
540  const real_t* const delta_lb,
541  const real_t* const delta_ub,
542  const real_t* const delta_xFR,
543  const real_t* const delta_yFX,
544  int& BC_idx,
545  SubjectToStatus& BC_status
546  );
547 
554  returnValue hotstart_performStep( const int* const FR_idx,
555  const int* const FX_idx,
556  const real_t* const delta_g,
557  const real_t* const delta_lb,
558  const real_t* const delta_ub,
559  const real_t* const delta_xFX,
560  const real_t* const delta_xFR,
561  const real_t* const delta_yFX,
562  int BC_idx,
563  SubjectToStatus BC_status
564  );
565 
566 
567  #ifdef PC_DEBUG /* Define print functions only for debugging! */
568 
571  returnValue printIteration( int iteration,
572  int BC_idx,
573  SubjectToStatus BC_status
574  );
575 
576  #endif /* PC_DEBUG */
577 
578 
585 
586 
587  /*
588  * PROTECTED MEMBER VARIABLES
589  */
590  protected:
591  real_t H[NVMAX*NVMAX];
594  real_t g[NVMAX];
595  real_t lb[NVMAX];
596  real_t ub[NVMAX];
598  Bounds bounds;
600  real_t R[NVMAX*NVMAX];
603  real_t x[NVMAX];
604  real_t y[NVMAX+NCMAX];
606  real_t tau;
617  int count;
618 };
619 
620 
621 #include <QProblemB.ipp>
622 
623 #endif /* QPOASES_QPROBLEMB_HPP */
624 
625 
626 /*
627  * end of file
628  */
HessianType getHessianType() const
BooleanType isInfeasible() const
Implements the online active set strategy for box-constrained QPs.
int getNFV() const
BooleanType isUnbounded() const
int getNFX()
void computeGivens(real_t xold, real_t yold, real_t &xnew, real_t &ynew, real_t &c, real_t &s) const
returnValue obtainAuxiliaryWorkingSet(const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, Bounds *auxiliaryBounds) const
Allows to pass back messages to the calling function.
returnValue getG(real_t *const _g) const
returnValue setupAuxiliaryWorkingSet(const Bounds *const auxiliaryBounds, BooleanType setupAfresh)
returnValue getBounds(Bounds *const _bounds) const
int getNV() const
returnValue setH(const real_t *const H_new)
returnValue setupAuxiliaryQPsolution(const real_t *const xOpt, const real_t *const yOpt)
returnValue backsolveR(const real_t *const b, BooleanType transposed, real_t *const a)
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
returnValue hotstart(const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime)
returnValue addBound(int number, SubjectToStatus B_status, BooleanType updateCholesky)
returnValue hotstart_determineStepLength(const int *const FR_idx, const int *const FX_idx, const real_t *const delta_lb, const real_t *const delta_ub, const real_t *const delta_xFR, const real_t *const delta_yFX, int &BC_idx, SubjectToStatus &BC_status)
returnValue setupQPdata(const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub)
returnValue printIteration(int iteration, int BC_idx, SubjectToStatus BC_status)
BooleanType areBoundsConsistent(const real_t *const delta_lb, const real_t *const delta_ub) const
PrintLevel getPrintLevel() const
returnValue hotstart_performStep(const int *const FR_idx, const int *const FX_idx, const real_t *const delta_g, const real_t *const delta_lb, const real_t *const delta_ub, const real_t *const delta_xFX, const real_t *const delta_xFR, const real_t *const delta_yFX, int BC_idx, SubjectToStatus BC_status)
int getNFR()
returnValue setHessianType(HessianType _hessianType)
void rhs(const real_t *x, real_t *f)
PrintLevel
BooleanType isInitialised() const
QProblemStatus getStatus() const
returnValue getH(real_t *const _H) const
returnValue setUB(const real_t *const ub_new)
returnValue setG(const real_t *const g_new)
returnValue hotstart_determineDataShift(const int *const FX_idx, const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, real_t *const delta_g, real_t *const delta_lb, real_t *const delta_ub, BooleanType &Delta_bB_isZero)
returnValue removeBound(int number, BooleanType updateCholesky)
Manages working sets of bounds (= box constraints).
returnValue hotstart_determineStepDirection(const int *const FR_idx, const int *const FX_idx, const real_t *const delta_g, const real_t *const delta_lb, const real_t *const delta_ub, BooleanType Delta_bB_isZero, real_t *const delta_xFX, real_t *const delta_xFR, real_t *const delta_yFX)
double real_t
Definition: AD_test.c:10
returnValue getUB(real_t *const _ub) const
void applyGivens(real_t c, real_t s, real_t xold, real_t yold, real_t &xnew, real_t &ynew) const
returnValue solveInitialQP(const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, int &nWSR, real_t *const cputime)
returnValue setLB(const real_t *const lb_new)
returnValue getLB(real_t *const _lb) const
BooleanType isSolved() const


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