9#include <proxsuite-nlp/third-party/polymorphic_cxx14.hpp>
16 xyz::polymorphic<StageFunctionTpl<Scalar>>
func;
17 xyz::polymorphic<ConstraintSetTpl<Scalar>>
set;
23 using PolyFunc = xyz::polymorphic<StageFunctionTpl<Scalar>>;
24 using PolySet = xyz::polymorphic<ConstraintSetTpl<Scalar>>;
36 template <
typename Cstr> ALIGATOR_DEPRECATED
void pushBack(Cstr &&el) {
37 assert(!el.func.valueless_after_move() &&
38 "constraint must have non-null underlying function.");
39 assert(!el.set.valueless_after_move() &&
40 "constraint must have non-null underlying set.");
41 funcs.emplace_back(el.func);
42 sets.emplace_back(el.set);
47 assert(!func.valueless_after_move() &&
48 "constraint must have non-null underlying function.");
49 assert(!cstr_set.valueless_after_move() &&
50 "constraint must have non-null underlying set.");
51 funcs.emplace_back(func);
52 sets.emplace_back(cstr_set);
57 const std::vector<long> &
dims()
const {
return dims_; }
63 return dynamic_cast<Derived *
>(&*
funcs[id]);
67 template <
typename Derived>
69 return dynamic_cast<const Derived *
>(&*
funcs[id]);
81 void addDim(
const long nr) {
82 const long last_cursor =
indices_.back();
83 indices_.push_back(last_cursor + nr);
91#include "aligator/core/constraint.hxx"
93#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
94#include "aligator/core/constraint.txx"
Base definitions for ternary functions.
StageConstraintTpl< Scalar > ALIGATOR_DEPRECATED
Convenience class to manage a stack of constraints.
const std::vector< long > & dims() const
Get the set of dimensions for each constraint in the stack.
xyz::polymorphic< StageFunctionTpl< Scalar > > PolyFunc
ConstraintStackTpl & operator=(const ConstraintStackTpl &)=default
ConstraintStackTpl & operator=(ConstraintStackTpl &&)=default
std::vector< PolyFunc > funcs
std::vector< PolySet > sets
std::vector< long > indices_
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
ALIGATOR_DEPRECATED void pushBack(Cstr &&el)
void pushBack(const PolyFunc &func, const PolySet &cstr_set)
ConstraintStackTpl(ConstraintStackTpl &&)=default
const Derived * getConstraint(const size_t id) const
Get constraint function, cast down to the specified type.
std::vector< long > dims_
ConstraintStackTpl(const ConstraintStackTpl &)=default
Derived * getConstraint(const size_t id)
Get constraint function, cast down to the specified type.
xyz::polymorphic< ConstraintSetTpl< Scalar > > PolySet
xyz::polymorphic< ConstraintSetTpl< Scalar > > set
xyz::polymorphic< StageFunctionTpl< Scalar > > func