aligator
0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
|
A stage in the control problem. More...
#include <aligator/core/stage-model.hpp>
Public Types | |
using | Scalar = _Scalar |
using | Manifold = ManifoldAbstractTpl<Scalar> |
using | PolyManifold = xyz::polymorphic<Manifold> |
using | Dynamics = DynamicsModelTpl<Scalar> |
using | PolyDynamics = xyz::polymorphic<Dynamics> |
using | PolyFunction = xyz::polymorphic<StageFunctionTpl<Scalar>> |
using | PolyConstraintSet = xyz::polymorphic<ConstraintSetTpl<Scalar>> |
using | Cost = CostAbstractTpl<Scalar> |
using | PolyCost = xyz::polymorphic<Cost> |
using | StageConstraint = StageConstraintTpl<Scalar> |
using | Data = StageDataTpl<Scalar> |
Public Member Functions | |
ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
template<typename U > | |
U * | getCost () |
Get a pointer to an expected concrete type for the cost function. | |
template<typename U > | |
const U * | getCost () const |
template<typename U > | |
U * | getDynamics () |
Get a pointer to an expected concrete type for the dynamics class. | |
template<typename U > | |
const U * | getDynamics () const |
StageModelTpl (const PolyCost &cost, const PolyDynamics &dynamics) | |
virtual | ~StageModelTpl ()=default |
const Manifold & | xspace () const |
const Manifold & | uspace () const |
const Manifold & | xspace_next () const |
const Cost & | cost () const |
virtual bool | hasDynModel () const |
int | nx1 () const |
int | ndx1 () const |
int | nu () const |
int | nx2 () const |
int | ndx2 () const |
int | nc () const |
Total number of constraints. | |
std::size_t | numConstraints () const |
Number of constraint objects. | |
int | numPrimal () const |
Number of primal optimization variables. | |
int | numDual () const |
Number of dual variables, i.e. Lagrange multipliers. | |
template<typename Cstr , typename = std::enable_if_t<std::is_same_v< std::decay_t<Cstr>, StageConstraint>>> | |
ALIGATOR_DEPRECATED void | addConstraint (Cstr &&cstr) |
Add a constraint to the stage. | |
void | addConstraint (const PolyFunction &func, const PolyConstraintSet &cstr_set) |
Add a constraint to the stage. | |
virtual void | evaluate (const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const |
Evaluate all the functions (cost, dynamics, constraints) at this node. | |
virtual void | computeFirstOrderDerivatives (const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const |
Compute the first-order derivatives of the StageModelTpl. | |
virtual void | computeSecondOrderDerivatives (const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const |
Compute the second-order derivatives of the StageModelTpl. | |
virtual shared_ptr< Data > | createData () const |
Create a StageData object. | |
template<typename Cstr , typename > | |
void | addConstraint (Cstr &&cstr) |
Public Attributes | |
PolyManifold | xspace_ |
State space for the current state \(x_k\). | |
PolyManifold | xspace_next_ |
State space for the next state \(x_{k+1}\). | |
PolyManifold | uspace_ |
Control vector space – by default, a simple Euclidean space. | |
ConstraintStackTpl< Scalar > | constraints_ |
Constraint manager. | |
PolyCost | cost_ |
Stage cost function. | |
PolyDynamics | dynamics_ |
Dynamics model. | |
Friends | |
std::ostream & | operator<< (std::ostream &oss, const StageModelTpl &stage) |
A stage in the control problem.
Each stage containts cost functions, dynamical and constraint models. These objects are hold through smart pointers to leverage dynamic polymorphism.
using aligator::StageModelTpl< Scalar >::Scalar = _Scalar |
Definition at line 26 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::Manifold = ManifoldAbstractTpl<Scalar> |
Definition at line 29 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::PolyManifold = xyz::polymorphic<Manifold> |
Definition at line 30 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::Dynamics = DynamicsModelTpl<Scalar> |
Definition at line 31 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::PolyDynamics = xyz::polymorphic<Dynamics> |
Definition at line 32 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::PolyFunction = xyz::polymorphic<StageFunctionTpl<Scalar>> |
Definition at line 33 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::PolyConstraintSet = xyz::polymorphic<ConstraintSetTpl<Scalar>> |
Definition at line 34 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::Cost = CostAbstractTpl<Scalar> |
Definition at line 35 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::PolyCost = xyz::polymorphic<Cost> |
Definition at line 36 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::StageConstraint = StageConstraintTpl<Scalar> |
Definition at line 39 of file stage-model.hpp.
using aligator::StageModelTpl< Scalar >::Data = StageDataTpl<Scalar> |
Definition at line 41 of file stage-model.hpp.
aligator::StageModelTpl< Scalar >::StageModelTpl | ( | const PolyCost & | cost, |
const PolyDynamics & | dynamics ) |
Constructor assumes the control space is a Euclidean space of dimension nu
.
|
virtualdefault |
aligator::StageModelTpl< Scalar >::ALIGATOR_DYNAMIC_TYPEDEFS | ( | Scalar | ) |
|
inline |
Get a pointer to an expected concrete type for the cost function.
Definition at line 57 of file stage-model.hpp.
|
inline |
Definition at line 63 of file stage-model.hpp.
|
inline |
Get a pointer to an expected concrete type for the dynamics class.
Definition at line 69 of file stage-model.hpp.
|
inline |
Definition at line 75 of file stage-model.hpp.
|
inline |
Definition at line 85 of file stage-model.hpp.
|
inline |
Definition at line 86 of file stage-model.hpp.
|
inline |
Definition at line 87 of file stage-model.hpp.
|
inline |
Definition at line 89 of file stage-model.hpp.
|
inlinevirtual |
Whether the stage's dynamics model can be accessed. This boolean allows flexibility in solvers when dealing with different frontends e.g. Crocoddyl's API.
Reimplemented in aligator::compat::croc::ActionModelWrapperTpl< Scalar >.
Definition at line 93 of file stage-model.hpp.
|
inline |
Definition at line 95 of file stage-model.hpp.
|
inline |
Definition at line 96 of file stage-model.hpp.
|
inline |
Definition at line 97 of file stage-model.hpp.
|
inline |
Definition at line 98 of file stage-model.hpp.
|
inline |
Definition at line 99 of file stage-model.hpp.
|
inline |
Total number of constraints.
Definition at line 101 of file stage-model.hpp.
|
inline |
Number of constraint objects.
Definition at line 104 of file stage-model.hpp.
|
inline |
Number of primal optimization variables.
Definition at line 107 of file stage-model.hpp.
|
inline |
Number of dual variables, i.e. Lagrange multipliers.
Definition at line 109 of file stage-model.hpp.
ALIGATOR_DEPRECATED void aligator::StageModelTpl< Scalar >::addConstraint | ( | Cstr && | cstr | ) |
Add a constraint to the stage.
void aligator::StageModelTpl< Scalar >::addConstraint | ( | const PolyFunction & | func, |
const PolyConstraintSet & | cstr_set ) |
Add a constraint to the stage.
Adds a constraint by allocating a new StageConstraintTpl.
|
virtual |
Evaluate all the functions (cost, dynamics, constraints) at this node.
Reimplemented in aligator::compat::croc::ActionModelWrapperTpl< Scalar >.
|
virtual |
Compute the first-order derivatives of the StageModelTpl.
Reimplemented in aligator::compat::croc::ActionModelWrapperTpl< Scalar >.
|
virtual |
Compute the second-order derivatives of the StageModelTpl.
Reimplemented in aligator::compat::croc::ActionModelWrapperTpl< Scalar >.
|
virtual |
Create a StageData object.
Reimplemented in aligator::compat::croc::ActionModelWrapperTpl< Scalar >.
void aligator::StageModelTpl< Scalar >::addConstraint | ( | Cstr && | cstr | ) |
Definition at line 166 of file stage-model.hpp.
|
friend |
Definition at line 142 of file stage-model.hpp.
PolyManifold aligator::StageModelTpl< Scalar >::xspace_ |
State space for the current state \(x_k\).
Definition at line 44 of file stage-model.hpp.
PolyManifold aligator::StageModelTpl< Scalar >::xspace_next_ |
State space for the next state \(x_{k+1}\).
Definition at line 46 of file stage-model.hpp.
PolyManifold aligator::StageModelTpl< Scalar >::uspace_ |
Control vector space – by default, a simple Euclidean space.
Definition at line 48 of file stage-model.hpp.
ConstraintStackTpl<Scalar> aligator::StageModelTpl< Scalar >::constraints_ |
Constraint manager.
Definition at line 50 of file stage-model.hpp.
PolyCost aligator::StageModelTpl< Scalar >::cost_ |
Stage cost function.
Definition at line 52 of file stage-model.hpp.
PolyDynamics aligator::StageModelTpl< Scalar >::dynamics_ |
Dynamics model.
Definition at line 54 of file stage-model.hpp.