44 #ifndef ROL_BOUND_CONSTRAINT_DEF_H 45 #define ROL_BOUND_CONSTRAINT_DEF_H 49 template<
typename Real>
51 : Lactivated_(true), Uactivated_(true) {}
53 template<
typename Real>
55 : Lactivated_(false), Uactivated_(false) {
60 catch(std::exception &e) {
66 template<
typename Real>
73 template<
typename Real>
80 template<
typename Real>
82 if (isUpperActivated()) {
87 template<
typename Real>
89 if (isUpperActivated()) {
94 template<
typename Real>
96 if (isLowerActivated()) {
101 template<
typename Real>
103 if (isLowerActivated()) {
108 template<
typename Real>
110 if (lower_ != nullPtr) {
116 template<
typename Real>
118 if (upper_ != nullPtr) {
124 template<
typename Real>
127 Ptr<Vector<Real>> Pv = v.
clone();
130 Pv->axpy(static_cast<Real>(-1),v);
131 Real diff = Pv->norm();
132 return (diff <= ROL_EPSILON<Real>());
137 template<
typename Real>
142 template<
typename Real>
147 template<
typename Real>
153 template<
typename Real>
158 template<
typename Real>
163 template<
typename Real>
169 template<
typename Real>
174 template<
typename Real>
179 template<
typename Real>
181 return (isLowerActivated() || isUpperActivated());
184 template<
typename Real>
187 pruneUpperActive(v,x,eps);
188 pruneLowerActive(v,x,eps);
192 template<
typename Real>
195 pruneUpperActive(v,g,x,xeps,geps);
196 pruneLowerActive(v,g,x,xeps,geps);
200 template<
typename Real>
202 if (isLowerActivated()) {
204 Ptr<Vector<Real>> tmp = v.
clone();
206 pruneLowerActive(*tmp,x,eps);
211 template<
typename Real>
213 if (isUpperActivated()) {
215 Ptr<Vector<Real>> tmp = v.
clone();
217 pruneUpperActive(*tmp,x,eps);
222 template<
typename Real>
224 if (isLowerActivated()) {
226 Ptr<Vector<Real>> tmp = v.
clone();
228 pruneLowerActive(*tmp,g,x,xeps,geps);
233 template<
typename Real>
235 if (isUpperActivated()) {
237 Ptr<Vector<Real>> tmp = v.
clone();
239 pruneUpperActive(*tmp,g,x,xeps,geps);
244 template<
typename Real>
248 Ptr<Vector<Real>> tmp = v.
clone();
250 pruneActive(*tmp,x,eps);
255 template<
typename Real>
259 Ptr<Vector<Real>> tmp = v.
clone();
261 pruneActive(*tmp,g,x,xeps,geps);
266 template<
typename Real>
269 Ptr<Vector<Real>> tmp = g.
clone();
271 pruneActive(g,*tmp,x);
275 template<
typename Real>
virtual bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
Ptr< Vector< Real > > upper_
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
virtual void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
void activateLower(void)
Turn on lower bound.
void activate(void)
Turn on bounds.
virtual void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the upper -active set.
bool isActivated(void) const
Check if bounds are on.
void pruneUpperInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -inactive set.
bool isLowerActivated(void) const
Check if lower bound are on.
Defines the linear algebra or vector space interface.
void activateUpper(void)
Turn on upper bound.
Ptr< Vector< Real > > lower_
void pruneLowerInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -inactive set.
void deactivateUpper(void)
Turn off upper bound.
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
virtual void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the lower -active set.
void computeProjectedStep(Vector< Real > &v, const Vector< Real > &x)
Compute projected step.
void deactivateLower(void)
Turn off lower bound.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -inactive set.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -active set.
void computeProjectedGradient(Vector< Real > &g, const Vector< Real > &x)
Compute projected gradient.
bool isUpperActivated(void) const
Check if upper bound are on.
void deactivate(void)
Turn off bounds.
virtual const Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.