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