|
aligator
0.16.0
A versatile and efficient C++ library for real-time constrained 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 = _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 (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 |
| Get component, cast down to the specified type. | |
| Scalar | getWeight (const CostKey &key) const |
| Get weight for a given component. | |
| Scalar & | getWeight (const CostKey &key) |
| Get weight for a given component. | |
| CostStackTpl & | setWeight (const CostKey &key, const Scalar value) |
| Set the weight for a given component. | |
| 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 |
Public Member Functions inherited from aligator::CostAbstractTpl< _Scalar > | |
| ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
| int | nx () const |
| int | ndx () const |
| template<class U> | |
| CostAbstractTpl (U &&space, const int nu) | |
| 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 63 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 71 of file sum-of-costs.hpp.
|
inline |
Get component, cast down to the specified type.
Definition at line 74 of file sum-of-costs.hpp.
|
inline |
Get component, cast down to the specified type.
Definition at line 81 of file sum-of-costs.hpp.
|
inline |
Get weight for a given component.
Definition at line 87 of file sum-of-costs.hpp.
|
inline |
Get weight for a given component.
Definition at line 94 of file sum-of-costs.hpp.
|
inline |
Set the weight for a given component.
Definition at line 101 of file sum-of-costs.hpp.
|
virtual |
Evaluate the cost function.
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Compute the cost gradients \((\ell_x, \ell_u)\).
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Compute the cost Hessians \((\ell_{ij})_{i,j \in \{x,u\}}\).
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
|
virtual |
Reimplemented from aligator::CostAbstractTpl< _Scalar >.
| CostMap aligator::CostStackTpl< _Scalar >::components_ |
Definition at line 32 of file sum-of-costs.hpp.