iDynTree::optimalcontrol::L2NormCost class

Base classes

class Cost
The Cost virtual class definition.

Constructors, destructors, conversion operators

L2NormCost(const std::string& name, unsigned int stateDimension, unsigned int controlDimension)
L2NormCost(const std::string& name, const MatrixDynSize& stateSelector, const MatrixDynSize& controlSelector)
L2NormCost(const std::string& name, const IndexRange& stateSelector, unsigned int totalStateDimension, const IndexRange& controlSelector, unsigned int totalControlDimension)
L2NormCost(const L2NormCost& other) deleted
~L2NormCost()

Public functions

auto setStateWeight(const MatrixDynSize& stateWeights) -> bool
auto setStateWeight(const VectorDynSize& stateWeights) -> bool
auto setStateDesiredPoint(const VectorDynSize& desiredPoint) -> bool
auto setStateDesiredTrajectory(std::shared_ptr<TimeVaryingVector> stateDesiredTrajectory) -> bool
auto setControlWeight(const MatrixDynSize& controlWeights) -> bool
auto setControlWeight(const VectorDynSize& controlWeights) -> bool
auto setControlDesiredPoint(const VectorDynSize& desiredPoint) -> bool
auto setControlDesiredTrajectory(std::shared_ptr<TimeVaryingVector> controlDesiredTrajectory) -> bool
auto updatStateSelector(const MatrixDynSize& stateSelector) -> bool
auto updatControlSelector(const MatrixDynSize& controlSelector) -> bool
auto costEvaluation(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, double& costValue) -> bool final
Evaluate the cost function.
auto costFirstPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::VectorDynSize& partialDerivative) -> bool final
Evaluate cost first partial derivative wrt the state.
auto costFirstPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::VectorDynSize& partialDerivative) -> bool final
Evaluate cost first partial derivative wrt the control variables.
auto costSecondPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate cost second partial derivative wrt the state variables.
auto costSecondPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate cost second partial derivative wrt the control.
auto costSecondPartialDerivativeWRTStateControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate cost second partial derivative wrt the state and control.
auto costSecondPartialDerivativeWRTStateSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the state hessian.
auto costSecondPartialDerivativeWRTStateControlSparsity(iDynTree::optimalcontrol::SparsityStructure& stateControlSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the mixed hessian.
auto costSecondPartialDerivativeWRTControlSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the control hessian.

Function documentation

bool iDynTree::optimalcontrol::L2NormCost::costEvaluation(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, double& costValue) final

Evaluate the cost function.

Parameters
time in The time at which the cost is evaluated.
state in The state value with which the cost has to be evaluated.
control in The control value with which the cost has to be evaluated.
costValue out The cost value given the above inputs.
Returns True if successfull, false otherwise.

bool iDynTree::optimalcontrol::L2NormCost::costFirstPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::VectorDynSize& partialDerivative) final

Evaluate cost first partial derivative wrt the state.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
control in The control value at which the partial derivative is computed.
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial g(t, x, u)}{\partial x}$

bool iDynTree::optimalcontrol::L2NormCost::costFirstPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::VectorDynSize& partialDerivative) final

Evaluate cost first partial derivative wrt the control variables.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
control in The control value at which the partial derivative is computed.
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial g(t, x, u)}{\partial u}$

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate cost second partial derivative wrt the state variables.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
control in The control value at which the partial derivative is computed.
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 g(t, x, u)}{\partial x^2}$

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate cost second partial derivative wrt the control.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
control in The control value at which the partial derivative is computed.
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 g(t, x, u)}{\partial u^2}$

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTStateControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& control, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate cost second partial derivative wrt the state and control.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
control in The control value at which the partial derivative is computed.
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 g(t, x, u)}{\partial x \partial u}$ , thus it has number of rows equals to the number of states and number of cols equal to the number of control inputs.

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTStateSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the state hessian.

Parameters
stateSparsity out Sparsity structure of the partial derivative of the gradient wrt state variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTStateControlSparsity(iDynTree::optimalcontrol::SparsityStructure& stateControlSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the mixed hessian.

Parameters
stateControlSparsity out Sparsity structure of the partial derivative of the gradient wrt state and control variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::L2NormCost::costSecondPartialDerivativeWRTControlSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the control hessian.

Parameters
controlSparsity out Sparsity structure of the partial derivative of the gradient wrt control variables.
Returns true if the sparsity is available. False otherwise.