61 const ROL::Ptr<Vector<Real>>
x_lo_;
62 const ROL::Ptr<Vector<Real>>
x_up_;
72 class Active :
public Elementwise::BinaryFunction<Real> {
75 Real
apply(
const Real &x,
const Real &y )
const {
76 return ((y <=
offset_) ? 0 : x);
85 Real
apply(
const Real &x,
const Real &y )
const {
86 return ((y < 0 && x <=
offset_) ? 0 : 1);
95 Real
apply(
const Real &x,
const Real &y )
const {
96 return ((y > 0 && x <=
offset_) ? 0 : 1);
104 Real
apply(
const Real &x,
const Real &y )
const {
105 return ((y == 1) ? x : 0);
120 x_up_->applyUnary(Elementwise::Fill<Real>(ROL_INF<Real>()));
124 x_lo_->applyUnary(Elementwise::Fill<Real>(ROL_NINF<Real>()));
132 const Real scale = 1,
133 const Real feasTol = 1e-2)
136 mask_(x_lo->clone()) {
137 const Real half(0.5), one(1);
147 struct Lesser :
public Elementwise::BinaryFunction<Real> {
148 Real
apply(
const Real &xc,
const Real &yc)
const {
return xc<yc ? xc : yc; }
151 struct Greater :
public Elementwise::BinaryFunction<Real> {
152 Real
apply(
const Real &xc,
const Real &yc)
const {
return xc>yc ? xc : yc; }
167 class LowerFeasible :
public Elementwise::BinaryFunction<Real> {
172 LowerFeasible(
const Real eps,
const Real diff)
173 : eps_(eps), diff_(diff) {}
174 Real
apply(
const Real &xc,
const Real &yc )
const {
175 const Real tol =
static_cast<Real
>(100)*ROL_EPSILON<Real>();
177 Real val = ((yc <-tol) ? yc*(one-eps_)
178 : ((yc > tol) ? yc*(one+eps_)
180 val = std::min(yc+eps_*diff_, val);
181 return (xc < yc+tol) ? val : xc;
188 class UpperFeasible :
public Elementwise::BinaryFunction<Real> {
193 UpperFeasible(
const Real eps,
const Real diff)
194 : eps_(eps), diff_(diff) {}
195 Real
apply(
const Real &xc,
const Real &yc )
const {
196 const Real tol =
static_cast<Real
>(100)*ROL_EPSILON<Real>();
198 Real val = ((yc <-tol) ? yc*(one+eps_)
199 : ((yc > tol) ? yc*(one-eps_)
201 val = std::max(yc-eps_*diff_, val);
202 return (xc > yc-tol) ? val : xc;
229 mask_->applyBinary(op,g);
255 mask_->applyBinary(op,g);
271 bool flagU =
false, flagL =
false;
276 flagU = ((uminusv<0) ?
true :
false);
283 flagL = ((vminusl<0) ?
true :
false);
285 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.
Bounds(const ROL::Ptr< Vector< Real >> &x_lo, const ROL::Ptr< Vector< Real >> &x_up, const Real scale=1, const Real feasTol=1e-2)
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_
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_
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
Bounds(const Vector< Real > &x, bool isLower=true, Real scale=1, Real feasTol=1e-2)
const ROL::Ptr< Vector< Real > > x_up_
UpperBinding(Real offset)