Abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs). More...
#include <integrator.hpp>
Protected Member Functions | |
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 | evaluate (const DVector &x0, const DVector &xa, const DVector &p, const DVector &u, const DVector &w, const Grid &t_)=0 |
virtual returnValue | evaluateTransition (const double time, DVector &xd, const DVector &xa, const DVector &p, const DVector &u, const DVector &w) |
virtual int | getDim () const =0 |
virtual int | getDimX () const |
virtual returnValue | getProtectedBackwardSensitivities (DVector &Dx_x0, DVector &Dx_p, DVector &Dx_u, DVector &Dx_w, int order) const =0 |
virtual returnValue | getProtectedForwardSensitivities (DMatrix *Dx, int order) const =0 |
virtual returnValue | getProtectedX (DVector *xEnd) const =0 |
void | initializeOptions () |
virtual returnValue | setProtectedBackwardSeed (const DVector &seed, const int &order)=0 |
virtual returnValue | setProtectedForwardSeed (const DVector &xSeed, const DVector &pSeed, const DVector &uSeed, const DVector &wSeed, const int &order)=0 |
virtual returnValue | setupLogging () |
virtual returnValue | setupOptions () |
Friends | |
class | ShootingMethod |
class | SimulationByIntegration |
Abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs).
The class Integrator serves as an abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs).
Definition at line 61 of file integrator.hpp.
BEGIN_NAMESPACE_ACADO Integrator::Integrator | ( | ) |
Default constructor.
Definition at line 56 of file integrator.cpp.
Integrator::Integrator | ( | const Integrator & | arg | ) |
Copy constructor.
Definition at line 131 of file integrator.cpp.
|
virtual |
Default destructor.
Definition at line 139 of file integrator.cpp.
|
virtual |
Returns if integrator is able to handle implicit switches.
Definition at line 459 of file integrator.cpp.
|
pure virtual |
The (virtual) copy constructor
Implemented in IntegratorDiscretizedODE, IntegratorBDF, IntegratorLYAPUNOV, IntegratorRK, IntegratorLYAPUNOV45, IntegratorRK23, IntegratorRK45, IntegratorRK78, and IntegratorRK12.
|
virtual |
Deletes all seeds that have been set with the methods above.
This function will also give the corresponding memory free.
Definition at line 488 of file integrator.cpp.
|
protectedvirtual |
Definition at line 542 of file integrator.cpp.
|
protectedvirtual |
Definition at line 521 of file integrator.cpp.
|
protectedpure virtual |
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 |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
|
pure virtual |
Implemented in IntegratorRK, IntegratorBDF, and IntegratorLYAPUNOV.
|
protectedvirtual |
Evaluates the transtion (protected, only for internal use).
time | the time |
xd | the state |
xa | the algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 505 of file integrator.cpp.
|
pure 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!)
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
|
pure 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.
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
returnValue Integrator::getBackwardSensitivities | ( | DVector & | Dx_x0, |
DVector & | Dx_p, | ||
DVector & | Dx_u, | ||
DVector & | Dx_w, | ||
int | order | ||
) | const |
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 |
Definition at line 424 of file integrator.cpp.
|
virtual |
Returns the
Definition at line 478 of file integrator.cpp.
|
protectedpure virtual |
Returns the dimension of the Differential Equation
Implemented in IntegratorBDF, IntegratorLYAPUNOV, and IntegratorRK.
|
protectedvirtual |
Returns the number of Dynamic Equations in the Differential Equation
Reimplemented in IntegratorBDF.
Definition at line 618 of file integrator.cpp.
returnValue Integrator::getForwardSensitivities | ( | DVector & | Dx, |
int | order | ||
) | const |
Returns the result for the forward sensitivities at the time tend.
Dx | the result for the forward sensitivities. |
order | the order. |
Definition at line 406 of file integrator.cpp.
returnValue Integrator::getForwardSensitivities | ( | VariablesGrid & | Dx, |
int | order | ||
) | const |
Returns the result for the forward sensitivities on the grid.
Dx | the result for the forward sensitivities. |
order | the order. |
Definition at line 414 of file integrator.cpp.
|
inline |
Returns the requested output on the specified grid.
The intermediate states constructed based on linear
interpolation.
I | the intermediates states on the grid. |
|
pure virtual |
Returns the number of rejected Steps.
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
|
pure virtual |
Returns the number of accepted Steps.
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
|
protectedpure virtual |
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 |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
|
protectedpure virtual |
Returns the result for the forward sensitivities at the time tend.
Dx | the result for the forward sensitivi- ties |
order | the order |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
|
protectedpure virtual |
Returns the result for the state at the time tend.
xEnd | the result for the states at the time tend. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
|
pure virtual |
Returns the current step size
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
|
inline |
Returns the result for the differential states at the
time tend.
xEnd | the result for the states at the time tend. |
|
inline |
Returns the requested output on the specified grid. Note
that the output X will be evaluated based on polynomial
interpolation depending on the order of the integrator.
X | the differential states on the grid. |
|
inline |
Returns the result for the algebraic states at the
time tend.
xaEnd | the result for the algebraic states at the time tend. |
|
inline |
Returns the requested output on the specified grid. Note
that the output X will be evaluated based on polynomial
interpolation depending on the order of the integrator.
XA | the algebraic states on the grid. |
|
pure 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. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, IntegratorBDF, IntegratorDiscretizedODE, and IntegratorRK12.
returnValue Integrator::init | ( | const DifferentialEquation & | rhs, |
const Transition & | trs | ||
) |
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. |
Definition at line 185 of file integrator.cpp.
|
protected |
Initializes the options. This routine should be called by the
integrators derived from this class in order to initialize
the following members based on the user options:
maxNumberOfSteps hmin hmax tune TOL las (cf. SETTINGS for more details)
Definition at line 587 of file integrator.cpp.
returnValue Integrator::integrate | ( | double | t0, |
double | tend, | ||
double * | x0, | ||
double * | xa = 0 , |
||
double * | p = 0 , |
||
double * | u = 0 , |
||
double * | w = 0 |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
t0 | the start time |
tend | the end time |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 207 of file integrator.cpp.
returnValue Integrator::integrate | ( | const Grid & | t, |
double * | x0, | ||
double * | xa = 0 , |
||
double * | p = 0 , |
||
double * | u = 0 , |
||
double * | w = 0 |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
In addition, results at intermediate grid points can be
stored. Note that these grid points are for storage only and
have nothing to do the integrator steps.
t | the grid [t0,tend] |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 220 of file integrator.cpp.
returnValue Integrator::integrate | ( | double | t0, |
double | tend, | ||
const DVector & | x0, | ||
const DVector & | xa = emptyVector , |
||
const DVector & | p = emptyVector , |
||
const DVector & | u = emptyVector , |
||
const DVector & | w = emptyVector |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
t0 | the start time |
tend | the end time |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 241 of file integrator.cpp.
returnValue Integrator::integrate | ( | const Grid & | t, |
const DVector & | x0, | ||
const DVector & | xa = emptyVector , |
||
const DVector & | p = emptyVector , |
||
const DVector & | u = emptyVector , |
||
const DVector & | w = emptyVector |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
In addition, results at intermediate grid points can be
stored. Note that these grid points are for storage only and
have nothing to do the integrator steps.
t | the grid [t0,tend] |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 255 of file integrator.cpp.
returnValue Integrator::integrateSensitivities | ( | ) |
< Integrates forward and/or backward depending on the specified seeds.
Definition at line 357 of file integrator.cpp.
|
virtual |
Returns if the differential equation of the integrator is affine.
Definition at line 471 of file integrator.cpp.
|
virtual |
Returns if the differential equation of the integrator is defined.
Definition at line 465 of file integrator.cpp.
|
virtual |
Prints the run-time profile. This routine
can be used after an integration run in
order to assess the performance.
Integrates forward and/or backward depending on the specified seeds.
Definition at line 624 of file integrator.cpp.
returnValue Integrator::setBackwardSeed | ( | const int & | order, |
const DVector & | seed | ||
) |
Define a backward seed
order | the order of the seed. |
seed | the backward seed |
Definition at line 338 of file integrator.cpp.
|
pure virtual |
Sets an initial guess for the differential state derivatives
(consistency condition)
dx0 | initial guess for the differential state derivatives |
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
returnValue Integrator::setForwardSeed | ( | const int & | order, |
const DVector & | xSeed, | ||
const DVector & | pSeed = emptyVector , |
||
const DVector & | uSeed = emptyVector , |
||
const DVector & | wSeed = emptyVector |
||
) |
Define a forward seed matrix.
order | the order of the seed. |
xSeed | the seed w.r.t states |
pSeed | the seed w.r.t parameters |
uSeed | the seed w.r.t controls |
wSeed | the seed w.r.t disturbances |
Definition at line 308 of file integrator.cpp.
|
protectedpure virtual |
Define a backward seed
seed | the seed matrix |
order | the order of the seed. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
|
protectedpure virtual |
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. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
returnValue Integrator::setTransition | ( | const Transition & | trs | ) |
Definition at line 198 of file integrator.cpp.
|
protectedvirtual |
Definition at line 599 of file integrator.cpp.
|
protectedvirtual |
Definition at line 566 of file integrator.cpp.
|
pure 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.
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
|
friend |
Definition at line 65 of file integrator.hpp.
|
friend |
Definition at line 64 of file integrator.hpp.
|
protected |
the index list for the algebraic states
Definition at line 655 of file integrator.hpp.
|
protected |
the index list for the controls
Definition at line 656 of file integrator.hpp.
|
protected |
a counter of the (accepted) steps
Definition at line 667 of file integrator.hpp.
|
protected |
number of steps after integration
Definition at line 668 of file integrator.hpp.
|
protected |
number of steps after integration
Definition at line 669 of file integrator.hpp.
|
protected |
the index list for the differential state derivatives
Definition at line 654 of file integrator.hpp.
|
protected |
Definition at line 713 of file integrator.hpp.
|
protected |
the index list for the differential states
Definition at line 653 of file integrator.hpp.
|
protected |
the scale of the differential states
Definition at line 670 of file integrator.hpp.
|
protected |
the index list for the disturbances
Definition at line 660 of file integrator.hpp.
|
protected |
Definition at line 702 of file integrator.hpp.
|
protected |
Definition at line 707 of file integrator.hpp.
|
protected |
Definition at line 703 of file integrator.hpp.
|
protected |
Definition at line 708 of file integrator.hpp.
|
protected |
Definition at line 704 of file integrator.hpp.
|
protected |
Definition at line 709 of file integrator.hpp.
|
protected |
Definition at line 701 of file integrator.hpp.
|
protected |
Definition at line 706 of file integrator.hpp.
|
protected |
Definition at line 712 of file integrator.hpp.
|
protected |
Definition at line 695 of file integrator.hpp.
|
protected |
the initial step size = h[0]
Definition at line 640 of file integrator.hpp.
|
protected |
storage of the initial step size
Definition at line 641 of file integrator.hpp.
|
protected |
the maximum step size
Definition at line 643 of file integrator.hpp.
|
protected |
the minimum step size
Definition at line 642 of file integrator.hpp.
|
protected |
the index list for the integer controls
Definition at line 658 of file integrator.hpp.
|
protected |
the index list for the integer parameters
Definition at line 659 of file integrator.hpp.
|
protected |
Definition at line 714 of file integrator.hpp.
|
protected |
Definition at line 646 of file integrator.hpp.
|
protected |
the dimension of the right-hand side
Definition at line 620 of file integrator.hpp.
|
protected |
the number of algebraic states
Definition at line 621 of file integrator.hpp.
|
protected |
the maximum number of integrator steps.
Definition at line 666 of file integrator.hpp.
|
protected |
number of differential states
Definition at line 629 of file integrator.hpp.
|
protected |
the dimension of differential state derivatives
Definition at line 622 of file integrator.hpp.
|
protected |
the number of intermediate states in the rhs
Definition at line 623 of file integrator.hpp.
|
protected |
the number of parameters
Definition at line 626 of file integrator.hpp.
|
protected |
the number of integer parameters
Definition at line 627 of file integrator.hpp.
|
protected |
the number of controls
Definition at line 624 of file integrator.hpp.
|
protected |
the number of integer controls
Definition at line 625 of file integrator.hpp.
|
protected |
the number of disturbances
Definition at line 628 of file integrator.hpp.
|
protected |
The number of backward directions
Definition at line 681 of file integrator.hpp.
|
protected |
The number of second order backward directions
Definition at line 683 of file integrator.hpp.
|
protected |
Definition at line 696 of file integrator.hpp.
|
protected |
The number of forward directions
Definition at line 680 of file integrator.hpp.
|
protected |
The number of second order forward directions
Definition at line 682 of file integrator.hpp.
|
protected |
the index list for the parameters
Definition at line 657 of file integrator.hpp.
|
protected |
The PrintLevel (default: LOW)
Definition at line 675 of file integrator.hpp.
|
protected |
the right-hand side to be integrated
Definition at line 619 of file integrator.hpp.
|
protected |
the state of aggregation
Definition at line 688 of file integrator.hpp.
|
protected |
the time index
Definition at line 661 of file integrator.hpp.
|
protected |
the type of linear algebra solver to be used the time interval
Definition at line 648 of file integrator.hpp.
|
protected |
the integration tolerance
Definition at line 645 of file integrator.hpp.
|
protected |
Definition at line 694 of file integrator.hpp.
|
protected |
the transition to be evaluated at switches
Definition at line 634 of file integrator.hpp.
|
protected |
tuning parameter for the step size control.
Definition at line 644 of file integrator.hpp.
|
protected |
Definition at line 699 of file integrator.hpp.
|
protected |
Definition at line 711 of file integrator.hpp.