Abstract base class for all kinds of Runge-Kutta schemes for integrating ODEs. More...
#include <integrator_runge_kutta.hpp>
Protected Member Functions | |
void | allocateMemory () |
void | constructAll (const IntegratorRK &arg) |
void | deleteAll () |
double | determineEta45 () |
double | determineEta45 (int number) |
void | determineEtaGForward (int number) |
void | determineEtaGForward2 (int number) |
void | determineEtaHBackward (int number) |
void | determineEtaHBackward2 (int number) |
virtual returnValue | evaluate (const DVector &x0, const DVector &xa, const DVector &p, const DVector &u, const DVector &w, const Grid &t_) |
virtual returnValue | evaluateSensitivities () |
virtual int | getDim () const |
virtual returnValue | getProtectedBackwardSensitivities (DVector &Dx_x0, DVector &Dx_p, DVector &Dx_u, DVector &Dx_w, int order) const |
virtual returnValue | getProtectedForwardSensitivities (DMatrix *Dx, int order) const |
virtual returnValue | getProtectedX (DVector *xEnd) const |
virtual void | initializeButcherTableau ()=0 |
void | initializeVariables () |
void | interpolate (int jj, double *e1, double *d1, double *e2, VariablesGrid &poly) |
void | logCurrentIntegratorStep (const DVector ¤tX=emptyConstVector) |
void | printIntermediateResults () |
virtual returnValue | setBackwardSeed2 (const DVector &seed) |
returnValue | setForwardSeed2 (const DVector &xSeed, const DVector &pSeed, const DVector &uSeed, const DVector &wSeed) |
virtual returnValue | setProtectedBackwardSeed (const DVector &seed, const int &order) |
virtual returnValue | setProtectedForwardSeed (const DVector &xSeed, const DVector &pSeed, const DVector &uSeed, const DVector &wSeed, const int &order) |
Protected Member Functions inherited from Integrator | |
virtual returnValue | diffTransitionBackward (DVector &DX, DVector &DP, DVector &DU, DVector &DW, int &order) |
virtual returnValue | diffTransitionForward (DVector &DX, const DVector &DP, const DVector &DU, const DVector &DW, const int &order) |
virtual returnValue | evaluateTransition (const double time, DVector &xd, const DVector &xa, const DVector &p, const DVector &u, const DVector &w) |
virtual int | getDimX () const |
void | initializeOptions () |
virtual returnValue | setupLogging () |
virtual returnValue | setupOptions () |
Abstract base class for all kinds of Runge-Kutta schemes for integrating ODEs.
The class IntegratorRK serves as an abstract base class for all kinds of Runge-Kutta schemes for integrating ordinary differential equations (ODEs).
Definition at line 54 of file integrator_runge_kutta.hpp.
BEGIN_NAMESPACE_ACADO IntegratorRK::IntegratorRK | ( | ) |
Default constructor.
Definition at line 51 of file integrator_runge_kutta.cpp.
IntegratorRK::IntegratorRK | ( | int | dim_, |
double | power_ | ||
) |
Default constructor.
Definition at line 58 of file integrator_runge_kutta.cpp.
IntegratorRK::IntegratorRK | ( | const DifferentialEquation & | rhs_, |
int | dim_, | ||
double | power_ | ||
) |
Default constructor.
Definition at line 80 of file integrator_runge_kutta.cpp.
IntegratorRK::IntegratorRK | ( | const IntegratorRK & | arg | ) |
Copy constructor (deep copy).
Definition at line 103 of file integrator_runge_kutta.cpp.
|
virtual |
Destructor.
Definition at line 110 of file integrator_runge_kutta.cpp.
|
protected |
This routine is protected and sets up all
variables (i.e. allocates memory etc.).
Note that this routine assumes that the
dimensions are already set correctly and is
thus for internal use only.
Definition at line 151 of file integrator_runge_kutta.cpp.
|
pure virtual |
The (virtual) copy constructor
Implements Integrator.
Implemented in IntegratorDiscretizedODE, IntegratorRK23, IntegratorRK45, IntegratorRK78, and IntegratorRK12.
|
protected |
Implementation of the copy constructor.
Definition at line 407 of file integrator_runge_kutta.cpp.
|
protected |
Implementation of the delete operator.
Definition at line 291 of file integrator_runge_kutta.cpp.
|
protected |
computes eta4 and eta5 (only for internal use)
Definition at line 1625 of file integrator_runge_kutta.cpp.
|
protected |
computes eta4 and eta5 (only for internal use)
Definition at line 1689 of file integrator_runge_kutta.cpp.
|
protected |
computes etaG in forward direction (only for internal use)
Definition at line 1748 of file integrator_runge_kutta.cpp.
|
protected |
computes etaG and etaG2 in forward direction
(only for internal use)
Definition at line 1779 of file integrator_runge_kutta.cpp.
|
protected |
computes etaH in backward direction (only for internal use)
Definition at line 1817 of file integrator_runge_kutta.cpp.
|
protected |
computes etaH2 in backward direction (only for internal use)
Definition at line 1851 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Starts integration: cf. integrate(...) for
more details.
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
t_ | the time interval |
Implements Integrator.
Definition at line 645 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
< Integrates forward and/or backward depending on the specified seeds.
Implements Integrator.
Definition at line 1075 of file integrator_runge_kutta.cpp.
|
virtual |
Freezes the mesh as well as all intermediate values. This function
is necessary for the case that automatic differentiation in backward
mode should is used. (Note: This function might for large right hand
sides lead to memory problems as all intemediate values will be
stored!)
Implements Integrator.
Definition at line 621 of file integrator_runge_kutta.cpp.
|
virtual |
Freezes the mesh: Storage of the step sizes. If the integrator is
freezed the mesh will be stored when calling the function integrate
for the first time. If the function integrate is called more than
once the same mesh will be reused (i.e. the step size control will
be turned off). Note that the mesh should be frozen if any kind of
sensitivity generation is used.
Implements Integrator.
Definition at line 605 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Returns the dimension of the Differential Equation
Implements Integrator.
Definition at line 2059 of file integrator_runge_kutta.cpp.
|
virtual |
Returns the number of rejected Steps.
Implements Integrator.
Definition at line 1603 of file integrator_runge_kutta.cpp.
|
virtual |
Returns the number of accepted Steps.
Implements Integrator.
Definition at line 1598 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Returns the result for the backward sensitivities at the time tend.
Dx_x0 | backward sensitivities w.r.t. the initial states |
Dx_p | backward sensitivities w.r.t. the parameters |
Dx_u | backward sensitivities w.r.t. the controls |
Dx_w | backward sensitivities w.r.t. the disturbance |
order | the order of the derivative |
Implements Integrator.
Definition at line 1509 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Returns the result for the forward sensitivities at the time tend.
Dx | the result for the forward sensitivi- ties |
order | the order |
Implements Integrator.
Definition at line 1475 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Returns the result for the state at the time tend.
xEnd | the result for the states at the time tend. |
Implements Integrator.
Definition at line 1461 of file integrator_runge_kutta.cpp.
|
virtual |
Returns the current step size
Implements Integrator.
Definition at line 1609 of file integrator_runge_kutta.cpp.
|
virtual |
The initialization routine which takes the right-hand side of
the differential equation to be integrated.
rhs | the right-hand side of the ODE/DAE. |
Implements Integrator.
Reimplemented in IntegratorDiscretizedODE, and IntegratorRK12.
Definition at line 116 of file integrator_runge_kutta.cpp.
|
inline |
The initialization routine which takes the right-hand side of
the differential equation to be integrated. In addition a
transition function can be set which is evaluated at the end
of the integration interval.
rhs | the right-hand side of the ODE/DAE. |
trs | the transition to be evaluated at the end. |
|
protectedpure virtual |
This routine initializes the coefficients of the Butcher Tableau.
Implemented in IntegratorRK12, IntegratorRK23, IntegratorRK45, and IntegratorRK78.
|
protected |
This routine is protected and is basically used
to set all pointer-valued member to the NULL pointer.
In addition some dimensions are initialized with 0 as
a default value.
Definition at line 134 of file integrator_runge_kutta.cpp.
|
protected |
Definition at line 2042 of file integrator_runge_kutta.cpp.
|
protected |
|
virtual |
Assignment operator (deep copy).
Definition at line 395 of file integrator_runge_kutta.cpp.
|
protected |
prints intermediate results for the case that the PrintLevel is
HIGH.
Definition at line 1891 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Initializes a second backward seed. (only for internal use)
seed | the seed matrix |
Definition at line 1029 of file integrator_runge_kutta.cpp.
|
virtual |
Sets an initial guess for the differential state derivatives
(consistency condition)
dx0 | initial guess for the differential state derivatives |
Implements Integrator.
Definition at line 1615 of file integrator_runge_kutta.cpp.
|
protected |
Initializes a second forward seed. (only for internal use)
xSeed | the seed w.r.t the initial states |
pSeed | the seed w.r.t the parameters |
uSeed | the seed w.r.t the controls |
wSeed | the seed w.r.t the disturbances |
Definition at line 909 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Define a backward seed
seed | the seed matrix |
order | the order of the seed. |
Implements Integrator.
Definition at line 981 of file integrator_runge_kutta.cpp.
|
protectedvirtual |
Define a forward seed.
xSeed | the seed w.r.t the initial states |
pSeed | the seed w.r.t the parameters |
uSeed | the seed w.r.t the controls |
wSeed | the seed w.r.t the disturbances |
order | the order of the seed. |
Implements Integrator.
Definition at line 835 of file integrator_runge_kutta.cpp.
|
virtual |
Executes the next single step. This function can be used to
call the integrator step wise. Note that this function is e.g.
useful in real-time simulations where after each step a time
out limit has to be checked. This function will usually return
number | the step number |
Reimplemented in IntegratorDiscretizedODE, and IntegratorRK12.
Definition at line 1194 of file integrator_runge_kutta.cpp.
|
virtual |
Stops the integration even if the final time has not been
reached yet. This function will also give all memory free.
In particular, the function unfreeze() will be called.
(This function is designed for the usage in real-time
contexts in order to deal with error messages without
deleting and re-initializing the integrator.)
Definition at line 1455 of file integrator_runge_kutta.cpp.
|
virtual |
Unfreezes the mesh: Gives the memory free that has previously
been allocated by "freeze". If you use the function
integrate after unfreezing the usual step size control will be
switched on.
Implements Integrator.
Definition at line 635 of file integrator_runge_kutta.cpp.
|
protected |
the coefficient A of the Butcher Tableau.
Definition at line 436 of file integrator_runge_kutta.hpp.
|
protected |
the 4th order coefficients of the Butcher Tableau.
Definition at line 437 of file integrator_runge_kutta.hpp.
|
protected |
the 5th order coefficients of the Butcher Tableau.
Definition at line 438 of file integrator_runge_kutta.hpp.
|
protected |
The backward seed (only internal use)
Definition at line 460 of file integrator_runge_kutta.hpp.
|
protected |
The backward seed 2 (only internal use)
Definition at line 463 of file integrator_runge_kutta.hpp.
|
protected |
the time coefficients of the Butcher Tableau.
Definition at line 439 of file integrator_runge_kutta.hpp.
|
protected |
the dimension of the Butcher Tableau.
Definition at line 435 of file integrator_runge_kutta.hpp.
|
protected |
root order of the step size control
Definition at line 454 of file integrator_runge_kutta.hpp.
|
protected |
the result of order 4
Definition at line 444 of file integrator_runge_kutta.hpp.
|
protected |
the result of order 4
Definition at line 446 of file integrator_runge_kutta.hpp.
|
protected |
the result of order 5
Definition at line 445 of file integrator_runge_kutta.hpp.
|
protected |
the result of order 5
Definition at line 447 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 466 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 470 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 471 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 474 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 478 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 479 of file integrator_runge_kutta.hpp.
|
protected |
The forward seed (only internal use)
Definition at line 459 of file integrator_runge_kutta.hpp.
|
protected |
The forward seed 2 (only internal use)
Definition at line 462 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 465 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 468 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 469 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 473 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 476 of file integrator_runge_kutta.hpp.
|
protected |
Sensitivity matrix (only internal use)
Definition at line 477 of file integrator_runge_kutta.hpp.
|
protected |
the intermediate results
Definition at line 448 of file integrator_runge_kutta.hpp.
|
protected |
the intermediate results
Definition at line 449 of file integrator_runge_kutta.hpp.
|
protected |
the intermediate results
Definition at line 450 of file integrator_runge_kutta.hpp.
|
protected |
the intermediate results
Definition at line 451 of file integrator_runge_kutta.hpp.
|
protected |
size of the memory that is allocated to store
the trajectory and the mesh.
Definition at line 484 of file integrator_runge_kutta.hpp.
|
protected |
the actual time
Definition at line 452 of file integrator_runge_kutta.hpp.
|
protected |
the actual state (only internal use)
Definition at line 453 of file integrator_runge_kutta.hpp.