scp_method.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
34 #ifndef ACADO_TOOLKIT_SCP_METHOD_HPP
35 #define ACADO_TOOLKIT_SCP_METHOD_HPP
36 
37 
39 
41 
46 
51 
52 
53 
55 
56 
67 class SCPmethod : public NLPsolver
68 {
69 
70  //
71  // PUBLIC MEMBER FUNCTIONS:
72  //
73  public:
74 
76  SCPmethod( );
77 
79  SCPmethod( UserInteraction* _userInteraction,
80  const Objective *objective_ ,
81  const DynamicDiscretization *dynamic_discretization_,
82  const Constraint *constraint_,
83  BooleanType _isCP = BT_FALSE
84  );
85 
87  SCPmethod( const SCPmethod& rhs );
88 
90  virtual ~SCPmethod( );
91 
93  SCPmethod& operator=( const SCPmethod& rhs );
94 
95  virtual NLPsolver* clone() const;
96 
97 
99  virtual returnValue init( VariablesGrid* x_init ,
100  VariablesGrid* xa_init,
101  VariablesGrid* p_init ,
102  VariablesGrid* u_init ,
103  VariablesGrid* w_init );
104 
105 
107  virtual returnValue solve( const DVector &x0_ = emptyConstVector,
108  const DVector &p_ = emptyConstVector
109  );
110 
112  virtual returnValue step( const DVector &x0_ = emptyConstVector,
113  const DVector &p_ = emptyConstVector
114  );
115 
117  virtual returnValue feedbackStep( const DVector &x0_,
118  const DVector &p_ = emptyConstVector
119  );
120 
121  virtual returnValue performCurrentStep( );
122 
123 
125  virtual returnValue prepareNextStep( );
126 
127 
136  virtual returnValue setReference( const VariablesGrid &ref
137  );
138 
139 // virtual returnValue enableNeedToReevaluate( );
140 
141 
146  virtual returnValue shiftVariables( double timeShift = -1.0,
147  DVector lastX = emptyVector,
148  DVector lastXA = emptyVector,
149  DVector lastP = emptyVector,
150  DVector lastU = emptyVector,
151  DVector lastW = emptyVector );
152 
153 
159  virtual returnValue getVarianceCovariance( DMatrix &var );
160 
161 
166  virtual returnValue printRuntimeProfile() const;
167 
168 
169 
170  //
171  // PROTECTED MEMBER FUNCTIONS:
172  //
173  protected:
174 
175  virtual returnValue setupLogging( );
176 
177 
178  returnValue setup( );
179 
180 
183  returnValue printIterate( ) const;
184 
186 
188 
189 
190  returnValue computeHessianMatrix( const BlockMatrix& oldLagrangeGradient,
191  const BlockMatrix& newLagrangeGradient
192  );
193 
194 
196 
197 
199  const DVector &p_
200  );
201 
203  const DVector &p_ = emptyConstVector
204  );
205 
206 
208 
209 
210  virtual returnValue getDifferentialStates( VariablesGrid &xd_ ) const;
211  virtual returnValue getAlgebraicStates ( VariablesGrid &xa_ ) const;
212  virtual returnValue getParameters ( VariablesGrid &p_ ) const;
213  virtual returnValue getParameters ( DVector &p_ ) const;
214  virtual returnValue getControls ( VariablesGrid &u_ ) const;
215  virtual returnValue getFirstControl ( DVector &u0_ ) const;
216  virtual returnValue getDisturbances ( VariablesGrid &w_ ) const;
217  virtual double getObjectiveValue ( ) const;
218 
219 
221  ) const;
222 
224  ) const;
225 
227  ) const;
228 
230  ) const;
231 
233  ) const;
234 
236  uint idx
237  ) const;
238 
239 
240  inline uint getNumPoints( ) const;
241 
242  inline uint getNX( ) const;
243  inline uint getNXA( ) const;
244  inline uint getNP( ) const;
245  inline uint getNU( ) const;
246  inline uint getNW( ) const;
247 
248  inline uint getNC( ) const;
249 
250 
251  //
252  // DATA MEMBERS:
253  //
254  protected:
255 
259 
262 
266 
269 
272 
276 };
277 
278 
280 
281 
282 
283 #include <acado/nlp_solver/scp_method.ipp>
284 
285 
286 #endif // ACADO_TOOLKIT_SCP_METHOD_HPP
287 
288 /*
289  * end of file
290  */
RealClock clockTotalTime
Definition: scp_method.hpp:258
BooleanType isCP
Definition: scp_method.hpp:271
virtual returnValue getDisturbances(VariablesGrid &w_) const
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
Implements a very rudimentary block sparse matrix class.
uint getNX() const
SCPstep * scpStep
Definition: scp_method.hpp:264
Allows real time measurements based on the system&#39;s clock.
Definition: real_clock.hpp:53
uint getNU() const
returnValue setup()
Definition: scp_method.cpp:667
BlockStatus
virtual returnValue setupLogging()
Definition: scp_method.cpp:634
returnValue checkForConvergence()
Definition: scp_method.cpp:885
BlockStatus status
Definition: scp_method.hpp:270
Stores and evaluates the constraints of optimal control problems.
Definition: constraint.hpp:60
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
virtual returnValue getParameters(VariablesGrid &p_) const
virtual ~SCPmethod()
Definition: scp_method.cpp:124
virtual returnValue getFirstControl(DVector &u0_) const
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
Base class for different ways to perform a step of an SCPmethod for solving NLPs. ...
Definition: scp_step.hpp:62
BandedCP bandedCP
Definition: scp_method.hpp:267
Base class for algorithms solving banded conic programs arising in optimal control.
returnValue stopClockAndPrintRuntimeProfile()
Definition: scp_method.cpp:995
returnValue printIterate() const
Definition: scp_method.cpp:828
#define CLOSE_NAMESPACE_ACADO
returnValue printIteration()
Definition: scp_method.cpp:834
virtual returnValue getSensitivitiesXA(BlockMatrix &_sens) const
returnValue initializeHessianProjection()
Definition: scp_method.cpp:945
Base class for discretizing a DifferentialEquation for use in optimal control algorithms.
virtual returnValue getSensitivitiesP(BlockMatrix &_sens) const
virtual returnValue getSensitivitiesX(BlockMatrix &_sens) const
virtual returnValue prepareNextStep()
Definition: scp_method.cpp:456
int timeLoggingIdx
Definition: scp_method.hpp:256
virtual double getObjectiveValue() const
uint getNC() const
returnValue setupRealTimeParameters(const DVector &x0_=emptyConstVector, const DVector &p_=emptyConstVector)
Definition: scp_method.cpp:978
returnValue computeHessianMatrix(const BlockMatrix &oldLagrangeGradient, const BlockMatrix &newLagrangeGradient)
Definition: scp_method.cpp:923
virtual returnValue getVarianceCovariance(DMatrix &var)
Definition: scp_method.cpp:611
static const DVector emptyConstVector
Definition: vector.hpp:336
uint getNumPoints() const
virtual returnValue getSensitivitiesW(BlockMatrix &_sens) const
virtual returnValue step(const DVector &x0_=emptyConstVector, const DVector &p_=emptyConstVector)
Definition: scp_method.cpp:295
BandedCPsolver * bandedCPsolver
Definition: scp_method.hpp:268
uint getNP() const
SCPmethod & operator=(const SCPmethod &rhs)
Definition: scp_method.cpp:140
returnValue checkForRealTimeMode(const DVector &x0_, const DVector &p_)
Definition: scp_method.cpp:962
BooleanType isInRealTimeMode
Definition: scp_method.hpp:274
NLPderivativeApproximation * derivativeApproximation
Definition: scp_method.hpp:265
Encapsulates all user interaction for setting options, logging data and plotting results.
virtual returnValue getDifferentialStates(VariablesGrid &xd_) const
virtual returnValue performCurrentStep()
Definition: scp_method.cpp:384
void rhs(const real_t *x, real_t *f)
Implements different sequential convex programming methods for solving NLPs.
Definition: scp_method.hpp:67
Base class for different algorithms for solving nonlinear programming (NLP) problems.
Definition: nlp_solver.hpp:59
virtual returnValue getSensitivitiesU(BlockMatrix &_sens) const
uint getNXA() const
virtual returnValue getControls(VariablesGrid &u_) const
RealClock clock
Definition: scp_method.hpp:257
virtual NLPsolver * clone() const
Definition: scp_method.cpp:191
virtual returnValue init(VariablesGrid *x_init, VariablesGrid *xa_init, VariablesGrid *p_init, VariablesGrid *u_init, VariablesGrid *w_init)
Definition: scp_method.cpp:198
virtual returnValue printRuntimeProfile() const
Definition: scp_method.cpp:623
uint getNW() const
virtual returnValue feedbackStep(const DVector &x0_, const DVector &p_=emptyConstVector)
Definition: scp_method.cpp:317
virtual returnValue getAnySensitivities(BlockMatrix &_sens, uint idx) const
OCPiterate oldIter
Definition: scp_method.hpp:261
Base class for different ways to evaluate functions and derivatives within an SCPmethod for solving N...
static DVector emptyVector
Definition: vector.hpp:335
#define BEGIN_NAMESPACE_ACADO
#define BT_FALSE
Definition: acado_types.hpp:49
virtual returnValue setReference(const VariablesGrid &ref)
Definition: scp_method.cpp:567
SCPevaluation * eval
Definition: scp_method.hpp:263
BooleanType needToReevaluate
Definition: scp_method.hpp:275
virtual returnValue getAlgebraicStates(VariablesGrid &xa_) const
virtual returnValue shiftVariables(double timeShift=-1.0, DVector lastX=emptyVector, DVector lastXA=emptyVector, DVector lastP=emptyVector, DVector lastU=emptyVector, DVector lastW=emptyVector)
Definition: scp_method.cpp:582
virtual returnValue solve(const DVector &x0_=emptyConstVector, const DVector &p_=emptyConstVector)
Definition: scp_method.cpp:260
OCPiterate iter
Definition: scp_method.hpp:260
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123
Base class for techniques of approximating second-order derivatives within NLPsolvers.
BooleanType hasPerformedStep
Definition: scp_method.hpp:273
Data class for storing conic programs arising from optimal control.
Definition: banded_cp.hpp:56


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