proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
box-constraint.hpp
Go to the documentation of this file.
1
2#pragma once
3
5
6namespace proxsuite {
7namespace nlp {
8
13template <typename Scalar> struct BoxConstraintTpl : ConstraintSetTpl<Scalar> {
16 using ActiveType = typename Base::ActiveType;
17
18 VectorXs lower_limit;
19 VectorXs upper_limit;
20
21 BoxConstraintTpl(const ConstVectorRef lower, const ConstVectorRef upper)
22 : Base(), lower_limit(lower), upper_limit(upper) {}
27
28 decltype(auto) projection_impl(const ConstVectorRef &z) const {
29 return z.cwiseMin(upper_limit).cwiseMax(lower_limit);
30 }
31
32 void projection(const ConstVectorRef &z, VectorRef zout) const {
33 zout = projection_impl(z);
34 }
35
36 void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const {
37 zout = z - projection_impl(z);
38 }
39
40 void computeActiveSet(const ConstVectorRef &z,
41 Eigen::Ref<ActiveType> out) const {
42 out.array() =
43 (z.array() > upper_limit.array()) || (z.array() < lower_limit.array());
44 }
45};
46
47#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
48extern template struct PROXSUITE_NLP_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI
49 BoxConstraintTpl<context::Scalar>;
50#endif
51
52} // namespace nlp
53} // namespace proxsuite
54
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:26
Main package namespace.
Definition bcl-params.hpp:5
decltype(auto) projection_impl(const ConstVectorRef &z) const
void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of z onto the normal cone to the set. The default implementation is just .
BoxConstraintTpl & operator=(const BoxConstraintTpl &)=default
BoxConstraintTpl(const BoxConstraintTpl &)=default
void computeActiveSet(const ConstVectorRef &z, Eigen::Ref< ActiveType > out) const
BoxConstraintTpl(BoxConstraintTpl &&)=default
typename Base::ActiveType ActiveType
void projection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of variable z onto the constraint set.
BoxConstraintTpl & operator=(BoxConstraintTpl &&)=default
BoxConstraintTpl(const ConstVectorRef lower, const ConstVectorRef upper)
Base constraint set type.
Definition fwd.hpp:104
Eigen::Matrix< bool, Eigen::Dynamic, 1 > ActiveType