aligator
0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
|
Trajectory optimization problem. More...
#include <aligator/core/traj-opt-problem.hpp>
Public Types | |
using | Scalar = _Scalar |
using | StageModel = StageModelTpl<Scalar> |
using | UnaryFunction = UnaryFunctionTpl<Scalar> |
using | Data = TrajOptDataTpl<Scalar> |
using | Manifold = ManifoldAbstractTpl<Scalar> |
using | CostAbstract = CostAbstractTpl<Scalar> |
using | ConstraintType = StageConstraintTpl<Scalar> |
using | StateErrorResidual = StateErrorResidualTpl<Scalar> |
Public Member Functions | |
ALIGATOR_DYNAMIC_TYPEDEFS (Scalar) | |
TrajOptProblemTpl (shared_ptr< UnaryFunction > init_constraint, const std::vector< shared_ptr< StageModel > > &stages, shared_ptr< CostAbstract > term_cost) | |
TrajOptProblemTpl (const ConstVectorRef &x0, const std::vector< shared_ptr< StageModel > > &stages, shared_ptr< CostAbstract > term_cost) | |
Constructor for an initial value problem. | |
TrajOptProblemTpl (shared_ptr< UnaryFunction > init_constraint, shared_ptr< CostAbstract > term_cost) | |
TrajOptProblemTpl (const ConstVectorRef &x0, const int nu, shared_ptr< Manifold > space, shared_ptr< CostAbstract > term_cost) | |
Constructor for an initial value problem. | |
bool | initCondIsStateError () const |
void | addStage (const shared_ptr< StageModel > &stage) |
Add a stage to the control problem. | |
ConstVectorRef | getInitState () const |
Get initial state constraint. | |
void | setInitState (const ConstVectorRef &x0) |
Set initial state constraint. | |
void | addTerminalConstraint (const ConstraintType &cstr) |
Add a terminal constraint for the model. | |
void | removeTerminalConstraints () |
Remove all terminal constraints. | |
std::size_t | numSteps () const |
Scalar | evaluate (const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us, Data &prob_data, std::size_t num_threads=1) const |
Rollout the problem costs, constraints, dynamics, stage per stage. | |
void | computeDerivatives (const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us, Data &prob_data, std::size_t num_threads=1, bool compute_second_order=true) const |
Rollout the problem derivatives, stage per stage. | |
void | replaceStageCircular (const shared_ptr< StageModel > &model) |
Pop out the first StageModel and replace by the supplied one; updates the supplied problem data (TrajOptDataTpl) object. | |
Scalar | computeTrajectoryCost (const Data &problem_data) const |
Helper for computing the trajectory cost (from pre-computed problem data). | |
void | checkIntegrity () const |
Public Attributes | |
shared_ptr< UnaryFunction > | init_condition_ |
Initial condition. | |
std::vector< shared_ptr< StageModel > > | stages_ |
Stages of the control problem. | |
shared_ptr< CostAbstract > | term_cost_ |
Terminal cost. | |
ConstraintStackTpl< Scalar > | term_cstrs_ |
Terminal constraints. | |
VectorXs | unone_ |
Dummy, "neutral" control value. | |
Protected Member Functions | |
void | checkStages () const |
Check if all stages are non-null. | |
Protected Attributes | |
StateErrorResidual * | init_state_error_ |
Pointer to underlying state error residual. | |
Trajectory optimization problem.
Scalar | the scalar type. |
The problem can be written as a nonlinear program:
\[ \begin{aligned} \min_{\bmx,\bmu}~& \sum_{i=0}^{N-1} \ell_i(x_i, u_i) + \ell_N(x_N) \\ \subjectto & \varphi(x_i, u_i, x_{i+1}) = 0, \ 0 \leq i < N \\ & g(x_i, u_i) \in \calC_i \end{aligned} \]
Definition at line 23 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::Scalar = _Scalar |
Definition at line 24 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::StageModel = StageModelTpl<Scalar> |
Definition at line 25 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::UnaryFunction = UnaryFunctionTpl<Scalar> |
Definition at line 26 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::Data = TrajOptDataTpl<Scalar> |
Definition at line 27 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::Manifold = ManifoldAbstractTpl<Scalar> |
Definition at line 28 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::CostAbstract = CostAbstractTpl<Scalar> |
Definition at line 29 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::ConstraintType = StageConstraintTpl<Scalar> |
Definition at line 30 of file traj-opt-problem.hpp.
using aligator::TrajOptProblemTpl< _Scalar >::StateErrorResidual = StateErrorResidualTpl<Scalar> |
Definition at line 31 of file traj-opt-problem.hpp.
aligator::TrajOptProblemTpl< _Scalar >::ALIGATOR_DYNAMIC_TYPEDEFS | ( | Scalar | ) |
|
inline |
Definition at line 125 of file traj-opt-problem.hpp.
void aligator::TrajOptProblemTpl< _Scalar >::addStage | ( | const shared_ptr< StageModel > & | stage | ) |
Add a stage to the control problem.
|
inline |
Get initial state constraint.
Definition at line 131 of file traj-opt-problem.hpp.
|
inline |
Set initial state constraint.
Definition at line 140 of file traj-opt-problem.hpp.
void aligator::TrajOptProblemTpl< _Scalar >::addTerminalConstraint | ( | const ConstraintType & | cstr | ) |
Add a terminal constraint for the model.
|
inline |
Remove all terminal constraints.
Definition at line 151 of file traj-opt-problem.hpp.
std::size_t aligator::TrajOptProblemTpl< _Scalar >::numSteps | ( | ) | const |
Scalar aligator::TrajOptProblemTpl< _Scalar >::evaluate | ( | const std::vector< VectorXs > & | xs, |
const std::vector< VectorXs > & | us, | ||
Data & | prob_data, | ||
std::size_t | num_threads = 1 ) const |
Rollout the problem costs, constraints, dynamics, stage per stage.
void aligator::TrajOptProblemTpl< _Scalar >::computeDerivatives | ( | const std::vector< VectorXs > & | xs, |
const std::vector< VectorXs > & | us, | ||
Data & | prob_data, | ||
std::size_t | num_threads = 1, | ||
bool | compute_second_order = true ) const |
Rollout the problem derivatives, stage per stage.
xs | State sequence |
us | Control sequence |
prob_data | Problem data |
num_threads | Number of threads to use |
compute_second_order | Whether to compute second-order derivatives |
void aligator::TrajOptProblemTpl< _Scalar >::replaceStageCircular | ( | const shared_ptr< StageModel > & | model | ) |
Pop out the first StageModel and replace by the supplied one; updates the supplied problem data (TrajOptDataTpl) object.
Scalar aligator::TrajOptProblemTpl< _Scalar >::computeTrajectoryCost | ( | const Data & | problem_data | ) | const |
Helper for computing the trajectory cost (from pre-computed problem data).
|
inline |
Definition at line 183 of file traj-opt-problem.hpp.
|
protected |
Check if all stages are non-null.
shared_ptr<UnaryFunction> aligator::TrajOptProblemTpl< _Scalar >::init_condition_ |
Initial condition.
Definition at line 90 of file traj-opt-problem.hpp.
std::vector<shared_ptr<StageModel> > aligator::TrajOptProblemTpl< _Scalar >::stages_ |
Stages of the control problem.
Definition at line 92 of file traj-opt-problem.hpp.
shared_ptr<CostAbstract> aligator::TrajOptProblemTpl< _Scalar >::term_cost_ |
Terminal cost.
Definition at line 94 of file traj-opt-problem.hpp.
ConstraintStackTpl<Scalar> aligator::TrajOptProblemTpl< _Scalar >::term_cstrs_ |
Terminal constraints.
Definition at line 96 of file traj-opt-problem.hpp.
VectorXs aligator::TrajOptProblemTpl< _Scalar >::unone_ |
Dummy, "neutral" control value.
Definition at line 98 of file traj-opt-problem.hpp.
|
protected |
Pointer to underlying state error residual.
Definition at line 193 of file traj-opt-problem.hpp.