aligator
0.9.0
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 | PolyCost = xyz::polymorphic<CostBase> |
using | SumCostData = CostStackDataTpl<Scalar> |
using | Manifold = ManifoldAbstractTpl<Scalar> |
using | CostItem = std::pair<PolyCost, Scalar> |
using | CostKey = std::variant<std::size_t, std::string> |
using | CostMap = boost::unordered::unordered_map<CostKey, CostItem> |
using | CostIterator = typename CostMap::iterator |
Public Types inherited from aligator::CostAbstractTpl< _Scalar > | |
using | Scalar |
using | CostData |
using | Manifold |
Public Member Functions | |
ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
bool | checkDimension (const CostBase &comp) const |
Check the dimension of a component. | |
CostStackTpl (xyz::polymorphic< Manifold > space, const int nu, const std::vector< PolyCost > &comps={}, const std::vector< Scalar > &weights={}) | |
Constructor with a specified dimension, and optional vector of components and weights. | |
CostStackTpl (xyz::polymorphic< Manifold > space, const int nu, const CostMap &comps) | |
CostStackTpl (const PolyCost &cost) | |
Constructor from a single CostBase instance. | |
CostItem & | addCost (const PolyCost &cost, const Scalar weight=1.) |
CostItem & | addCost (const CostKey &key, const PolyCost &cost, const Scalar weight=1.) |
std::size_t | size () const |
template<typename Derived > | |
Derived * | getComponent (const CostKey &key) |
Get component, cast down to the specified type. | |
template<typename Derived > | |
const Derived * | getComponent (const CostKey &key) const |
void | evaluate (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
void | computeGradients (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
void | computeHessians (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
shared_ptr< CostData > | createData () const |
Public Member Functions inherited from aligator::CostAbstractTpl< _Scalar > | |
ALIGATOR_DYNAMIC_TYPEDEFS (_Scalar) | |
int | nx () const |
int | ndx () const |
CostAbstractTpl (U &&space, const int nu) | |
virtual void | evaluate (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Evaluate the cost function. | |
virtual void | computeGradients (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Compute the cost gradients \((\ell_x, \ell_u)\). | |
virtual void | computeHessians (const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const |
Compute the cost Hessians \((\ell_{ij})_{i,j \in \{x,u\}}\). | |
virtual | ~CostAbstractTpl ()=default |
Public Attributes | |
CostMap | components_ |
Public Attributes inherited from aligator::CostAbstractTpl< _Scalar > | |
xyz::polymorphic< 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 19 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::Scalar = _Scalar |
Definition at line 20 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostBase = CostAbstractTpl<Scalar> |
Definition at line 22 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostData = CostDataAbstractTpl<Scalar> |
Definition at line 23 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::PolyCost = xyz::polymorphic<CostBase> |
Definition at line 24 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::SumCostData = CostStackDataTpl<Scalar> |
Definition at line 25 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::Manifold = ManifoldAbstractTpl<Scalar> |
Definition at line 26 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostItem = std::pair<PolyCost, Scalar> |
Definition at line 27 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostKey = std::variant<std::size_t, std::string> |
Definition at line 28 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostMap = boost::unordered::unordered_map<CostKey, CostItem> |
Definition at line 29 of file sum-of-costs.hpp.
using aligator::CostStackTpl< _Scalar >::CostIterator = typename CostMap::iterator |
Definition at line 30 of file sum-of-costs.hpp.
aligator::CostStackTpl< _Scalar >::CostStackTpl | ( | xyz::polymorphic< Manifold > | space, |
const int | nu, | ||
const std::vector< PolyCost > & | comps = {}, | ||
const std::vector< Scalar > & | weights = {} ) |
Constructor with a specified dimension, and optional vector of components and weights.
|
inline |
Definition at line 45 of file sum-of-costs.hpp.
aligator::CostStackTpl< _Scalar >::CostStackTpl | ( | const PolyCost & | 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.
|
inline |
Definition at line 62 of file sum-of-costs.hpp.
CostItem & aligator::CostStackTpl< _Scalar >::addCost | ( | const CostKey & | key, |
const PolyCost & | cost, | ||
const Scalar | weight = 1. ) |
|
inline |
Definition at line 70 of file sum-of-costs.hpp.
|
inline |
Get component, cast down to the specified type.
Definition at line 73 of file sum-of-costs.hpp.
|
inline |
Definition at line 79 of file sum-of-costs.hpp.
void aligator::CostStackTpl< _Scalar >::evaluate | ( | const ConstVectorRef & | x, |
const ConstVectorRef & | u, | ||
CostData & | data ) const |
void aligator::CostStackTpl< _Scalar >::computeGradients | ( | const ConstVectorRef & | x, |
const ConstVectorRef & | u, | ||
CostData & | data ) const |
void aligator::CostStackTpl< _Scalar >::computeHessians | ( | const ConstVectorRef & | x, |
const ConstVectorRef & | u, | ||
CostData & | data ) const |
|
virtual |
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
CostMap aligator::CostStackTpl< _Scalar >::components_ |
Definition at line 32 of file sum-of-costs.hpp.