examples/code_generation/mpc_mhe/getting_started_export/qpoases/INCLUDE/QProblem.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 
36 #ifndef QPOASES_QPROBLEM_HPP
37 #define QPOASES_QPROBLEM_HPP
38 
39 
40 #include <QProblemB.hpp>
41 #include <Constraints.hpp>
42 #include <CyclingManager.hpp>
43 
44 
53 class QProblem : public QProblemB
54 {
55  /* allow SolutionAnalysis class to access private members */
56  friend class SolutionAnalysis;
57 
58  /*
59  * PUBLIC MEMBER FUNCTIONS
60  */
61  public:
63  QProblem( );
64 
66  QProblem( int _nV,
67  int _nC
68  );
69 
71  QProblem( const QProblem& rhs
72  );
73 
75  ~QProblem( );
76 
78  QProblem& operator=( const QProblem& rhs
79  );
80 
81 
85  returnValue reset( );
86 
87 
101  returnValue init( const real_t* const _H,
102  const real_t* const _g,
103  const real_t* const _A,
104  const real_t* const _lb,
106  const real_t* const _ub,
108  const real_t* const _lbA,
110  const real_t* const _ubA,
112  int& nWSR,
114  const real_t* const yOpt = 0,
115  real_t* const cputime = 0
116  );
117 
118 
132  returnValue hotstart( const real_t* const g_new,
133  const real_t* const lb_new,
135  const real_t* const ub_new,
137  const real_t* const lbA_new,
139  const real_t* const ubA_new,
141  int& nWSR,
143  real_t* const cputime
144  );
145 
146 
149  inline returnValue getA( real_t* const _A
150  ) const;
151 
155  inline returnValue getA( int number,
156  real_t* const row
157  ) const;
158 
161  inline returnValue getLBA( real_t* const _lbA
162  ) const;
163 
167  inline returnValue getLBA( int number,
168  real_t& value
169  ) const;
170 
173  inline returnValue getUBA( real_t* const _ubA
174  ) const;
175 
179  inline returnValue getUBA( int number,
180  real_t& value
181  ) const;
182 
183 
186  inline returnValue getConstraints( Constraints* const _constraints
187  ) const;
188 
189 
192  inline int getNC( ) const;
193 
196  inline int getNEC( ) const;
197 
200  inline int getNAC( );
201 
204  inline int getNIAC( );
205 
208  int getNZ( );
209 
210 
214  returnValue getDualSolution( real_t* const yOpt
215  ) const;
216 
217 
218  /*
219  * PROTECTED MEMBER FUNCTIONS
220  */
221  protected:
226 
231 
236 
237 
249  returnValue solveInitialQP( const real_t* const xOpt,
251  const real_t* const yOpt,
253  const Bounds* const guessedBounds,
255  const Constraints* const guessedConstraints,
257  int& nWSR,
259  real_t* const cputime
260  );
261 
270  const real_t* const yOpt,
272  const Bounds* const guessedBounds,
273  const Constraints* const guessedConstraints,
274  Bounds* auxiliaryBounds,
276  Constraints* auxiliaryConstraints
278  ) const;
279 
288  returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds,
289  const Constraints* const auxiliaryConstraints,
290  BooleanType setupAfresh
292  );
293 
298  const real_t* const yOpt
300  );
301 
307 
313  returnValue setupAuxiliaryQPbounds( const Bounds* const auxiliaryBounds,
314  const Constraints* const auxiliaryConstraints,
315  BooleanType useRelaxation
316  );
317 
318 
324  returnValue addConstraint( int number,
325  SubjectToStatus C_status,
326  BooleanType updateCholesky
327  );
328 
335  );
336 
345  returnValue addConstraint_ensureLI( int number,
346  SubjectToStatus C_status
347  );
348 
354  returnValue addBound( int number,
355  SubjectToStatus B_status,
356  BooleanType updateCholesky
357  );
358 
363  returnValue addBound_checkLI( int number
364  );
365 
374  returnValue addBound_ensureLI( int number,
375  SubjectToStatus B_status
376  );
377 
383  returnValue removeConstraint( int number,
384  BooleanType updateCholesky
385  );
386 
392  returnValue removeBound( int number,
393  BooleanType updateCholesky
394  );
395 
396 
400  returnValue backsolveR( const real_t* const b,
401  BooleanType transposed,
402  real_t* const a
403  );
404 
409  returnValue backsolveR( const real_t* const b,
410  BooleanType transposed,
411  BooleanType removingBound,
412  real_t* const a
413  );
414 
415 
419  returnValue backsolveT( const real_t* const b,
420  BooleanType transposed,
421  real_t* const a
422  );
423 
424 
428  const int* const AC_idx,
429  const real_t* const g_new,
430  const real_t* const lbA_new,
431  const real_t* const ubA_new,
432  const real_t* const lb_new,
433  const real_t* const ub_new,
434  real_t* const delta_g,
435  real_t* const delta_lbA,
436  real_t* const delta_ubA,
437  real_t* const delta_lb,
438  real_t* const delta_ub,
439  BooleanType& Delta_bC_isZero,
440  BooleanType& Delta_bB_isZero
441  );
442 
448  const int* const FX_idx,
449  const int* const AC_idx,
450  const real_t* const delta_g,
451  const real_t* const delta_lbA,
452  const real_t* const delta_ubA,
453  const real_t* const delta_lb,
454  const real_t* const delta_ub,
455  BooleanType Delta_bC_isZero,
456  BooleanType Delta_bB_isZero,
457  real_t* const delta_xFX,
458  real_t* const delta_xFR,
459  real_t* const delta_yAC,
460  real_t* const delta_yFX
461  );
462 
466  const int* const FX_idx,
467  const int* const AC_idx,
468  const int* const IAC_idx,
469  const real_t* const delta_lbA,
470  const real_t* const delta_ubA,
471  const real_t* const delta_lb,
472  const real_t* const delta_ub,
473  const real_t* const delta_xFX,
474  const real_t* const delta_xFR,
475  const real_t* const delta_yAC,
476  const real_t* const delta_yFX,
477  real_t* const delta_Ax,
478  int& BC_idx,
479  SubjectToStatus& BC_status,
480  BooleanType& BC_isBound
481  );
482 
489  returnValue hotstart_performStep( const int* const FR_idx,
490  const int* const FX_idx,
491  const int* const AC_idx,
492  const int* const IAC_idx,
493  const real_t* const delta_g,
494  const real_t* const delta_lbA,
495  const real_t* const delta_ubA,
496  const real_t* const delta_lb,
497  const real_t* const delta_ub,
498  const real_t* const delta_xFX,
499  const real_t* const delta_xFR,
500  const real_t* const delta_yAC,
501  const real_t* const delta_yFX,
502  const real_t* const delta_Ax,
503  int BC_idx,
504  SubjectToStatus BC_status,
505  BooleanType BC_isBound
506  );
507 
508 
513  BooleanType areBoundsConsistent( const real_t* const delta_lb,
514  const real_t* const delta_ub,
515  const real_t* const delta_lbA,
516  const real_t* const delta_ubA
517  ) const;
518 
519 
523  returnValue setupQPdata( const real_t* const _H,
524  const real_t* const _g,
525  const real_t* const _A,
526  const real_t* const _lb,
528  const real_t* const _ub,
530  const real_t* const _lbA,
532  const real_t* const _ubA
534  );
535 
536 
537  #ifdef PC_DEBUG /* Define print functions only for debugging! */
538 
541  returnValue printIteration( int iteration,
542  int BC_idx,
543  SubjectToStatus BC_status,
544  BooleanType BC_isBound
545  );
546 
550  returnValue printIteration( int iteration,
551  int BC_idx,
552  SubjectToStatus BC_status
553  );
554 
555  #endif /* PC_DEBUG */
556 
557 
564 
565 
569  inline returnValue setA( const real_t* const A_new
570  );
571 
576  inline returnValue setA( int number,
577  const real_t* const value
578  );
579 
580 
583  inline returnValue setLBA( const real_t* const lbA_new
584  );
585 
589  inline returnValue setLBA( int number,
590  real_t value
591  );
592 
595  inline returnValue setUBA( const real_t* const ubA_new
596  );
597 
601  inline returnValue setUBA( int number,
602  real_t value
603  );
604 
605 
606  /*
607  * PROTECTED MEMBER VARIABLES
608  */
609  protected:
618  int sizeT;
623 };
624 
625 
626 #include <QProblem.ipp>
627 
628 #endif /* QPOASES_QPROBLEM_HPP */
629 
630 
631 /*
632  * end of file
633  */
BooleanType areBoundsConsistent(const real_t *const delta_lb, const real_t *const delta_ub, const real_t *const delta_lbA, const real_t *const delta_ubA) const
returnValue addConstraint_ensureLI(int number, SubjectToStatus C_status)
returnValue addBound_ensureLI(int number, SubjectToStatus B_status)
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
returnValue hotstart_determineStepDirection(const int *const FR_idx, const int *const FX_idx, const int *const AC_idx, const real_t *const delta_g, const real_t *const delta_lbA, const real_t *const delta_ubA, const real_t *const delta_lb, const real_t *const delta_ub, BooleanType Delta_bC_isZero, BooleanType Delta_bB_isZero, real_t *const delta_xFX, real_t *const delta_xFR, real_t *const delta_yAC, real_t *const delta_yFX)
returnValue removeConstraint(int number, BooleanType updateCholesky)
returnValue hotstart_determineDataShift(const int *const FX_idx, const int *const AC_idx, const real_t *const g_new, const real_t *const lbA_new, const real_t *const ubA_new, const real_t *const lb_new, const real_t *const ub_new, real_t *const delta_g, real_t *const delta_lbA, real_t *const delta_ubA, real_t *const delta_lb, real_t *const delta_ub, BooleanType &Delta_bC_isZero, BooleanType &Delta_bB_isZero)
Implements the online active set strategy for box-constrained QPs.
returnValue setupAuxiliaryQPsolution(const real_t *const xOpt, const real_t *const yOpt)
returnValue hotstart_determineStepLength(const int *const FR_idx, const int *const FX_idx, const int *const AC_idx, const int *const IAC_idx, const real_t *const delta_lbA, const real_t *const delta_ubA, 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_yAC, const real_t *const delta_yFX, real_t *const delta_Ax, int &BC_idx, SubjectToStatus &BC_status, BooleanType &BC_isBound)
Allows to pass back messages to the calling function.
returnValue setLBA(const real_t *const lbA_new)
returnValue hotstart(const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new, int &nWSR, real_t *const cputime)
returnValue obtainAuxiliaryWorkingSet(const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, const Constraints *const guessedConstraints, Bounds *auxiliaryBounds, Constraints *auxiliaryConstraints) const
returnValue solveInitialQP(const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, const Constraints *const guessedConstraints, int &nWSR, real_t *const cputime)
int getNAC()
returnValue setupQPdata(const real_t *const _H, const real_t *const _g, const real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA)
returnValue backsolveT(const real_t *const b, BooleanType transposed, real_t *const a)
returnValue getUBA(real_t *const _ubA) const
returnValue hotstart_performStep(const int *const FR_idx, const int *const FX_idx, const int *const AC_idx, const int *const IAC_idx, const real_t *const delta_g, const real_t *const delta_lbA, const real_t *const delta_ubA, 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_yAC, const real_t *const delta_yFX, const real_t *const delta_Ax, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound)
returnValue setupAuxiliaryQPbounds(const Bounds *const auxiliaryBounds, const Constraints *const auxiliaryConstraints, BooleanType useRelaxation)
returnValue getConstraints(Constraints *const _constraints) const
int getNEC() const
void rhs(const real_t *x, real_t *f)
int getNC() const
returnValue addBound(int number, SubjectToStatus B_status, BooleanType updateCholesky)
returnValue getA(real_t *const _A) const
returnValue removeBound(int number, BooleanType updateCholesky)
RowXpr row(Index i)
Definition: BlockMethods.h:725
Manages working sets of bounds (= box constraints).
returnValue backsolveR(const real_t *const b, BooleanType transposed, real_t *const a)
returnValue printIteration(int iteration, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound)
double real_t
Definition: AD_test.c:10
Implements the online active set strategy for QPs with general constraints.
returnValue setupAuxiliaryWorkingSet(const Bounds *const auxiliaryBounds, const Constraints *const auxiliaryConstraints, BooleanType setupAfresh)
returnValue getLBA(real_t *const _lbA) const
returnValue setA(const real_t *const A_new)
returnValue setUBA(const real_t *const ubA_new)
int getNIAC()
returnValue addConstraint(int number, SubjectToStatus C_status, BooleanType updateCholesky)


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