ACADO Toolkit  1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
Public Member Functions | Protected Member Functions | Protected Attributes

Stores and evaluates LSQ mayer terms within optimal control problems. More...

#include <lsq_end_term.hpp>

Inheritance diagram for LSQEndTerm:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 LSQEndTerm ()
 Default constructor.
 LSQEndTerm (const Grid &grid_, const Matrix &S_, const Function &m_, const Vector &r_)
 Default constructor.
 LSQEndTerm (const LSQEndTerm &rhs)
 Copy constructor (deep copy).
virtual ~LSQEndTerm ()
 Destructor.
LSQEndTermoperator= (const LSQEndTerm &rhs)
 Assignment operator (deep copy).
returnValue init (const Grid &grid_, const Matrix &S_, const Function &m_, const Vector &r_)
returnValue evaluate (const OCPiterate &x)
returnValue evaluateSensitivities (BlockMatrix *hessian)
 Evaluates the objective gradient contribution from this term
and computes the corresponding exact hessian.
returnValue evaluateSensitivitiesGN (BlockMatrix *GNhessian)
 Evaluates the objective gradient contribution from this term
and computes the corresponding GN hessian approximation for
the case that GNhessian != 0.
BooleanType isAffine ()
 returns whether the constraint element is affine.
BooleanType isQuadratic ()
 returns whether the constraint element is convex.
BooleanType isConvex ()
 returns whether the constraint element is convex.
returnValue setReference (const Vector &ref)
 overwrites the reference vector r


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

Matrix S
 a symmetric weighting matrix
Vector r
 a tracking reference
double * S_h_res
 specific intermediate results
to be stored for backward
differentiation

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
BlockMatrixxSeed
 the 1st order forward seed in x-direction
BlockMatrixxaSeed
 the 1st order forward seed in x-direction
BlockMatrixpSeed
 the 1st order forward seed in p-direction
BlockMatrixuSeed
 the 1st order forward seed in u-direction
BlockMatrixwSeed
 the 1st order forward seed in w-direction
BlockMatrixbSeed
 the 1st order backward seed
BlockMatrixxSeed2
 the 2nd order forward seed in x-direction
BlockMatrixxaSeed2
 the 2nd order forward seed in x-direction
BlockMatrixpSeed2
 the 2nd order forward seed in p-direction
BlockMatrixuSeed2
 the 2nd order forward seed in u-direction
BlockMatrixwSeed2
 the 2nd order forward seed in w-direction
BlockMatrixbSeed2
 the 2nd order backward seed
double obj
 the objective value
BlockMatrix dForward
 the first order forward derivatives
BlockMatrix dBackward
 the first order backward derivatives

Detailed Description

The class LSQEndTerm allows to manage and evaluate least square objective mayer terms
of the general form:

0.5* || S * ( m(T,x(T),p(T),...) - r ) ||^2_2

Here the T is the time at the last grid point of the objective grid.

Author:
Boris Houska, Hans Joachim Ferreau

Constructor & Destructor Documentation

References S_h_res.

LSQEndTerm::LSQEndTerm ( const Grid grid_,
const Matrix S_,
const Function m_,
const Vector r_ 
)
Parameters:
grid_the objective grid
S_the weighting matrix
m_the LSQ function
r_the reference vector

References ObjectiveElement::fcn, Function::getDim(), r, S, and S_h_res.

LSQEndTerm::~LSQEndTerm ( ) [virtual]

References S_h_res.


Member Function Documentation



Returns:
SUCCESSFUL_RETURN

References ACADOERROR, evaluateSensitivitiesGN(), and RET_NOT_IMPLEMENTED_YET.

Referenced by Objective::evaluateSensitivities().

returnValue ObjectiveElement::getBackwardSensitivities ( BlockMatrix D,
int  order 
) [virtual, inherited]



Returns:
SUCCESSFUL_RETURN
RET_INPUT_OUT_OF_RANGE
Parameters:
Dthe result for the forward sensitivi- ties
orderthe 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]



Returns:
SUCCESSFUL_RETURN
RET_INPUT_OUT_OF_RANGE
Parameters:
Dthe result for the forward sensitivi- ties
orderthe 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]
Returns:
SUCCESSFUL_RETURN.

References ObjectiveElement::fcn, and SUCCESSFUL_RETURN.

Grid ObjectiveElement::getGrid ( ) const [inline, protected, inherited]
int ObjectiveElement::getNP ( ) const [inline, inherited]
Returns:
The requested number of parameters.

References ObjectiveElement::fcn, and Function::getNP().

int ObjectiveElement::getNU ( ) const [inline, inherited]
Returns:
The requested number of controls.

References ObjectiveElement::fcn, and Function::getNU().

int ObjectiveElement::getNW ( ) const [inline, inherited]
Returns:
The requested number of disturbances.

References ObjectiveElement::fcn, and Function::getNW().

int ObjectiveElement::getNX ( ) const [inline, inherited]
Returns:
The requested number of differential states.

References ObjectiveElement::fcn, and Function::getNX().

int ObjectiveElement::getNXA ( ) const [inline, inherited]
Returns:
The requested number of algebraic states.

References ObjectiveElement::fcn, and Function::getNXA().

returnValue ObjectiveElement::getObjectiveValue ( double &  objectiveValue) [virtual, inherited]



Returns:
SUCCESSFUL_RETURN
Parameters:
objectiveValuethe objective value

References ObjectiveElement::obj, and SUCCESSFUL_RETURN.

Referenced by Objective::getObjectiveValue().

BEGIN_NAMESPACE_ACADO returnValue LSQEndTerm::init ( const Grid grid_,
const Matrix S_,
const Function m_,
const Vector r_ 
) [inline]
Parameters:
grid_the objective grid
S_the weighting matrix
m_the LSQ function
r_the reference vectors

References ObjectiveElement::fcn, ObjectiveElement::grid, r, S, and SUCCESSFUL_RETURN.

Referenced by evaluate().

returnValue ObjectiveElement::init ( const OCPiterate x) [inherited]
LSQEndTerm & LSQEndTerm::operator= ( const LSQEndTerm rhs)
returnValue ObjectiveElement::setBackwardSeed ( BlockMatrix seed,
int  order 
) [virtual, inherited]



Returns:
SUCCESFUL_RETURN
RET_INPUT_OUT_OF_RANGE
Parameters:
seedthe seed matrix
orderthe 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]



Returns:
SUCCESFUL RETURN
RET_INPUT_OUT_OF_RANGE
Parameters:
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
orderthe 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]



Returns:
SUCCESSFUL_RETURN

Reimplemented in LSQTerm.

References ObjectiveElement::grid, and SUCCESSFUL_RETURN.

Referenced by Objective::addLSQEndTerm().

returnValue LSQEndTerm::setReference ( const Vector ref) [inline]
Returns:
SUCCESSFUL_RETURN

References r, and SUCCESSFUL_RETURN.


Member Data Documentation

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]
Grid ObjectiveElement::grid [protected, inherited]
EvaluationPoint ObjectiveElement::JJ [protected, inherited]
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]
double ObjectiveElement::obj [protected, inherited]
BlockMatrix* ObjectiveElement::pSeed [protected, inherited]
BlockMatrix* ObjectiveElement::pSeed2 [protected, inherited]
Vector LSQEndTerm::r [protected]
Matrix LSQEndTerm::S [protected]
double* LSQEndTerm::S_h_res [protected]
int ObjectiveElement::t_index [protected, inherited]
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]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines