aligator  0.9.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
2#pragma once
3
6
8
11
13
14#include "proxsuite-nlp/python/polymorphic.hpp"
15
16namespace aligator {
17namespace python {
25template <class Base = context::DynamicsModel>
26struct PyDynamics final
27 : Base,
28 proxsuite::nlp::python::PolymorphicWrapper<PyDynamics<Base>, Base> {
29 using Scalar = typename Base::Scalar;
31 using Base::Base;
33
34 void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
35 const ConstVectorRef &y, Data &data) const override {
36 ALIGATOR_PYTHON_OVERRIDE_PURE(void, "evaluate", x, u, y, boost::ref(data));
37 }
38
39 void computeJacobians(const ConstVectorRef &x, const ConstVectorRef &u,
40 const ConstVectorRef &y, Data &data) const override {
41 ALIGATOR_PYTHON_OVERRIDE_PURE(void, "computeJacobians", x, u, y,
42 boost::ref(data));
43 }
44
45 void computeVectorHessianProducts(const ConstVectorRef &x,
46 const ConstVectorRef &u,
47 const ConstVectorRef &y,
48 const ConstVectorRef &lbda,
49 Data &data) const override {
51 lbda, boost::ref(data));
52 }
53
54 shared_ptr<Data> createData() const override {
55 ALIGATOR_PYTHON_OVERRIDE(shared_ptr<Data>, Base, createData, );
56 }
57
58 shared_ptr<Data> default_createData() const { return Base::createData(); }
59};
60
61} // namespace python
62} // namespace aligator
63
64namespace boost::python::objects {
65
66template <>
67struct value_holder<aligator::python::PyDynamics<>>
68 : proxsuite::nlp::python::OwningNonOwningHolder<
69 aligator::python::PyDynamics<>> {
70 using OwningNonOwningHolder::OwningNonOwningHolder;
71};
72
73template <>
74struct value_holder<
75 aligator::python::PyDynamics<aligator::context::IntegratorAbstract>>
76 : proxsuite::nlp::python::OwningNonOwningHolder<
77 aligator::python::PyDynamics<aligator::context::IntegratorAbstract>> {
78 using OwningNonOwningHolder::OwningNonOwningHolder;
79};
80
81} // namespace boost::python::objects
#define ALIGATOR_PYTHON_OVERRIDE(ret_type, cname, fname,...)
Define the body of a virtual function override. This is meant to reduce boilerplate code when exposin...
Definition macros.hpp:45
#define ALIGATOR_PYTHON_OVERRIDE_PURE(ret_type, pyname,...)
Define the body of a virtual function override. This is meant to reduce boilerplate code when exposin...
Definition macros.hpp:37
Base definitions for numerical integrators.
Main package namespace.
typename Base::Scalar Scalar
Definition dynamics.hpp:29
shared_ptr< Data > createData() const override
Definition dynamics.hpp:54
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const override
Definition dynamics.hpp:34
void computeVectorHessianProducts(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &y, const ConstVectorRef &lbda, Data &data) const override
Definition dynamics.hpp:45
void computeJacobians(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const override
Definition dynamics.hpp:39
shared_ptr< Data > default_createData() const
Definition dynamics.hpp:58