examples/code_generation/mpc_mhe/getting_started_export/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 
127  returnValue hotstart( const real_t* const g_new,
128  const real_t* const lb_new,
130  const real_t* const ub_new,
132  int& nWSR,
134  real_t* const cputime
135  );
136 
137 
140  inline returnValue getH( real_t* const _H
141  ) const;
142 
145  inline returnValue getG( real_t* const _g
146  ) const;
147 
150  inline returnValue getLB( real_t* const _lb
151  ) const;
152 
156  inline returnValue getLB( int number,
157  real_t& value
158  ) const;
159 
162  inline returnValue getUB( real_t* const _ub
163  ) const;
164 
168  inline returnValue getUB( int number,
169  real_t& value
170  ) const;
171 
172 
175  inline returnValue getBounds( Bounds* const _bounds
176  ) const;
177 
178 
181  inline int getNV( ) const;
182 
185  inline int getNFR( );
186 
189  inline int getNFX( );
190 
193  inline int getNFV( ) const;
194 
197  int getNZ( );
198 
199 
203  real_t getObjVal( ) const;
204 
207  real_t getObjVal( const real_t* const _x
208  ) const;
209 
214  ) const;
215 
219  returnValue getDualSolution( real_t* const yOpt
220  ) const;
221 
222 
225  inline QProblemStatus getStatus( ) const;
226 
227 
231  inline BooleanType isInitialised( ) const;
232 
236  inline BooleanType isSolved( ) const;
237 
241  inline BooleanType isInfeasible( ) const;
242 
246  inline BooleanType isUnbounded( ) const;
247 
248 
251  inline PrintLevel getPrintLevel( ) const;
252 
255  returnValue setPrintLevel( PrintLevel _printlevel
256  );
257 
258 
261  inline HessianType getHessianType( ) const;
262 
265  inline returnValue setHessianType( HessianType _hessianType
266  );
267 
268 
269  /*
270  * PROTECTED MEMBER FUNCTIONS
271  */
272  protected:
277 
282 
288 
289 
300  returnValue solveInitialQP( const real_t* const xOpt,
302  const real_t* const yOpt,
304  const Bounds* const guessedBounds,
306  int& nWSR,
308  real_t* const cputime
309  );
310 
311 
319  const real_t* const yOpt,
321  const Bounds* const guessedBounds,
322  Bounds* auxiliaryBounds
324  ) const;
325 
333  returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds,
334  BooleanType setupAfresh
336  );
337 
342  const real_t* const yOpt
344  );
345 
351 
358  );
359 
360 
364  returnValue addBound( int number,
365  SubjectToStatus B_status,
366  BooleanType updateCholesky
367  );
368 
373  returnValue removeBound( int number,
374  BooleanType updateCholesky
375  );
376 
377 
381  returnValue backsolveR( const real_t* const b,
382  BooleanType transposed,
383  real_t* const a
384  );
385 
390  returnValue backsolveR( const real_t* const b,
391  BooleanType transposed,
392  BooleanType removingBound,
393  real_t* const a
394  );
395 
396 
400  const real_t* const g_new,
401  const real_t* const lb_new,
402  const real_t* const ub_new,
403  real_t* const delta_g,
404  real_t* const delta_lb,
405  real_t* const delta_ub,
406  BooleanType& Delta_bB_isZero
407  );
408 
409 
414  BooleanType areBoundsConsistent( const real_t* const delta_lb,
415  const real_t* const delta_ub
416  ) const;
417 
418 
422  returnValue setupQPdata( const real_t* const _H,
423  const real_t* const _g,
424  const real_t* const _lb,
426  const real_t* const _ub
428  );
429 
430 
433  inline returnValue setH( const real_t* const H_new
434  );
435 
438  inline returnValue setG( const real_t* const g_new
439  );
440 
443  inline returnValue setLB( const real_t* const lb_new
444  );
445 
449  inline returnValue setLB( int number,
450  real_t value
451  );
452 
455  inline returnValue setUB( const real_t* const ub_new
456  );
457 
461  inline returnValue setUB( int number,
462  real_t value
463  );
464 
465 
468  inline void computeGivens( real_t xold,
469  real_t yold,
470  real_t& xnew,
471  real_t& ynew,
472  real_t& c,
473  real_t& s
474  ) const;
475 
478  inline void applyGivens( real_t c,
479  real_t s,
480  real_t xold,
482  real_t yold,
484  real_t& xnew,
486  real_t& ynew
488  ) const;
489 
490 
491  /*
492  * PRIVATE MEMBER FUNCTIONS
493  */
494  private:
499  const int* const FX_idx,
500  const real_t* const delta_g,
501  const real_t* const delta_lb,
502  const real_t* const delta_ub,
503  BooleanType Delta_bB_isZero,
504  real_t* const delta_xFX,
505  real_t* const delta_xFR,
506  real_t* const delta_yFX
507  );
508 
512  const int* const FX_idx,
513  const real_t* const delta_lb,
514  const real_t* const delta_ub,
515  const real_t* const delta_xFR,
516  const real_t* const delta_yFX,
517  int& BC_idx,
518  SubjectToStatus& BC_status
519  );
520 
527  returnValue hotstart_performStep( const int* const FR_idx,
528  const int* const FX_idx,
529  const real_t* const delta_g,
530  const real_t* const delta_lb,
531  const real_t* const delta_ub,
532  const real_t* const delta_xFX,
533  const real_t* const delta_xFR,
534  const real_t* const delta_yFX,
535  int BC_idx,
536  SubjectToStatus BC_status
537  );
538 
539 
540  #ifdef PC_DEBUG /* Define print functions only for debugging! */
541 
544  returnValue printIteration( int iteration,
545  int BC_idx,
546  SubjectToStatus BC_status
547  );
548 
549  #endif /* PC_DEBUG */
550 
551 
558 
559 
560  /*
561  * PROTECTED MEMBER VARIABLES
562  */
563  protected:
587  int count;
588 };
589 
590 
591 #include <QProblemB.ipp>
592 
593 #endif /* QPOASES_QPROBLEMB_HPP */
594 
595 
596 /*
597  * end of file
598  */
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