aligator
0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
|
Weighted sum of multiple cost components. More...
#include <aligator/modelling/costs/sum-of-costs.hpp>
Public Types | |
using | Scalar = _Scalar |
using | CostBase = CostAbstractTpl<Scalar> |
using | CostData = CostDataAbstractTpl<Scalar> |
using | CostPtr = shared_ptr<CostBase> |
using | SumCostData = CostStackDataTpl<Scalar> |
using | Manifold = ManifoldAbstractTpl<Scalar> |
![]() | |
using | Scalar = _Scalar |
using | CostData = CostDataAbstractTpl<Scalar> |
using | Manifold = ManifoldAbstractTpl<Scalar> |
Public Member Functions | |
ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
bool | checkDimension (const CostBase *comp) const |
Check the dimension of a component. | |
CostStackTpl (shared_ptr< Manifold > space, const int nu, const std::vector< CostPtr > &comps={}, const std::vector< Scalar > &weights={}) | |
Constructor with a specified dimension, and optional vector of components and weights. | |
CostStackTpl (const CostPtr &cost) | |
Constructor from a single CostBase instance. | |
void | addCost (const CostPtr &cost, const Scalar weight=1.) |
std::size_t | size () const |
void | evaluate (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Evaluate the cost function. | |
void | computeGradients (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Compute the cost gradients \((\ell_x, \ell_u)\). | |
void | computeHessians (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Compute the cost Hessians \((\ell_{ij})_{i,j \in \{x,u\}}\). | |
shared_ptr< CostData > | createData () const |
![]() | |
ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
int | nx () const |
int | ndx () const |
CostAbstractTpl (shared_ptr< Manifold > space, const int nu) | |
virtual | ~CostAbstractTpl ()=default |
Public Attributes | |
std::vector< CostPtr > | components_ |
std::vector< Scalar > | weights_ |
![]() | |
shared_ptr< Manifold > | space |
State dimension. | |
int | nu |
Control dimension. | |
Weighted sum of multiple cost components.
This is expressed as
\[ \ell(x, u) = \sum_{k=1}^{K} \ell^{(k)}(x, u). \]
Definition at line 16 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::Scalar = _Scalar |
Definition at line 17 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostBase = CostAbstractTpl<Scalar> |
Definition at line 19 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostData = CostDataAbstractTpl<Scalar> |
Definition at line 20 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostPtr = shared_ptr<CostBase> |
Definition at line 21 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::SumCostData = CostStackDataTpl<Scalar> |
Definition at line 22 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::Manifold = ManifoldAbstractTpl<Scalar> |
Definition at line 23 of file sum-of-costs.hpp.
aligator::CostStackTpl< _Scalar >::CostStackTpl | ( | shared_ptr< Manifold > | space, |
const int | nu, | ||
const std::vector< CostPtr > & | comps = {}, | ||
const std::vector< Scalar > & | weights = {} ) |
Constructor with a specified dimension, and optional vector of components and weights.
aligator::CostStackTpl< _Scalar >::CostStackTpl | ( | const CostPtr & | cost | ) |
Constructor from a single CostBase instance.
aligator::CostStackTpl< _Scalar >::ALIGATOR_DYNAMIC_TYPEDEFS | ( | Scalar | ) |
bool aligator::CostStackTpl< _Scalar >::checkDimension | ( | const CostBase * | comp | ) | const |
Check the dimension of a component.
void aligator::CostStackTpl< _Scalar >::addCost | ( | const CostPtr & | cost, |
const Scalar | weight = 1. ) |
std::size_t aligator::CostStackTpl< _Scalar >::size | ( | ) | const |
|
virtual |
Evaluate the cost function.
Implements aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Compute the cost gradients \((\ell_x, \ell_u)\).
Implements aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Compute the cost Hessians \((\ell_{ij})_{i,j \in \{x,u\}}\).
Implements aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
std::vector<CostPtr> aligator::CostStackTpl< _Scalar >::components_ |
Definition at line 25 of file sum-of-costs.hpp.
std::vector<Scalar> aligator::CostStackTpl< _Scalar >::weights_ |
Definition at line 26 of file sum-of-costs.hpp.