proxsuite-nlp  0.11.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
 
Loading...
Searching...
No Matches
negative-orthant.hpp
1
2#pragma once
3
5
6namespace proxsuite {
7namespace nlp {
8
18template <typename _Scalar>
19struct NegativeOrthantTpl : ConstraintSetTpl<_Scalar> {
20 using Scalar = _Scalar;
22
23 NegativeOrthantTpl() = default;
24 NegativeOrthantTpl(const NegativeOrthantTpl &) = default;
25 NegativeOrthantTpl &operator=(const NegativeOrthantTpl &) = default;
26 NegativeOrthantTpl(NegativeOrthantTpl &&) = default;
27 NegativeOrthantTpl &operator=(NegativeOrthantTpl &&) = default;
28
29 using Base = ConstraintSetTpl<Scalar>;
30 using ActiveType = typename Base::ActiveType;
31
32 void projection(const ConstVectorRef &z, VectorRef zout) const {
33 zout = z.cwiseMin(static_cast<Scalar>(0.));
34 }
35
36 void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const {
37 zout = z.cwiseMax(static_cast<Scalar>(0.));
38 }
39
41 void computeActiveSet(const ConstVectorRef &z,
42 Eigen::Ref<ActiveType> out) const {
43 out.array() = (z.array() > static_cast<Scalar>(0.));
44 }
45};
46
47template <typename Scalar>
48using NegativeOrthant PROXSUITE_NLP_DEPRECATED_MESSAGE(
49 "Use NegativeOrthantTpl<T> instead") = NegativeOrthantTpl<Scalar>;
50
51#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
52extern template struct PROXSUITE_NLP_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI
53 NegativeOrthantTpl<context::Scalar>;
54#endif
55
56} // namespace nlp
57} // namespace proxsuite
58
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:26
Main package namespace.
Definition bcl-params.hpp:5
void projection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of variable z onto the constraint set.
void computeActiveSet(const ConstVectorRef &z, Eigen::Ref< ActiveType > out) const
The elements of the active set are the components such that .
void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of z onto the normal cone to the set. The default implementation is just .