- 3.0.2 optimal control module.
|
A base function for cost functions. All cost functions should derive from this. More...
#include <CostFunction.hpp>
Public Types | |
typedef core::ControlVector< CONTROL_DIM, SCALAR > | control_vector_t |
Public Member Functions | |
CostFunction () | |
Default constructor. More... | |
virtual | ~CostFunction () |
Destructor. More... | |
CostFunction (const CostFunction &arg) | |
Copy constructor. More... | |
virtual CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > * | clone () const =0 |
virtual void | setCurrentStateAndControl (const state_vector_t &x, const control_vector_t &u, const SCALAR &t=SCALAR(0.0)) |
virtual void | getCurrentStateAndControl (Eigen::Matrix< SCALAR, STATE_DIM, 1 > &x, Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &u, SCALAR &t) const |
sets current state, control and time More... | |
virtual SCALAR | evaluateIntermediate ()=0 |
evaluate intermediate costs More... | |
virtual SCALAR | evaluateTerminal ()=0 |
evaluate terminal costs More... | |
virtual void | shiftTime (const SCALAR t) |
Public Attributes | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef core::StateVector< STATE_DIM, SCALAR > | state_vector_t |
Protected Attributes | |
state_vector_t | x_ |
control_vector_t | u_ |
SCALAR | t_ |
SCALAR | t_shift_ |
A base function for cost functions. All cost functions should derive from this.
typedef core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t |
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction | ( | ) |
Default constructor.
Default constructor, sets state, control and time to zero
References ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_.
|
virtual |
Destructor.
Destructor
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction | ( | const CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > & | arg | ) |
Copy constructor.
arg | other cost function |
|
pure virtual |
Clones the cost function.
Implemented in ct::optcon::CostFunctionAnalytical< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Set the current state, control and time of the cost function. In this function, the user can add pre-computations shared between different calls to the derivative functions.
x | state vector |
u | control vector |
t | time |
References ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_, ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_shift_, u, ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_, x, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_.
Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateNumDiff(), ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::setFromTimeInvariantLinearQuadraticProblem(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateNumDiff(), and ct::optcon::example::TEST().
|
virtual |
sets current state, control and time
Get the current state, control and time of the cost function. In this function, the user can add pre-computations shared between different calls to the derivative functions.
x | state vector |
u | control vector |
t | time |
References ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_, ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_.
Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateNumDiff(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateNumDiff().
|
pure virtual |
evaluate intermediate costs
Evaluates the running/intermediate cost function for the control, state and time set in setCurrentStateAndControl()
Implemented in ct::optcon::CostFunctionAnalytical< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by ct::optcon::example::compareCostFunctionOutput(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateNumDiff(), ct::optcon::example::printCostFunctionOutput(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateNumDiff().
|
pure virtual |
evaluate terminal costs
Evaluates the terminal cost for a given state and control set in setCurrentStateAndControl(). This usually ignores time.
Implemented in ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::CostFunctionAnalytical< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by ct::optcon::example::compareCostFunctionOutput(), and ct::optcon::example::printCostFunctionOutput().
|
virtual |
References t, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_shift_.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef core::StateVector<STATE_DIM, SCALAR> ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t |
|
protected |
Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminal(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminal(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().
|
protected |
state vector
Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().
|
protected |
control vector
Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().
|
protected |