external_packages/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 init( const real_t* const _H,
133  const real_t* const _R,
134  const real_t* const _g,
135  const real_t* const _A,
136  const real_t* const _lb,
138  const real_t* const _ub,
140  const real_t* const _lbA,
142  const real_t* const _ubA,
144  int& nWSR,
146  const real_t* const yOpt = 0,
147  real_t* const cputime = 0
148  );
149 
150 
164  returnValue hotstart( const real_t* const g_new,
165  const real_t* const lb_new,
167  const real_t* const ub_new,
169  const real_t* const lbA_new,
171  const real_t* const ubA_new,
173  int& nWSR,
175  real_t* const cputime
176  );
177 
178 
181  inline returnValue getA( real_t* const _A
182  ) const;
183 
187  inline returnValue getA( int number,
188  real_t* const row
189  ) const;
190 
193  inline returnValue getLBA( real_t* const _lbA
194  ) const;
195 
199  inline returnValue getLBA( int number,
200  real_t& value
201  ) const;
202 
205  inline returnValue getUBA( real_t* const _ubA
206  ) const;
207 
211  inline returnValue getUBA( int number,
212  real_t& value
213  ) const;
214 
215 
218  inline returnValue getConstraints( Constraints* const _constraints
219  ) const;
220 
221 
224  inline int getNC( ) const;
225 
228  inline int getNEC( ) const;
229 
232  inline int getNAC( );
233 
236  inline int getNIAC( );
237 
240  int getNZ( );
241 
242 
246  returnValue getDualSolution( real_t* const yOpt
247  ) const;
248 
249 
250  /*
251  * PROTECTED MEMBER FUNCTIONS
252  */
253  protected:
258 
263 
268 
269 
281  returnValue solveInitialQP( const real_t* const xOpt,
283  const real_t* const yOpt,
285  const Bounds* const guessedBounds,
287  const Constraints* const guessedConstraints,
289  int& nWSR,
291  real_t* const cputime
292  );
293 
302  const real_t* const yOpt,
304  const Bounds* const guessedBounds,
305  const Constraints* const guessedConstraints,
306  Bounds* auxiliaryBounds,
308  Constraints* auxiliaryConstraints
310  ) const;
311 
320  returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds,
321  const Constraints* const auxiliaryConstraints,
322  BooleanType setupAfresh
324  );
325 
330  const real_t* const yOpt
332  );
333 
339 
345  returnValue setupAuxiliaryQPbounds( const Bounds* const auxiliaryBounds,
346  const Constraints* const auxiliaryConstraints,
347  BooleanType useRelaxation
348  );
349 
350 
356  returnValue addConstraint( int number,
357  SubjectToStatus C_status,
358  BooleanType updateCholesky
359  );
360 
367  );
368 
377  returnValue addConstraint_ensureLI( int number,
378  SubjectToStatus C_status
379  );
380 
386  returnValue addBound( int number,
387  SubjectToStatus B_status,
388  BooleanType updateCholesky
389  );
390 
395  returnValue addBound_checkLI( int number
396  );
397 
406  returnValue addBound_ensureLI( int number,
407  SubjectToStatus B_status
408  );
409 
415  returnValue removeConstraint( int number,
416  BooleanType updateCholesky
417  );
418 
424  returnValue removeBound( int number,
425  BooleanType updateCholesky
426  );
427 
428 
432  returnValue backsolveR( const real_t* const b,
433  BooleanType transposed,
434  real_t* const a
435  );
436 
441  returnValue backsolveR( const real_t* const b,
442  BooleanType transposed,
443  BooleanType removingBound,
444  real_t* const a
445  );
446 
447 
451  returnValue backsolveT( const real_t* const b,
452  BooleanType transposed,
453  real_t* const a
454  );
455 
456 
460  const int* const AC_idx,
461  const real_t* const g_new,
462  const real_t* const lbA_new,
463  const real_t* const ubA_new,
464  const real_t* const lb_new,
465  const real_t* const ub_new,
466  real_t* const delta_g,
467  real_t* const delta_lbA,
468  real_t* const delta_ubA,
469  real_t* const delta_lb,
470  real_t* const delta_ub,
471  BooleanType& Delta_bC_isZero,
472  BooleanType& Delta_bB_isZero
473  );
474 
480  const int* const FX_idx,
481  const int* const AC_idx,
482  const real_t* const delta_g,
483  const real_t* const delta_lbA,
484  const real_t* const delta_ubA,
485  const real_t* const delta_lb,
486  const real_t* const delta_ub,
487  BooleanType Delta_bC_isZero,
488  BooleanType Delta_bB_isZero,
489  real_t* const delta_xFX,
490  real_t* const delta_xFR,
491  real_t* const delta_yAC,
492  real_t* const delta_yFX
493  );
494 
498  const int* const FX_idx,
499  const int* const AC_idx,
500  const int* const IAC_idx,
501  const real_t* const delta_lbA,
502  const real_t* const delta_ubA,
503  const real_t* const delta_lb,
504  const real_t* const delta_ub,
505  const real_t* const delta_xFX,
506  const real_t* const delta_xFR,
507  const real_t* const delta_yAC,
508  const real_t* const delta_yFX,
509  real_t* const delta_Ax,
510  int& BC_idx,
511  SubjectToStatus& BC_status,
512  BooleanType& BC_isBound
513  );
514 
521  returnValue hotstart_performStep( const int* const FR_idx,
522  const int* const FX_idx,
523  const int* const AC_idx,
524  const int* const IAC_idx,
525  const real_t* const delta_g,
526  const real_t* const delta_lbA,
527  const real_t* const delta_ubA,
528  const real_t* const delta_lb,
529  const real_t* const delta_ub,
530  const real_t* const delta_xFX,
531  const real_t* const delta_xFR,
532  const real_t* const delta_yAC,
533  const real_t* const delta_yFX,
534  const real_t* const delta_Ax,
535  int BC_idx,
536  SubjectToStatus BC_status,
537  BooleanType BC_isBound
538  );
539 
540 
545  BooleanType areBoundsConsistent( const real_t* const delta_lb,
546  const real_t* const delta_ub,
547  const real_t* const delta_lbA,
548  const real_t* const delta_ubA
549  ) const;
550 
551 
555  returnValue setupQPdata( const real_t* const _H,
556  const real_t* const _R,
557  const real_t* const _g,
558  const real_t* const _A,
559  const real_t* const _lb,
561  const real_t* const _ub,
563  const real_t* const _lbA,
565  const real_t* const _ubA
567  );
568 
569 
570  #ifdef PC_DEBUG /* Define print functions only for debugging! */
571 
574  returnValue printIteration( int iteration,
575  int BC_idx,
576  SubjectToStatus BC_status,
577  BooleanType BC_isBound
578  );
579 
583  returnValue printIteration( int iteration,
584  int BC_idx,
585  SubjectToStatus BC_status
586  );
587 
588  #endif /* PC_DEBUG */
589 
590 
597 
598 
602  inline returnValue setA( const real_t* const A_new
603  );
604 
609  inline returnValue setA( int number,
610  const real_t* const value
611  );
612 
613 
616  inline returnValue setLBA( const real_t* const lbA_new
617  );
618 
622  inline returnValue setLBA( int number,
623  real_t value
624  );
625 
628  inline returnValue setUBA( const real_t* const ubA_new
629  );
630 
634  inline returnValue setUBA( int number,
635  real_t value
636  );
637 
638 
639  /*
640  * PROTECTED MEMBER VARIABLES
641  */
642  protected:
649  real_t T[NVMAX*NVMAX];
650  real_t Q[NVMAX*NVMAX];
651  int sizeT;
656 };
657 
658 
659 #include <QProblem.ipp>
660 
661 #endif /* QPOASES_QPROBLEM_HPP */
662 
663 
664 /*
665  * end of file
666  */
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