![]() |
YANE-Framework 1.1.0
|
Class for discretizing optimal control problem. More...
Public Member Functions | |
double | abortSuboptimalityDegree () |
Function to return the current value of the suboptimality bound used within the suboptimality based stopping criterion. | |
void | calc (double *x, int realtimesteps=0, double aborttimeoffset=0.0) |
Function to solve the discretized optimal control problem. | |
Discretization * | clone (int horizon=-1) |
Function to create a cloned object using identical odemanager and minimizer from classes yane::MPC:OdeManager and yane::MinProg::NLP respectively. | |
double * | currentx () |
Function to return the pointer of the internal copy of the state vector. | |
int | dimension_restr () |
Function to return the number of restrictions of the optimal control problem before discretization. | |
int | dimension_u () |
Function to return the dimension of the conrol. | |
int | dimension_x () |
Function to return the dimension of the state variable. | |
Discretization (OdeManager *odemanager, yane::MinProg::NLP *minimizer, yane::Model::Model *model, int horizon, ModelShootingData *shootingdata, double INFTY=1E19) | |
Constructor. | |
int | horizon () |
Function to return the current horizon length. | |
double | infty () |
Function to return the number associated with infinity. | |
void | initCalc (double *t, double *u0) |
Function to initialize the discretized optimal control problem. | |
double * | lbound_u () |
Function to return the pointer of the lower bounds of the control. | |
double * | lbound_x () |
Function to return the pointer of the lower bounds of the states. | |
yane::MinProg::NLP * | minimizer () |
Function to return the pointer of the used class yane::MinProg::NLP object. | |
yane::Model::Model * | model () |
Function to return the pointer of the model. | |
OdeManager * | odemanager () |
Function to return the pointer of the differential equation manager. | |
OdeManager * | odeManager () |
unction to return the pointer of the used class yane::MPC::OdeManager object | |
T_SHOOTINGDATA * | sdata () |
Function to return the structure of the shooting nodes. | |
int | sdatalength () |
Function to return the number of shooting nodes. | |
void | setAbortSuboptimalityCriterionValues (double abortSuboptimalityDegree, double previousCostfunctionValue=0.0, double previousRunningcostValue=0.0) |
Function to set the data used for the suboptimality based stopping criterion. | |
bool | suboptimalityCheck (double currentCostfunctionValue) |
Function to check whether the suboptimality based stopping criterion is satisfied. | |
double * | timesteps () |
Function to return the pointer of the internal copy of the time grid. | |
int | totalRestrictionNumber () |
Function to return the total number of restrictions of the discretized optimal control problem. | |
double * | u_zero () |
Function to return the pointer of a zero control vector. | |
double * | ubound_u () |
Function to return the pointer of the upper bounds of the control. | |
double * | ubound_x () |
Function to return the pointer of the upper bounds of the states. | |
~Discretization () | |
Destructor. | |
Static Public Member Functions | |
static void | min_func (const double *x, double *fx, void *params) |
Function to evaluate the cost function. | |
static void | min_func_grad (const double *x, double *fx, void *params) |
Function to evaluate the gradient of the cost function. | |
static void | min_restr (const double *x, double *fx, void *params) |
Function to evaluate the restrictions. | |
static void | min_restr_grad (const double *x, double *fx, void *params) |
Function to evaluate the Jacobian of the restrictions. |
This class can be used to define and solve an optimal control problem of the form
To this end a (not necessarily equidistant) time grid is defined and the control problem is discretized with respect to this time grid. The resulting optimization problem is then handed over to a class yane::MinProg::NLP object.
yane::MPC::Discretization::Discretization | ( | OdeManager * | odemanager, |
yane::MinProg::NLP * | minimizer, | ||
yane::Model::Model * | model, | ||
int | horizon, | ||
ModelShootingData * | shootingdata, | ||
double | INFTY = 1E19 |
||
) |
Constructor
odemanager | Pointer of the odemanager object of class yane::MPC::OdeManager |
minimizer | Pointer of the minimizer object of class yane::MinProg::NLP |
model | Pointer of the model object of class yane::Model::Model |
horizon | Length of the optimization horizon in sampling instances |
INFTY | Value for infinity |
yane::Utils::ValueException | Is thrown if input values are incorrect |
yane::Utils::MemoryException | Is thrown if memory allocation failed |
yane::MinProg::MinProgException | Is thrown if the discretized optimization problem or the prediction or the odemanager cannot be initialized |
yane::Utils::Exception | Is thrown if the odemanager cannot be initialized |
double yane::MPC::Discretization::abortSuboptimalityDegree | ( | void | ) |
Function to return the current value of the suboptimality bound used within the suboptimality based stopping criterion
void yane::MPC::Discretization::calc | ( | double * | x, |
int | realtimesteps = 0 , |
||
double | aborttimeoffset = 0.0 |
||
) |
Function to solve the discretized optimal control problem
x | Estimate of the initial value of the state |
realtimesteps | Number of time steps on the time grid after which the computation shall be terminated (0 = no limit) |
aborttimeoffset | Time offset after which the computation shall be terminated (negative values shorten the time interval available for optimization) |
yane::Utils::ValueException | Is thrown if a null pointer is submitted |
yane::MinProg::SolverWarning | Is thrown if the yane::MinProg::NLP object terminates with a warning |
yane::Utils::Exception | Is thrown if any other error occurs |
yane::MPC::Discretization * yane::MPC::Discretization::clone | ( | int | horizon = -1 | ) |
Function to create a cloned object using identical odemanager and minimizer from classes yane::MPC:OdeManager and yane::MinProg::NLP respectively. The clone can be initialized with a different horizon length.
Note that local modifications of the odemanager and the minimizer objects are not cloned and have to be redone. This object must be destructed by the user and its destruction automatically destructs the corresponding odemanager and minimizer objects.
horizon | Length of the horizon for the cloned object |
yane::MPC::MPCException | Is thrown if the underlying yane::MPC::MPC object terminates with an error |
yane::Utils::MemoryException | Is thrown if memory allocation fails |
yane::Utils::Exception | Is thrown if any other error occurs |
double * yane::MPC::Discretization::currentx | ( | ) |
Function to return the pointer of the internal copy of the state vector
int yane::MPC::Discretization::dimension_restr | ( | ) |
Function to return the number of restrictions of the optimal control problem before discretization
int yane::MPC::Discretization::dimension_u | ( | ) |
Function to return the dimension of the control
int yane::MPC::Discretization::dimension_x | ( | ) |
Function to return the dimension of the state variable
int yane::MPC::Discretization::horizon | ( | ) |
Function to return the current horizon length
double yane::MPC::Discretization::infty | ( | ) |
Function to return the number associated with infinity
void yane::MPC::Discretization::initCalc | ( | double * | t, |
double * | u0 | ||
) |
Function to initialize the discretized optimal control problem
t | Time grid |
u0 | Initial guess of the control |
double * yane::MPC::Discretization::lbound_u | ( | ) |
Function to return the pointer of the lower bounds of the control
double * yane::MPC::Discretization::lbound_x | ( | ) |
Function to return the pointer of the lower bounds of the states
void yane::MPC::Discretization::min_func | ( | const double * | x, |
double * | fx, | ||
void * | params | ||
) | [static] |
Function to evaluate the cost function
x | Estimate of the initial value of the state |
fx | Value of the cost function |
params | Parameter vector of the optimal control problem |
void yane::MPC::Discretization::min_func_grad | ( | const double * | x, |
double * | fx, | ||
void * | params | ||
) | [static] |
Function to evaluate the gradient of the cost function
x | Estimate of the initial value of the state |
fx | Gradient of the cost function |
params | Parameter vector of the optimal control problem |
void yane::MPC::Discretization::min_restr | ( | const double * | x, |
double * | fx, | ||
void * | params | ||
) | [static] |
Function to evaluate the restrictions
x | Estimate of the initial value of the state |
fx | Vector of values of the restrictions |
params | Parameter vector of the optimal control problem |
void yane::MPC::Discretization::min_restr_grad | ( | const double * | x, |
double * | fx, | ||
void * | params | ||
) | [static] |
Function to evaluate the Jacobian of the restrictions
x | Estimate of the initial value of the state |
fx | Jacobian of the constraints |
params | Parameter vector of the optimal control problem |
yane::MinProg::NLP * yane::MPC::Discretization::minimizer | ( | ) |
Function to return the pointer of the used class yane::MinProg::NLP object
yane::Model::Model * yane::MPC::Discretization::model | ( | ) |
Function to return the pointer of the model
yane::MPC::OdeManager * yane::MPC::Discretization::odeManager | ( | ) |
Function to return the pointer of the used class yane::MPC::OdeManager object
yane::MPC::OdeManager * yane::MPC::Discretization::odemanager | ( | ) |
Function to return the pointer of the differential equation manager
yane::MPC::T_SHOOTINGDATA * yane::MPC::Discretization::sdata | ( | ) |
Function to return the structure of shooting nodes
int yane::MPC::Discretization::sdatalength | ( | ) |
Function to return the number of shooting nodes
void yane::MPC::Discretization::setAbortSuboptimalityCriterionValues | ( | double | abortSuboptimalityDegree, |
double | previousCostfunctionValue = 0.0 , |
||
double | previousRunningcostValue = 0.0 |
||
) |
bool yane::MPC::Discretization::suboptimalityCheck | ( | double | currentCostfunctionValue | ) |
Function to check whether the suboptimality based stopping criterion is satisfied
currentCostfunctionValue | Value of the cost function for the current control vector |
double * yane::MPC::Discretization::timesteps | ( | ) |
Function to return the pointer of the internal copy of the time grid
int yane::MPC::Discretization::totalRestrictionNumber | ( | ) |
Function to return the total number of restrictions of the discretized optimal control problem
double * yane::MPC::Discretization::u_zero | ( | ) |
Function to return the pointer of zero control vector
double * yane::MPC::Discretization::ubound_u | ( | ) |
Function to return the pointer of the upper bounds of the control
double * yane::MPC::Discretization::ubound_x | ( | ) |
Function to return the pointer of the upper bounds of the states