61 const ROL::Ptr<Vector<Real> >
x_lo_;
62 const ROL::Ptr<Vector<Real> >
x_up_;
71 class Active :
public Elementwise::BinaryFunction<Real> {
74 Real
apply(
const Real &x,
const Real &y )
const {
75 return ((y <=
offset_) ? 0 : x);
84 Real
apply(
const Real &x,
const Real &y )
const {
85 return ((y < 0 && x <=
offset_) ? 0 : 1);
94 Real
apply(
const Real &x,
const Real &y )
const {
95 return ((y > 0 && x <=
offset_) ? 0 : 1);
103 Real
apply(
const Real &x,
const Real &y )
const {
104 return ((y == 1) ? x : 0);
118 x_up_->applyUnary(Elementwise::Fill<Real>(ROL_INF<Real>()));
122 x_lo_->applyUnary(Elementwise::Fill<Real>(ROL_NINF<Real>()));
130 const Real scale = 1)
132 const Real half(0.5), one(1);
142 struct Lesser :
public Elementwise::BinaryFunction<Real> {
143 Real
apply(
const Real &xc,
const Real &yc)
const {
return xc<yc ? xc : yc; }
146 struct Greater :
public Elementwise::BinaryFunction<Real> {
147 Real
apply(
const Real &xc,
const Real &yc)
const {
return xc>yc ? xc : yc; }
160 const Real eps(1e-1);
163 class LowerFeasible :
public Elementwise::BinaryFunction<Real> {
168 LowerFeasible(
const Real eps,
const Real diff)
169 : eps_(eps), diff_(diff) {}
170 Real
apply(
const Real &x,
const Real &y )
const {
171 const Real tol =
static_cast<Real
>(100)*ROL_EPSILON<Real>();
173 Real val = ((y <-tol) ? y*(one-eps_)
174 : ((y > tol) ? y*(one+eps_)
176 val = std::min(y+eps_*diff_, val);
177 return (x < y+tol) ? val : x;
184 class UpperFeasible :
public Elementwise::BinaryFunction<Real> {
189 UpperFeasible(
const Real eps,
const Real diff)
190 : eps_(eps), diff_(diff) {}
191 Real
apply(
const Real &x,
const Real &y )
const {
192 const Real tol =
static_cast<Real
>(100)*ROL_EPSILON<Real>();
194 Real val = ((y <-tol) ? y*(one+eps_)
195 : ((y > tol) ? y*(one-eps_)
197 val = std::max(y-eps_*diff_, val);
198 return (x > y-tol) ? val : x;
225 mask_->applyBinary(op,g);
251 mask_->applyBinary(op,g);
267 bool flagU =
false, flagL =
false;
272 flagU = ((uminusv<0) ?
true :
false);
279 flagL = ((vminusl<0) ?
true :
false);
281 return ((flagU || flagL) ?
false :
true);
LowerBinding(Real offset)
void activateLower(void)
Turn on lower bound.
Real apply(const Real &x, const Real &y) const
virtual void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the upper -active set.
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
Real apply(const Real &x, const Real &y) const
Defines the linear algebra or vector space interface.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -binding set.
virtual bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the upper -binding set.
Elementwise::ReductionMin< Real > minimum_
void activateUpper(void)
Turn on upper bound.
const ROL::Ptr< Vector< Real > > x_lo_
Bounds(const Vector< Real > &x, bool isLower=true, Real scale=1)
const ROL::Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
Provides the elementwise interface to apply upper and lower bound constraints.
ROL::Bounds::PruneBinding prune_
Bounds(const ROL::Ptr< Vector< Real > > &x_lo, const ROL::Ptr< Vector< Real > > &x_up, const Real scale=1)
Provides the interface to apply upper and lower bound constraints.
ROL::Ptr< Vector< Real > > mask_
const ROL::Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
Real apply(const Real &x, const Real &y) const
Real apply(const Real &x, const Real &y) const
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the lower -active set.
ROL::DiagonalOperator apply
const ROL::Ptr< Vector< Real > > x_up_
UpperBinding(Real offset)