aligator  0.12.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
 
Loading...
Searching...
No Matches
dynamics.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#include "aligator/fwd.hpp"
6#include <proxsuite-nlp/third-party/polymorphic_cxx14.hpp>
7
8namespace aligator {
14template <typename _Scalar> struct DynamicsModelTpl {
15 using Scalar = _Scalar;
18 using Manifold = ManifoldAbstractTpl<Scalar>;
19
21 xyz::polymorphic<Manifold> space_;
23 xyz::polymorphic<Manifold> space_next_;
25 const int ndx1;
27 const int nu;
29 const int ndx2;
30
32 const Manifold &space() const { return *space_; }
34 const Manifold &space_next() const { return *space_next_; }
36 virtual bool isExplicit() const { return false; }
37
38 inline int nx1() const { return space_->nx(); }
39 inline int nx2() const { return space_next_->nx(); }
40
47 DynamicsModelTpl(xyz::polymorphic<Manifold> space, const int nu);
48
56 DynamicsModelTpl(xyz::polymorphic<Manifold> space, const int nu,
57 xyz::polymorphic<Manifold> space_next);
59 virtual void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
60 const ConstVectorRef &xn, Data &) const = 0;
62 virtual void computeJacobians(const ConstVectorRef &x,
63 const ConstVectorRef &u,
64 const ConstVectorRef &xn, Data &) const = 0;
66 virtual void computeVectorHessianProducts(const ConstVectorRef &x,
67 const ConstVectorRef &u,
68 const ConstVectorRef &xn,
69 const ConstVectorRef &lbda,
70 Data &data) const;
71
72 virtual shared_ptr<Data> createData() const;
73
74 virtual ~DynamicsModelTpl() = default;
75};
76
77template <typename _Scalar> struct DynamicsDataTpl {
78 using Scalar = _Scalar;
80
81 const int ndx1;
82 const int nu;
83 const int ndx2;
85 const int nvar = ndx1 + nu + ndx2;
86
88 VectorXs value_;
89 VectorRef valref_;
91 MatrixXs jac_buffer_;
93 MatrixRef Jx_;
95 MatrixRef Ju_;
97 MatrixRef Jy_;
98
99 /* Vector-Hessian product buffers */
100
101 MatrixXs Hxx_;
102 MatrixXs Hxu_;
103 MatrixXs Hxy_;
104 MatrixXs Huu_;
105 MatrixXs Huy_;
106 MatrixXs Hyy_;
107
109 DynamicsDataTpl(const int ndx1, const int nu, const int ndx2);
110 virtual ~DynamicsDataTpl() = default;
111};
112
113} // namespace aligator
114
115#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
116#include "aligator/core/dynamics.txx"
117#endif
Forward declarations.
Main package namespace.
DynamicsDataTpl(const int ndx1, const int nu, const int ndx2)
virtual ~DynamicsDataTpl()=default
DynamicsDataTpl(const DynamicsModelTpl< Scalar > &model)
Dynamics model: describes system dynamics through an implicit relation .
Definition dynamics.hpp:14
const Manifold & space() const
State space for the input.
Definition dynamics.hpp:32
ManifoldAbstractTpl< Scalar > Manifold
Definition dynamics.hpp:18
virtual shared_ptr< Data > createData() const
xyz::polymorphic< Manifold > space_
Definition dynamics.hpp:21
DynamicsModelTpl(xyz::polymorphic< Manifold > space, const int nu, xyz::polymorphic< Manifold > space_next)
Constructor for dynamics. This constructor assumes same dimension for the current and next state.
virtual bool isExplicit() const
Check if this dynamics model is implicit or explicit.
Definition dynamics.hpp:36
virtual void computeJacobians(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, Data &) const =0
xyz::polymorphic< Manifold > space_next_
Definition dynamics.hpp:23
DynamicsDataTpl< Scalar > Data
Definition dynamics.hpp:17
virtual void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, Data &) const =0
const Manifold & space_next() const
State space for the output of this dynamics model.
Definition dynamics.hpp:34
virtual ~DynamicsModelTpl()=default
DynamicsModelTpl(xyz::polymorphic< Manifold > space, const int nu)
Constructor for dynamics.
virtual void computeVectorHessianProducts(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, const ConstVectorRef &lbda, Data &data) const