7using context::ConstVectorRef;
20 return bp::class_<T, bp::bases<ConstraintSet>>(name, docstring, bp::no_init)
26 bp::class_<ConstraintSet, boost::noncopyable>(
27 "ConstraintSet",
"Base class for constraint sets or nonsmooth penalties.",
30 "Evaluate the constraint indicator function or nonsmooth penalty "
31 "on the projection/prox map of :math:`z`.")
36 context::VectorXs zout(z.size());
42 (
"self"_a,
"z",
"zout"))
44 "normalConeProjection",
46 context::VectorXs zout(z.size());
52 (
"self"_a,
"z",
"Jout"),
"Apply the projection Jacobian.")
53 .def(
"applyNormalProjectionJacobian",
55 (
"self"_a,
"z",
"Jout"),
56 "Apply the normal cone projection Jacobian.")
58 (
"self"_a,
"z",
"out"))
60 (
"self"_a,
"zin",
"zproj"),
61 "Evaluate the Moreau envelope with parameter :math:`\\mu`.")
63 (
"self"_a,
"mu"),
"Set proximal parameter.")
65 .def(bp::self == bp::self);
68 "EqualityConstraintSet",
"Cast a function into an equality constraint")
69 .def(bp::init<>(
"self"_a));
73 "Cast a function into a negative inequality constraint h(x) \\leq 0")
74 .def(bp::init<>(
"self"_a));
78 "Box constraint of the form :math:`z \\in [z_\\min, z_\\max]`.")
79 .def(bp::init<ConstVectorRef, ConstVectorRef>(
80 (
"self"_a,
"lower_limit",
"upper_limit")))
85 "1-norm penalty function.")
86 .def(bp::init<>((
"self"_a)));
89 "ConstraintSetProduct",
"Cartesian product of constraint sets.")
90 .def(bp::init<std::vector<PolySet>, std::vector<Eigen::Index>>(
91 (
"self"_a,
"components",
"blockSizes")))
92 .add_property(
"components",
94 bp::return_internal_reference<>()))
95 .add_property(
"blockSizes",
97 bp::return_internal_reference<>()),
98 "Dimensions of each component of the cartesian product.");
100 StdVectorPythonVisitor<std::vector<PolySet>>::expose(
101 "StdVec_ConstraintObject",
102 eigenpy::details::overload_base_get_item_for_std_vector<
103 std::vector<PolySet>>());
Omnibus header which includes all supported constraint sets.
ConstraintSetTpl< Scalar > ConstraintSet
BoxConstraintTpl< Scalar > BoxConstraint
EqualityConstraintTpl< Scalar > EqualityConstraint
void register_polymorphic_to_python()
Expose a polymorphic value type, e.g. xyz::polymorphic<T, A>.
NegativeOrthantTpl< Scalar > NegativeOrthant
void exposeConstraintSets()
ConstraintSetProductTpl< Scalar > ConstraintSetProduct
xyz::polymorphic< ConstraintSet > PolySet
auto exposeSpecificConstraintSet(const char *name, const char *docstring)
NonsmoothPenaltyL1Tpl< Scalar > L1Penalty
Cartesian product of multiple constraint sets. This class makes computing multipliers and Jacobian ma...
const std::vector< xyz::polymorphic< Base > > & components() const
const std::vector< Eigen::Index > & blockSizes() const
virtual void applyNormalConeProjectionJacobian(const ConstVectorRef &z, MatrixRef Jout) const
virtual void computeActiveSet(const ConstVectorRef &z, Eigen::Ref< ActiveType > out) const=0
virtual void applyProjectionJacobian(const ConstVectorRef &z, MatrixRef Jout) const
virtual Scalar evaluate(const ConstVectorRef &) const
virtual void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const=0
Scalar evaluateMoreauEnvelope(const ConstVectorRef &zin, const ConstVectorRef &zproj) const
void setProxParameter(const Scalar mu) const
virtual void projection(const ConstVectorRef &z, VectorRef zout) const=0
Negative orthant, for constraints .
Composite -penalty function .