13template <
typename Scalar>
struct BoxConstraintTpl : ConstraintSetTpl<Scalar> {
15 using Base = ConstraintSetTpl<Scalar>;
16 using ActiveType =
typename Base::ActiveType;
21 BoxConstraintTpl(
const ConstVectorRef lower,
const ConstVectorRef upper)
22 : Base(), lower_limit(lower), upper_limit(upper) {}
23 BoxConstraintTpl(
const BoxConstraintTpl &) =
default;
24 BoxConstraintTpl &operator=(
const BoxConstraintTpl &) =
default;
25 BoxConstraintTpl(BoxConstraintTpl &&) =
default;
26 BoxConstraintTpl &operator=(BoxConstraintTpl &&) =
default;
28 decltype(
auto) projection_impl(
const ConstVectorRef &z)
const {
29 return z.cwiseMin(upper_limit).cwiseMax(lower_limit);
32 void projection(
const ConstVectorRef &z, VectorRef zout)
const {
33 zout = projection_impl(z);
37 zout = z - projection_impl(z);
41 Eigen::Ref<ActiveType> out)
const {
43 (z.array() > upper_limit.array()) || (z.array() < lower_limit.array());
47#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
48extern template struct PROXSUITE_NLP_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI
49 BoxConstraintTpl<context::Scalar>;
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of z onto the normal cone to the set. The default implementation is just .
void computeActiveSet(const ConstVectorRef &z, Eigen::Ref< ActiveType > out) const
void projection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of variable z onto the constraint set.