robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::STOCostFunction Class Reference

Stack of the cost function of the switching time optimization (STO) problem. Composed by cost function components that inherits STOCostFunctionComponentBase. More...

#include <sto_cost_function.hpp>

Public Types

using STOCostFunctionComponentBasePtr = std::shared_ptr< STOCostFunctionComponentBase >
 

Public Member Functions

 STOCostFunction ()
 Default constructor. More...
 
 ~STOCostFunction ()=default
 Default destructor. More...
 
 STOCostFunction (const STOCostFunction &)=default
 Default copy constructor. More...
 
STOCostFunctionoperator= (const STOCostFunction &)=default
 Default copy operator. More...
 
 STOCostFunction (STOCostFunction &&) noexcept=default
 Default move constructor. More...
 
STOCostFunctionoperator= (STOCostFunction &&) noexcept=default
 Default move assign operator. More...
 
bool exist (const std::string &name) const
 Checks if thsi has a STO cost function component of the specified name. More...
 
void add (const std::string &name, const STOCostFunctionComponentBasePtr &cost)
 Adds a STO cost function component. If a component of the same name exists, throws an exeption. More...
 
void erase (const std::string &name)
 Erases a STO cost function component. If a component of the specified name does not exist, throws an exeption. More...
 
STOCostFunctionComponentBasePtr get (const std::string &name) const
 Gets a STO cost function component. If a component of the specified name does not exist, throws an exeption. More...
 
void clear ()
 Clear cost function by removing all components. More...
 
double evalCost (const TimeDiscretization &time_discretization) const
 Computes the cost on the switching times. More...
 
double linearizeCost (const TimeDiscretization &time_discretization, Eigen::VectorXd &lt) const
 Computes the cost and its derivative on the switching times. More...
 
double quadratizeCost (const TimeDiscretization &time_discretization, Eigen::VectorXd &lt, Eigen::MatrixXd &Qtt) const
 Computes the cost and its derivative on the switching times. More...
 

Detailed Description

Stack of the cost function of the switching time optimization (STO) problem. Composed by cost function components that inherits STOCostFunctionComponentBase.

Member Typedef Documentation

◆ STOCostFunctionComponentBasePtr

Constructor & Destructor Documentation

◆ STOCostFunction() [1/3]

robotoc::STOCostFunction::STOCostFunction ( )

Default constructor.

◆ ~STOCostFunction()

robotoc::STOCostFunction::~STOCostFunction ( )
default

Default destructor.

◆ STOCostFunction() [2/3]

robotoc::STOCostFunction::STOCostFunction ( const STOCostFunction )
default

Default copy constructor.

◆ STOCostFunction() [3/3]

robotoc::STOCostFunction::STOCostFunction ( STOCostFunction &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ add()

void robotoc::STOCostFunction::add ( const std::string &  name,
const STOCostFunctionComponentBasePtr cost 
)

Adds a STO cost function component. If a component of the same name exists, throws an exeption.

Parameters
[in]nameName of the STO cost function component.
[in]costshared pointer to the STO cost function component.

◆ clear()

void robotoc::STOCostFunction::clear ( )

Clear cost function by removing all components.

◆ erase()

void robotoc::STOCostFunction::erase ( const std::string &  name)

Erases a STO cost function component. If a component of the specified name does not exist, throws an exeption.

Parameters
[in]nameName of the STO cost function component.

◆ evalCost()

double robotoc::STOCostFunction::evalCost ( const TimeDiscretization time_discretization) const

Computes the cost on the switching times.

Parameters
[in]time_discretizationTime discretization.
Returns
Cost on the switching times.

◆ exist()

bool robotoc::STOCostFunction::exist ( const std::string &  name) const

Checks if thsi has a STO cost function component of the specified name.

Parameters
[in]nameName of the STO cost function component.
Returns
treu if a STO cost function component of the specified name exists.

◆ get()

STOCostFunctionComponentBasePtr robotoc::STOCostFunction::get ( const std::string &  name) const

Gets a STO cost function component. If a component of the specified name does not exist, throws an exeption.

Parameters
[in]nameName of the STO cost function component.
Returns
Shared ptr to the specified STO cost function component.

◆ linearizeCost()

double robotoc::STOCostFunction::linearizeCost ( const TimeDiscretization time_discretization,
Eigen::VectorXd &  lt 
) const

Computes the cost and its derivative on the switching times.

Parameters
[in]time_discretizationTime discretization.
[in,out]ltThe derivatives of the Lagrangian w.r.t. the switching times.

◆ operator=() [1/2]

STOCostFunction & robotoc::STOCostFunction::operator= ( const STOCostFunction )
default

Default copy operator.

◆ operator=() [2/2]

STOCostFunction & robotoc::STOCostFunction::operator= ( STOCostFunction &&  )
defaultnoexcept

Default move assign operator.

◆ quadratizeCost()

double robotoc::STOCostFunction::quadratizeCost ( const TimeDiscretization time_discretization,
Eigen::VectorXd &  lt,
Eigen::MatrixXd &  Qtt 
) const

Computes the cost and its derivative on the switching times.

Parameters
[in]time_discretizationTime discretization.
[in,out]ltThe derivatives of the Lagrangian w.r.t. the switching times.
[in,out]QttThe Hessian of the Lagrangian w.r.t. the switching times.

The documentation for this class was generated from the following file: