aligator  0.14.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.
3
6
7#include <eigenpy/deprecation-policy.hpp>
8
9namespace aligator::python {
12using context::StageConstraint;
16
17context::StageConstraint *make_constraint_wrap(const PolyFunc &f,
18 const PolySet &c) {
19 return new context::StageConstraint{f, c};
20}
21
23
25 {
26 bp::scope scope = get_namespace("constraints");
28 }
29
30 bp::class_<StageConstraint>(
31 "StageConstraint",
32 "A stage-wise constraint, of the form :math:`c(x,u) \\leq 0 c(x,u)`.\n"
33 ":param f: underlying function\n"
34 ":param cs: constraint set",
35 bp::no_init)
36 .def("__init__",
37 bp::make_constructor(
39 eigenpy::deprecation_warning_policy<>(
40 "This class has been deprecated and will be removed in a "
41 "future version of aligator."),
42 ("func"_a, "cstr_set")),
43 "Contruct a StageConstraint from a StageFunction and a constraint "
44 "set.")
45 .def_readwrite("func", &StageConstraint::func)
46 .def_readwrite("set", &StageConstraint::set)
47 .add_property(
48 "nr", +[](StageConstraint const &el) { return el.func->nr; },
49 "Get constraint dimension.");
50
51 bp::class_<ConstraintStack>("ConstraintStack", "The stack of constraint.",
52 bp::no_init)
53 .add_property("size", &ConstraintStack::size,
54 "Get number of individual constraints.")
55 .def_readonly("funcs", &ConstraintStack::funcs)
56 .def_readonly("sets", &ConstraintStack::sets)
57 .add_property("dims",
58 bp::make_function(&ConstraintStack::dims,
59 bp::return_internal_reference<>()),
60 "Get the individual dimensions of all constraints.")
61 .add_property("total_dim", &ConstraintStack::totalDim,
62 "Get total dimension of all constraints.");
63}
64
65} // namespace aligator::python
Defines the constraint object and constraint stack manager for this library.
StageFunctionTpl< Scalar > StageFunction
Definition context.hpp:17
ConstraintSetTpl< Scalar > ConstraintSet
Definition context.hpp:22
ConstraintStackTpl< Scalar > ConstraintStack
Definition context.hpp:37
The Python bindings.
Definition blk-matrix.hpp:5
void exposeConstraint()
Expose constraints.
bp::object get_namespace(const std::string &name)
Create or retrieve a Python scope (that is, a class or module namespace).
Definition utils.hpp:22
xyz::polymorphic< ConstraintSet > PolySet
context::StageConstraint * make_constraint_wrap(const PolyFunc &f, const PolySet &c)
xyz::polymorphic< StageFunction > PolyFunc
const std::vector< long > & dims() const
Get the set of dimensions for each constraint in the stack.
std::vector< PolyFunc > funcs
std::size_t size() const
std::vector< PolySet > sets