ACADO Toolkit
1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
|
Stores and evaluates Mayer terms within optimal control problems. More...
#include <mayer_term.hpp>
Public Member Functions | |
MayerTerm () | |
Default constructor. | |
MayerTerm (const Grid &grid_, const Expression &arg) | |
Default constructor. | |
MayerTerm (const Grid &grid_, const Function &arg) | |
Default constructor. | |
MayerTerm (const MayerTerm &rhs) | |
Copy constructor (deep copy). | |
virtual | ~MayerTerm () |
Destructor. | |
MayerTerm & | operator= (const MayerTerm &rhs) |
Assignment operator (deep copy). | |
returnValue | init (const Grid &grid_, const Expression &arg) |
returnValue | evaluate (const OCPiterate &x) |
returnValue | evaluateSensitivities (BlockMatrix *hessian) |
Evaluates the objective gradient contribution from this term and computes the corresponding exact hessian if hessian != 0 . | |
returnValue | setGrid (const Grid &grid_) |
Sets the discretization grid. | |
returnValue | init (const OCPiterate &x) |
Initializes the Objective Element: The dimensions and index lists. | |
virtual returnValue | setForwardSeed (BlockMatrix *xSeed_, BlockMatrix *xaSeed_, BlockMatrix *pSeed_, BlockMatrix *uSeed_, BlockMatrix *wSeed_, int order) |
Define a forward seed in form of a block matrix. | |
virtual returnValue | setBackwardSeed (BlockMatrix *seed, int order) |
Define a backward seed in form of a block matrix. | |
virtual returnValue | getObjectiveValue (double &objectiveValue) |
Returns the result for the residuum. | |
virtual returnValue | getForwardSensitivities (BlockMatrix *D, int order) |
Returns the result for the forward sensitivities in BlockMatrix form. | |
virtual returnValue | getBackwardSensitivities (BlockMatrix *D, int order) |
Returns the result for the backward sensitivities in BlockMatrix form. | |
int | getNX () const |
Returns the number of differential states . | |
int | getNXA () const |
Returns the number of algebraic states . | |
int | getNP () const |
Returns the number of parameters . | |
int | getNU () const |
Returns the number of controls . | |
int | getNW () const |
Returns the number of disturbances . | |
returnValue | getFunction (Function &_function) |
Returns the element's function . | |
Protected Member Functions | |
Grid | getGrid () const |
returns the constraint grid | |
Protected Attributes | |
Grid | grid |
the objective grid | |
Function | fcn |
the function | |
EvaluationPoint | z |
the evaluation point | |
EvaluationPoint | JJ |
int * | y_index |
index lists | |
int | t_index |
time index | |
int | nx |
number of diff. | |
int | na |
number of alg. | |
int | nu |
number of controls | |
int | np |
number of parameters | |
int | nw |
number of disturbances | |
int | ny |
:= nx+na+nu+np+nw | |
BlockMatrix * | xSeed |
the 1st order forward seed in x-direction | |
BlockMatrix * | xaSeed |
the 1st order forward seed in x-direction | |
BlockMatrix * | pSeed |
the 1st order forward seed in p-direction | |
BlockMatrix * | uSeed |
the 1st order forward seed in u-direction | |
BlockMatrix * | wSeed |
the 1st order forward seed in w-direction | |
BlockMatrix * | bSeed |
the 1st order backward seed | |
BlockMatrix * | xSeed2 |
the 2nd order forward seed in x-direction | |
BlockMatrix * | xaSeed2 |
the 2nd order forward seed in x-direction | |
BlockMatrix * | pSeed2 |
the 2nd order forward seed in p-direction | |
BlockMatrix * | uSeed2 |
the 2nd order forward seed in u-direction | |
BlockMatrix * | wSeed2 |
the 2nd order forward seed in w-direction | |
BlockMatrix * | bSeed2 |
the 2nd order backward seed | |
double | obj |
the objective value | |
BlockMatrix | dForward |
the first order forward derivatives | |
BlockMatrix | dBackward |
the first order backward derivatives |
The class MayerTerm allows to manage and evaluate Mayer terms within optimal control problems.
MayerTerm::MayerTerm | ( | const Grid & | grid_, |
const Expression & | arg | ||
) |
References ObjectiveElement::fcn.
MayerTerm::MayerTerm | ( | const Grid & | grid_, |
const Function & | arg | ||
) |
References ObjectiveElement::fcn.
MayerTerm::MayerTerm | ( | const MayerTerm & | rhs | ) |
MayerTerm::~MayerTerm | ( | ) | [virtual] |
returnValue MayerTerm::evaluate | ( | const OCPiterate & | x | ) |
returnValue MayerTerm::evaluateSensitivities | ( | BlockMatrix * | hessian | ) |
References ACADOERROR, Function::AD_backward(), Function::AD_backward2(), Function::AD_forward(), ObjectiveElement::bSeed, BT_TRUE, ObjectiveElement::dBackward, ObjectiveElement::fcn, Function::getNumberOfVariables(), Grid::getNumPoints(), EvaluationPoint::getP(), Matrix::getRow(), BlockMatrix::getSubBlock(), EvaluationPoint::getU(), EvaluationPoint::getW(), EvaluationPoint::getX(), EvaluationPoint::getXA(), ObjectiveElement::grid, BlockMatrix::init(), Matrix::init(), ObjectiveElement::JJ, ObjectiveElement::na, ObjectiveElement::np, ObjectiveElement::nu, ObjectiveElement::nw, ObjectiveElement::nx, RET_NOT_IMPLEMENTED_YET, BlockMatrix::setDense(), SUCCESSFUL_RETURN, and ObjectiveElement::y_index.
Referenced by Objective::evaluateSensitivities().
returnValue ObjectiveElement::getBackwardSensitivities | ( | BlockMatrix * | D, |
int | order | ||
) | [virtual, inherited] |
D | the result for the forward sensitivi- ties |
order | the order |
References ACADOERROR, ACADOWARNING, ASSERT, ObjectiveElement::dBackward, RET_INPUT_OUT_OF_RANGE, RET_NOT_IMPLEMENTED_YET, and SUCCESSFUL_RETURN.
Referenced by Objective::getBackwardSensitivities().
returnValue ObjectiveElement::getForwardSensitivities | ( | BlockMatrix * | D, |
int | order | ||
) | [virtual, inherited] |
D | the result for the forward sensitivi- ties |
order | the order |
References ACADOERROR, ACADOWARNING, ASSERT, ObjectiveElement::dForward, RET_INPUT_OUT_OF_RANGE, RET_NOT_IMPLEMENTED_YET, and SUCCESSFUL_RETURN.
Referenced by Objective::getForwardSensitivities().
returnValue ObjectiveElement::getFunction | ( | Function & | _function | ) | [inline, inherited] |
References ObjectiveElement::fcn, and SUCCESSFUL_RETURN.
Grid ObjectiveElement::getGrid | ( | ) | const [inline, protected, inherited] |
References ObjectiveElement::grid.
int ObjectiveElement::getNP | ( | ) | const [inline, inherited] |
References ObjectiveElement::fcn, and Function::getNP().
int ObjectiveElement::getNU | ( | ) | const [inline, inherited] |
References ObjectiveElement::fcn, and Function::getNU().
int ObjectiveElement::getNW | ( | ) | const [inline, inherited] |
References ObjectiveElement::fcn, and Function::getNW().
int ObjectiveElement::getNX | ( | ) | const [inline, inherited] |
References ObjectiveElement::fcn, and Function::getNX().
int ObjectiveElement::getNXA | ( | ) | const [inline, inherited] |
References ObjectiveElement::fcn, and Function::getNXA().
returnValue ObjectiveElement::getObjectiveValue | ( | double & | objectiveValue | ) | [virtual, inherited] |
objectiveValue | the objective value |
References ObjectiveElement::obj, and SUCCESSFUL_RETURN.
Referenced by Objective::getObjectiveValue().
BEGIN_NAMESPACE_ACADO returnValue MayerTerm::init | ( | const Grid & | grid_, |
const Expression & | arg | ||
) | [inline] |
References ObjectiveElement::fcn, ObjectiveElement::grid, and SUCCESSFUL_RETURN.
Referenced by evaluate().
returnValue ObjectiveElement::init | ( | const OCPiterate & | x | ) | [inherited] |
References ObjectiveElement::fcn, MatrixVariablesGrid::getNumValues(), Function::index(), EvaluationPoint::init(), ObjectiveElement::JJ, ObjectiveElement::na, ObjectiveElement::np, ObjectiveElement::nu, ObjectiveElement::nw, ObjectiveElement::nx, ObjectiveElement::ny, OCPiterate::p, SUCCESSFUL_RETURN, ObjectiveElement::t_index, OCPiterate::u, VT_ALGEBRAIC_STATE, VT_CONTROL, VT_DIFFERENTIAL_STATE, VT_DISTURBANCE, VT_PARAMETER, VT_TIME, OCPiterate::w, OCPiterate::x, OCPiterate::xa, ObjectiveElement::y_index, and ObjectiveElement::z.
Referenced by LSQTerm::evaluate().
returnValue ObjectiveElement::setBackwardSeed | ( | BlockMatrix * | seed, |
int | order | ||
) | [virtual, inherited] |
seed | the seed matrix |
order | the order of the seed. |
References ACADOWARNING, ObjectiveElement::bSeed, ObjectiveElement::bSeed2, RET_INPUT_OUT_OF_RANGE, and SUCCESSFUL_RETURN.
Referenced by Objective::setBackwardSeed().
returnValue ObjectiveElement::setForwardSeed | ( | BlockMatrix * | xSeed_, |
BlockMatrix * | xaSeed_, | ||
BlockMatrix * | pSeed_, | ||
BlockMatrix * | uSeed_, | ||
BlockMatrix * | wSeed_, | ||
int | order | ||
) | [virtual, inherited] |
xSeed_ | the seed in x -direction |
xaSeed_ | the seed in xa-direction |
pSeed_ | the seed in p -direction |
uSeed_ | the seed in u -direction |
wSeed_ | the seed in w -direction |
order | the order of the seed. |
References ACADOWARNING, ObjectiveElement::pSeed, ObjectiveElement::pSeed2, RET_INPUT_OUT_OF_RANGE, SUCCESSFUL_RETURN, ObjectiveElement::uSeed, ObjectiveElement::uSeed2, ObjectiveElement::wSeed, ObjectiveElement::wSeed2, ObjectiveElement::xaSeed, ObjectiveElement::xaSeed2, ObjectiveElement::xSeed, and ObjectiveElement::xSeed2.
Referenced by Objective::setForwardSeed().
BEGIN_NAMESPACE_ACADO returnValue ObjectiveElement::setGrid | ( | const Grid & | grid_ | ) | [inline, inherited] |
Reimplemented in LSQTerm.
References ObjectiveElement::grid, and SUCCESSFUL_RETURN.
Referenced by Objective::addLSQEndTerm().
BlockMatrix* ObjectiveElement::bSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::bSeed2 [protected, inherited] |
BlockMatrix ObjectiveElement::dBackward [protected, inherited] |
BlockMatrix ObjectiveElement::dForward [protected, inherited] |
Function ObjectiveElement::fcn [protected, inherited] |
Referenced by evaluate(), LSQTerm::evaluate(), LSQEndTerm::evaluate(), evaluateSensitivities(), LSQTerm::evaluateSensitivities(), LSQTerm::evaluateSensitivitiesGN(), LSQEndTerm::evaluateSensitivitiesGN(), ObjectiveElement::getFunction(), ObjectiveElement::getNP(), ObjectiveElement::getNU(), ObjectiveElement::getNW(), ObjectiveElement::getNX(), ObjectiveElement::getNXA(), init(), LSQEndTerm::init(), ObjectiveElement::init(), LSQTerm::isQuadratic(), LSQEndTerm::isQuadratic(), LSQEndTerm::LSQEndTerm(), LSQTerm::LSQTerm(), MayerTerm(), ObjectiveElement::ObjectiveElement(), ObjectiveElement::operator=(), LSQTerm::operator=(), LSQEndTerm::operator=(), and LSQTerm::setGrid().
Grid ObjectiveElement::grid [protected, inherited] |
Referenced by evaluate(), LSQTerm::evaluate(), LSQEndTerm::evaluate(), evaluateSensitivities(), LSQTerm::evaluateSensitivities(), LSQTerm::evaluateSensitivitiesGN(), LSQEndTerm::evaluateSensitivitiesGN(), ObjectiveElement::getGrid(), init(), LSQEndTerm::init(), LSQTerm::LSQTerm(), ObjectiveElement::ObjectiveElement(), ObjectiveElement::operator=(), LSQTerm::operator=(), ObjectiveElement::setGrid(), LSQTerm::setGrid(), LSQTerm::setReference(), and LSQTerm::~LSQTerm().
EvaluationPoint ObjectiveElement::JJ [protected, inherited] |
Referenced by evaluateSensitivities(), and ObjectiveElement::init().
int ObjectiveElement::na [protected, inherited] |
int ObjectiveElement::np [protected, inherited] |
int ObjectiveElement::nu [protected, inherited] |
int ObjectiveElement::nw [protected, inherited] |
int ObjectiveElement::nx [protected, inherited] |
int ObjectiveElement::ny [protected, inherited] |
Referenced by ObjectiveElement::init(), ObjectiveElement::ObjectiveElement(), and ObjectiveElement::operator=().
double ObjectiveElement::obj [protected, inherited] |
BlockMatrix* ObjectiveElement::pSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::pSeed2 [protected, inherited] |
int ObjectiveElement::t_index [protected, inherited] |
Referenced by ObjectiveElement::init(), ObjectiveElement::ObjectiveElement(), and ObjectiveElement::operator=().
BlockMatrix* ObjectiveElement::uSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::uSeed2 [protected, inherited] |
BlockMatrix* ObjectiveElement::wSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::wSeed2 [protected, inherited] |
BlockMatrix* ObjectiveElement::xaSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::xaSeed2 [protected, inherited] |
BlockMatrix* ObjectiveElement::xSeed [protected, inherited] |
BlockMatrix* ObjectiveElement::xSeed2 [protected, inherited] |
int* ObjectiveElement::y_index [protected, inherited] |
EvaluationPoint ObjectiveElement::z [protected, inherited] |
Referenced by evaluate(), LSQTerm::evaluate(), LSQEndTerm::evaluate(), and ObjectiveElement::init().