iDynTree::optimalcontrol::QuadraticLikeCost class

Base classes

class Cost
The Cost virtual class definition.

Derived classes

class LinearCost
class QuadraticCost

Constructors, destructors, conversion operators

~QuadraticLikeCost() override
QuadraticLikeCost(const std::string& costName) protected

Public functions

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.

Protected variables

std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingMatrix> m_timeVaryingStateHessian
std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingVector> m_timeVaryingStateGradient
std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingDouble> m_timeVaryingStateCostBias
std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingMatrix> m_timeVaryingControlHessian
std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingVector> m_timeVaryingControlGradient
std::shared_ptr<iDynTree::optimalcontrol::TimeVaryingDouble> m_timeVaryingControlCostBias
bool m_hasSecondPartialDerivativeWRTStateSparsity
bool m_hasSecondPartialDerivativeWRTControlSparsity
bool m_hasSecondPartialDerivativeWRTStateControlSparsity
SparsityStructure m_secondPartialDerivativeWRTStateSparsity
SparsityStructure m_secondPartialDerivativeWRTControlSparsity
SparsityStructure m_secondPartialDerivativeWRTStateControlSparsity

Function documentation

bool iDynTree::optimalcontrol::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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::QuadraticLikeCost::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.