aligator  0.10.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);
58
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;
65
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 DynamicsModelTpl< Scalar > &model)
MatrixXs jac_buffer_
Full Jacobian.
Definition dynamics.hpp:91
MatrixRef Jx_
Jacobian with respect to .
Definition dynamics.hpp:93
virtual ~DynamicsDataTpl()=default
MatrixRef Jy_
Jacobian with respect to .
Definition dynamics.hpp:97
VectorXs value_
Function value.
Definition dynamics.hpp:88
DynamicsDataTpl(const int ndx1, const int nu, const int ndx2)
MatrixRef Ju_
Jacobian with respect to .
Definition dynamics.hpp:95
const int nvar
Total number of variables.
Definition dynamics.hpp:85
Dynamics model: describes system dynamics through an implicit relation .
Definition fwd.hpp:68
const int ndx1
State space dimension.
Definition dynamics.hpp:25
virtual void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, Data &) const =0
DynamicsDataTpl< Scalar > Data
Definition dynamics.hpp:17
const Manifold & space() const
State space for the input.
Definition dynamics.hpp:32
virtual void computeJacobians(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, Data &) const =0
virtual bool isExplicit() const
Check if this dynamics model is implicit or explicit.
Definition dynamics.hpp:36
DynamicsModelTpl(xyz::polymorphic< Manifold > space, const int nu)
Constructor for dynamics.
const int ndx2
Next state space dimension.
Definition dynamics.hpp:29
virtual void computeVectorHessianProducts(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &xn, const ConstVectorRef &lbda, Data &data) const
xyz::polymorphic< Manifold > space_next_
State space for the output of this dynamics model.
Definition dynamics.hpp:23
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.
const Manifold & space_next() const
State space for the output of this dynamics model.
Definition dynamics.hpp:34
virtual shared_ptr< Data > createData() const
virtual ~DynamicsModelTpl()=default
xyz::polymorphic< Manifold > space_
State space for the input.
Definition dynamics.hpp:21
const int nu
Control dimension.
Definition dynamics.hpp:27
ManifoldAbstractTpl< Scalar > Manifold
Definition dynamics.hpp:18