integrator_lyapunov.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 
27 
34 #ifndef ACADO_TOOLKIT_INTEGRATOR_LYAPUNOV_HPP
35 #define ACADO_TOOLKIT_INTEGRATOR_LYAPUNOV_HPP
36 
37 
39 
40 
42 
43 
55 
56 //
57 // PUBLIC MEMBER FUNCTIONS:
58 //
59 
60 public:
61 
64 
66  IntegratorLYAPUNOV( int dim_, double power_ );
67 
69  IntegratorLYAPUNOV( const DifferentialEquation &rhs_, int dim_, double power_ );
70 
73 
75  virtual ~IntegratorLYAPUNOV( );
76 
78  virtual IntegratorLYAPUNOV& operator=( const IntegratorLYAPUNOV& arg );
79 
81  virtual Integrator* clone() const = 0;
82 
83 
84 
85  // ================================================================================
86 
87 
96  virtual returnValue init( const DifferentialEquation &rhs_ );
97 
109  inline returnValue init( const DifferentialEquation &rhs_,
110  const Transition &trs_ );
111 
112 
113  // ================================================================================
114 
124  virtual returnValue freezeMesh();
125 
126 
135  virtual returnValue freezeAll();
136 
137 
145  virtual returnValue unfreeze();
146 
147 
148 
149  // ================================================================================
150 
173  virtual returnValue step( int number
174  );
175 
176 
185  virtual returnValue stop();
186 
187 
192  virtual returnValue setDxInitialization( double *dx0 );
196 
197  // ================================================================================
198 
199 
203  virtual int getNumberOfSteps() const;
204 
205 
209  virtual int getNumberOfRejectedSteps() const;
210 
211 
213  virtual double getStepSize() const;
214 
215 
216 //
217 // PROTECTED MEMBER FUNCTIONS:
218 //
219 protected:
220 
221 
222  // ================================================================================
223 
224 
225 
232 
233 
234 
236  virtual int getDim() const;
237 
238 
239 
240  // ================================================================================
241 
242 
246  virtual returnValue evaluate( const DVector &x0 ,
247  const DVector &xa ,
248  const DVector &p ,
249  const DVector &u ,
250  const DVector &w ,
251  const Grid &t_ );
252 
253 
254  // ================================================================================
255 
256 
261  virtual returnValue setProtectedForwardSeed( const DVector &xSeed ,
263  const DVector &pSeed ,
265  const DVector &uSeed ,
267  const DVector &wSeed ,
269  const int &order );
271 
272  // ================================================================================
273 
274 
279  virtual returnValue setProtectedBackwardSeed( const DVector &seed ,
281  const int &order );
283 
284 
285  // ================================================================================
286 
287 
291  virtual returnValue getProtectedX( DVector *xEnd ) const;
294 
295 
303  int order ) const;
304 
305 
306 
319  DVector &Dx_p ,
320  DVector &Dx_u ,
321  DVector &Dx_w ,
322  int order ) const;
323 
324 
325 
326  // ================================================================================
327 
328 
331  void deleteAll();
332 
333 
336  void constructAll( const IntegratorLYAPUNOV& arg );
337 
338 
339 
346  void allocateMemory( );
347 
348 
354  void initializeVariables();
355 
356 
358  virtual void initializeButcherTableau() = 0;
359 
360 
364  double determineEta45();
365 
366 
370  double determineEta45( int number );
371 
372 
375  void determineEtaGForward( int number );
376 
377 
381  void determineEtaGForward2( int number );
382 
383 
386  void determineEtaHBackward( int number );
387 
388 
391  void determineEtaHBackward2( int number );
392 
393 
398 
399 
400 
403  returnValue setForwardSeed2( const DVector &xSeed ,
405  const DVector &pSeed ,
407  const DVector &uSeed ,
409  const DVector &wSeed );
411 
412 
415  virtual returnValue setBackwardSeed2( const DVector &seed );
417 
418 
419 
420  void interpolate( int jj, double *e1, double *d1, double *e2, VariablesGrid &poly );
421 
422 
423  void logCurrentIntegratorStep( const DVector& currentX = emptyConstVector
424  );
425 
426 
427 // DATA MEMBERS:
428 //
429 protected:
430 
431 
432  // BUTCHER-
433  // TABLEAU:
434  // ----------
435  int dim ;
436  double **A ;
437  double *b4 ;
438  double *b5 ;
439  double *c ;
442  // RK-ALGORITHM:
443  // -------------
444  double *eta4 ;
445  double *eta5 ;
446  double *eta4_ ;
447  double *eta5_ ;
448  double **k ;
449  double **k2 ;
450  double **l ;
451  double **l2 ;
452  double t ;
453  double *x ;
454  double err_power ;
457  // SENSITIVITIES:
458  // --------------
465  double *G ;
466  double *etaG ;
468  double *G2 ;
469  double *G3 ;
470  double *etaG2 ;
471  double *etaG3 ;
473  double *H ;
474  double *etaH ;
476  double *H2 ;
477  double *H3 ;
478  double *etaH2 ;
479  double *etaH3 ;
481  // STORAGE:
482  // --------
483  int maxAlloc ;
486  // Original ODE
487  int dimxmy ; /* dimension of the original ODE*/
488  int dimu ; /* dimension of the control*/
489  int dimp ; /* dimension of the parameters*/
490  int dimw ; /* dimension of the disturbances*/
491 
492  // Sensitivities
493  double **Y ; /* sensitivity matrix */
494 
495  double *seedmy ; /* Seed vector */
497 };
498 
499 
501 
502 
503 #include <acado/integrator/integrator_lyapunov.ipp>
504 
505 
506 #endif // ACADO_TOOLKIT_INTEGRATOR_RUNGE_KUTTA_HPP
507 
508 // end of file.
virtual returnValue setProtectedBackwardSeed(const DVector &seed, const int &order)
virtual returnValue unfreeze()
virtual returnValue setDxInitialization(double *dx0)
void constructAll(const IntegratorLYAPUNOV &arg)
virtual void initializeButcherTableau()=0
void determineEtaHBackward2(int number)
void determineEtaGForward2(int number)
virtual returnValue freezeMesh()
virtual returnValue step(int number)
virtual int getNumberOfRejectedSteps() const
virtual returnValue init(const DifferentialEquation &rhs_)
virtual returnValue freezeAll()
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 getProtectedX(DVector *xEnd) const
virtual returnValue setProtectedForwardSeed(const DVector &xSeed, const DVector &pSeed, const DVector &uSeed, const DVector &wSeed, const int &order)
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
virtual IntegratorLYAPUNOV & operator=(const IntegratorLYAPUNOV &arg)
#define CLOSE_NAMESPACE_ACADO
virtual returnValue getProtectedBackwardSensitivities(DVector &Dx_x0, DVector &Dx_p, DVector &Dx_u, DVector &Dx_w, int order) const
virtual double getStepSize() const
Abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs)...
Definition: integrator.hpp:61
void interpolate(int jj, double *e1, double *d1, double *e2, VariablesGrid &poly)
static const DVector emptyConstVector
Definition: vector.hpp:336
void determineEtaHBackward(int number)
virtual Integrator * clone() const =0
void determineEtaGForward(int number)
virtual returnValue setBackwardSeed2(const DVector &seed)
Allows to setup and evaluate transition functions based on SymbolicExpressions.
Definition: transition.hpp:53
void logCurrentIntegratorStep(const DVector &currentX=emptyConstVector)
virtual returnValue evaluate(const DVector &x0, const DVector &xa, const DVector &p, const DVector &u, const DVector &w, const Grid &t_)
virtual int getNumberOfSteps() const
#define BEGIN_NAMESPACE_ACADO
virtual returnValue stop()
virtual returnValue evaluateSensitivities()
Implements a parameter.
Definition: lyapunov.hpp:54
virtual returnValue getProtectedForwardSensitivities(DMatrix *Dx, int order) const
virtual int getDim() const
returnValue setForwardSeed2(const DVector &xSeed, const DVector &pSeed, const DVector &uSeed, const DVector &wSeed)
Base class for all kinds of Runge-Kutta schemes for integrating ODEs.
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.


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