aligator  0.6.1
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/constraint-base.hpp>
5
6namespace aligator {
7namespace python {
8
10make_constraint_wrap(const shared_ptr<context::StageFunction> &f,
11 const shared_ptr<context::ConstraintSet> &c) {
12 return new context::StageConstraint{f, c};
13}
14
19
20 bp::class_<StageConstraint>(
21 "StageConstraint",
22 "A stage-wise constraint, of the form :math:`c(x,u) \\leq 0 c(x,u)`.\n"
23 ":param f: underlying function\n"
24 ":param cs: constraint set",
25 bp::no_init)
26 .def("__init__",
27 bp::make_constructor(make_constraint_wrap,
28 bp::default_call_policies(),
29 ("func"_a, "cstr_set")),
30 "Contruct a StageConstraint from a StageFunction and a constraint "
31 "set.")
32 .def_readwrite("func", &StageConstraint::func)
33 .def_readwrite("set", &StageConstraint::set)
34 .add_property("nr", &StageConstraint::nr, "Get constraint dimension.");
35
36 bp::class_<ConstraintStack>("ConstraintStack", "The stack of constraint.",
37 bp::no_init)
38 .add_property("size", &ConstraintStack::size,
39 "Get number of individual constraints.")
40 .add_property("dims",
41 bp::make_function(&ConstraintStack::dims,
42 bp::return_internal_reference<>()),
43 "Get the individual dimensions of all constraints.")
44 .def(eigenpy::details::overload_base_get_item_for_std_vector<
45 ConstraintStack>())
46 .add_property("total_dim", &ConstraintStack::totalDim,
47 "Get total dimension of all constraints.");
48}
49
50} // namespace python
51} // namespace aligator
Defines the constraint object and constraint stack manager for this library.
ConstraintSetBase< Scalar > ConstraintSet
Definition context.hpp:22
ConstraintStackTpl< Scalar > ConstraintStack
Definition context.hpp:36
StageConstraintTpl< Scalar > StageConstraint
Definition context.hpp:20
void exposeConstraint()
Expose constraints.
context::StageConstraint * make_constraint_wrap(const shared_ptr< context::StageFunction > &f, const shared_ptr< context::ConstraintSet > &c)
Main package namespace.