aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-unary-functions.cpp
Go to the documentation of this file.
1
4
6
7namespace aligator {
8namespace python {
9using context::ConstMatrixRef;
10using context::ConstVectorRef;
14using PolyUnaryFunction = xyz::polymorphic<UnaryFunction>;
15
19 proxsuite::nlp::python::register_polymorphic_to_python<PolyUnaryFunction>();
20 using unary_eval_t = void (UnaryFunction::*)(const ConstVectorRef &,
21 StageFunctionData &) const;
22 using full_eval_t =
23 void (UnaryFunction::*)(const ConstVectorRef &, const ConstVectorRef &,
24 StageFunctionData &) const;
25 using unary_vhp_t =
26 void (UnaryFunction::*)(const ConstVectorRef &, const ConstVectorRef &,
27 StageFunctionData &) const;
28 using full_vhp_t =
29 void (UnaryFunction::*)(const ConstVectorRef &, const ConstVectorRef &,
30 const ConstVectorRef &, StageFunctionData &)
31 const;
32 bp::class_<PyUnaryFunction<>, bp::bases<StageFunction>, boost::noncopyable>(
33 "UnaryFunction",
34 "Base class for unary functions of the form :math:`x \\mapsto f(x)`.",
35 bp::no_init)
36 .def(bp::init<const int, const int, const int>(
37 ("self"_a, "ndx1", "nu", "nr")))
38 .def("evaluate", bp::pure_virtual<unary_eval_t>(&UnaryFunction::evaluate),
39 ("self"_a, "x", "data"))
40 .def<full_eval_t>("evaluate", &UnaryFunction::evaluate,
41 ("self"_a, "x", "u", "data"))
42 .def("computeJacobians",
43 bp::pure_virtual<unary_eval_t>(&UnaryFunction::computeJacobians),
44 ("self"_a, "x", "data"))
45 .def<full_eval_t>("computeJacobians", &UnaryFunction::computeJacobians,
46 ("self"_a, "x", "u", "data"))
47 .def<unary_vhp_t>(
48 "computeVectorHessianProducts",
49 &UnaryFunction::computeVectorHessianProducts,
51 ("self"_a, "x", "lbda", "data"))
52 .def<full_vhp_t>("computeVectorHessianProducts",
53 &UnaryFunction::computeVectorHessianProducts,
54 ("self"_a, "x", "u", "lbda", "data"))
55 .def(unary_visitor)
57 .def(CreateDataPolymorphicPythonVisitor<UnaryFunction,
59}
60
61} // namespace python
62} // namespace aligator
StageFunctionTpl< Scalar > StageFunction
Definition context.hpp:16
UnaryFunctionTpl< Scalar > UnaryFunction
Definition context.hpp:17
StageFunctionDataTpl< Scalar > StageFunctionData
Definition context.hpp:18
xyz::polymorphic< UnaryFunction > PolyUnaryFunction
const PolymorphicMultiBaseVisitor< UnaryFunction, StageFunction > unary_visitor
void exposeUnaryFunctions()
Expose the UnaryFunction type and its member function overloads.
Main package namespace.