aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-constraint.cpp
Go to the documentation of this file.
2
4#include <proxsuite-nlp/python/polymorphic.hpp>
5#include <proxsuite-nlp/constraint-base.hpp>
6#include <eigenpy/deprecation-policy.hpp>
7
8namespace aligator {
9namespace python {
10using PolyFunc = xyz::polymorphic<context::StageFunction>;
11using PolySet = xyz::polymorphic<context::ConstraintSet>;
12
13context::StageConstraint *make_constraint_wrap(const PolyFunc &f,
14 const PolySet &c) {
15 return new context::StageConstraint{f, c};
16}
17
21 using context::StageConstraint;
23
24 bp::class_<StageConstraint>(
25 "StageConstraint",
26 "A stage-wise constraint, of the form :math:`c(x,u) \\leq 0 c(x,u)`.\n"
27 ":param f: underlying function\n"
28 ":param cs: constraint set",
29 bp::no_init)
30 .def("__init__",
31 bp::make_constructor(
33 eigenpy::deprecation_warning_policy<>(
34 "This class has been deprecated and will be removed in a "
35 "future version of aligator."),
36 ("func"_a, "cstr_set")),
37 "Contruct a StageConstraint from a StageFunction and a constraint "
38 "set.")
39 .def_readwrite("func", &StageConstraint::func)
40 .def_readwrite("set", &StageConstraint::set)
41 .add_property(
42 "nr", +[](StageConstraint const &el) { return el.func->nr; },
43 "Get constraint dimension.");
44
45 bp::class_<ConstraintStack>("ConstraintStack", "The stack of constraint.",
46 bp::no_init)
47 .add_property("size", &ConstraintStack::size,
48 "Get number of individual constraints.")
49 .def_readonly("funcs", &ConstraintStack::funcs)
50 .def_readonly("sets", &ConstraintStack::sets)
51 .add_property("dims",
52 bp::make_function(&ConstraintStack::dims,
53 bp::return_internal_reference<>()),
54 "Get the individual dimensions of all constraints.")
55 .add_property("total_dim", &ConstraintStack::totalDim,
56 "Get total dimension of all constraints.");
57}
58
59} // namespace python
60} // namespace aligator
Defines the constraint object and constraint stack manager for this library.
ConstraintSetTpl< Scalar > ConstraintSet
Definition context.hpp:21
xyz::polymorphic< context::StageFunction > PolyFunc
void exposeConstraint()
Expose constraints.
xyz::polymorphic< context::ConstraintSet > PolySet
context::StageConstraint * make_constraint_wrap(const PolyFunc &f, const PolySet &c)
Main package namespace.
Convenience class to manage a stack of constraints.
Definition fwd.hpp:101
Class representing ternary functions .
Definition fwd.hpp:53