aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
aligator::TrajOptProblemTpl< _Scalar > Struct Template Reference

Trajectory optimization problem. More...

#include <aligator/core/traj-opt-problem.hpp>

Collaboration diagram for aligator::TrajOptProblemTpl< _Scalar >:
[legend]

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< UnaryFunctioninit_condition_
 Initial condition.
 
std::vector< shared_ptr< StageModel > > stages_
 Stages of the control problem.
 
shared_ptr< CostAbstractterm_cost_
 Terminal cost.
 
ConstraintStackTpl< Scalarterm_cstrs_
 Terminal constraints.
 
VectorXs unone_
 Dummy, "neutral" control value.
 

Protected Member Functions

void checkStages () const
 Check if all stages are non-null.
 

Protected Attributes

StateErrorResidualinit_state_error_
 Pointer to underlying state error residual.
 

Detailed Description

template<typename _Scalar>
struct aligator::TrajOptProblemTpl< _Scalar >

Trajectory optimization problem.

Template Parameters
Scalarthe 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.

Member Typedef Documentation

◆ Scalar

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::Scalar = _Scalar

Definition at line 24 of file traj-opt-problem.hpp.

◆ StageModel

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::StageModel = StageModelTpl<Scalar>

Definition at line 25 of file traj-opt-problem.hpp.

◆ UnaryFunction

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::UnaryFunction = UnaryFunctionTpl<Scalar>

Definition at line 26 of file traj-opt-problem.hpp.

◆ Data

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::Data = TrajOptDataTpl<Scalar>

Definition at line 27 of file traj-opt-problem.hpp.

◆ Manifold

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::Manifold = ManifoldAbstractTpl<Scalar>

Definition at line 28 of file traj-opt-problem.hpp.

◆ CostAbstract

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::CostAbstract = CostAbstractTpl<Scalar>

Definition at line 29 of file traj-opt-problem.hpp.

◆ ConstraintType

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::ConstraintType = StageConstraintTpl<Scalar>

Definition at line 30 of file traj-opt-problem.hpp.

◆ StateErrorResidual

template<typename _Scalar >
using aligator::TrajOptProblemTpl< _Scalar >::StateErrorResidual = StateErrorResidualTpl<Scalar>

Definition at line 31 of file traj-opt-problem.hpp.

Member Function Documentation

◆ ALIGATOR_DYNAMIC_TYPEDEFS()

template<typename _Scalar >
aligator::TrajOptProblemTpl< _Scalar >::ALIGATOR_DYNAMIC_TYPEDEFS ( Scalar )

◆ initCondIsStateError()

template<typename _Scalar >
bool aligator::TrajOptProblemTpl< _Scalar >::initCondIsStateError ( ) const
inline

Definition at line 125 of file traj-opt-problem.hpp.

◆ addStage()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::addStage ( const shared_ptr< StageModel > & stage)

Add a stage to the control problem.

◆ getInitState()

template<typename _Scalar >
ConstVectorRef aligator::TrajOptProblemTpl< _Scalar >::getInitState ( ) const
inline

Get initial state constraint.

Definition at line 131 of file traj-opt-problem.hpp.

◆ setInitState()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::setInitState ( const ConstVectorRef & x0)
inline

Set initial state constraint.

Definition at line 140 of file traj-opt-problem.hpp.

◆ addTerminalConstraint()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::addTerminalConstraint ( const ConstraintType & cstr)

Add a terminal constraint for the model.

◆ removeTerminalConstraints()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::removeTerminalConstraints ( )
inline

Remove all terminal constraints.

Definition at line 151 of file traj-opt-problem.hpp.

◆ numSteps()

template<typename _Scalar >
std::size_t aligator::TrajOptProblemTpl< _Scalar >::numSteps ( ) const

◆ evaluate()

template<typename _Scalar >
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.

◆ computeDerivatives()

template<typename _Scalar >
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.

Parameters
xsState sequence
usControl sequence
prob_dataProblem data
num_threadsNumber of threads to use
compute_second_orderWhether to compute second-order derivatives

◆ replaceStageCircular()

template<typename _Scalar >
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.

◆ computeTrajectoryCost()

template<typename _Scalar >
Scalar aligator::TrajOptProblemTpl< _Scalar >::computeTrajectoryCost ( const Data & problem_data) const

Helper for computing the trajectory cost (from pre-computed problem data).

Warning
Call TrajOptProblemTpl::evaluate() first!

◆ checkIntegrity()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::checkIntegrity ( ) const
inline

Definition at line 183 of file traj-opt-problem.hpp.

◆ checkStages()

template<typename _Scalar >
void aligator::TrajOptProblemTpl< _Scalar >::checkStages ( ) const
protected

Check if all stages are non-null.

Member Data Documentation

◆ init_condition_

template<typename _Scalar >
shared_ptr<UnaryFunction> aligator::TrajOptProblemTpl< _Scalar >::init_condition_

Initial condition.

Definition at line 90 of file traj-opt-problem.hpp.

◆ stages_

template<typename _Scalar >
std::vector<shared_ptr<StageModel> > aligator::TrajOptProblemTpl< _Scalar >::stages_

Stages of the control problem.

Definition at line 92 of file traj-opt-problem.hpp.

◆ term_cost_

template<typename _Scalar >
shared_ptr<CostAbstract> aligator::TrajOptProblemTpl< _Scalar >::term_cost_

Terminal cost.

Definition at line 94 of file traj-opt-problem.hpp.

◆ term_cstrs_

template<typename _Scalar >
ConstraintStackTpl<Scalar> aligator::TrajOptProblemTpl< _Scalar >::term_cstrs_

Terminal constraints.

Definition at line 96 of file traj-opt-problem.hpp.

◆ unone_

template<typename _Scalar >
VectorXs aligator::TrajOptProblemTpl< _Scalar >::unone_

Dummy, "neutral" control value.

Definition at line 98 of file traj-opt-problem.hpp.

◆ init_state_error_

template<typename _Scalar >
StateErrorResidual* aligator::TrajOptProblemTpl< _Scalar >::init_state_error_
protected

Pointer to underlying state error residual.

Definition at line 193 of file traj-opt-problem.hpp.


The documentation for this struct was generated from the following file: