44 #ifndef ROL_BOUND_CONSTRAINT_DEF_H 45 #define ROL_BOUND_CONSTRAINT_DEF_H 49 template<
typename Real>
52 Real denom = (
dim > 0 ?
static_cast<Real
>(
dim) : 1e15);
53 return std::sqrt(ROL_INF<Real>() / denom);
56 template<
typename Real>
58 : Lactivated_(true), Uactivated_(true) {}
60 template<
typename Real>
62 : Lactivated_(false), Uactivated_(false) {
67 catch(std::exception &e) {
73 template<
typename Real>
80 template<
typename Real>
87 template<
typename Real>
89 if (isUpperActivated()) {
94 template<
typename Real>
96 if (isUpperActivated()) {
101 template<
typename Real>
103 if (isLowerActivated()) {
108 template<
typename Real>
110 if (isLowerActivated()) {
115 template<
typename Real>
117 if (lower_ != nullPtr) {
123 template<
typename Real>
125 if (upper_ != nullPtr) {
131 template<
typename Real>
134 Ptr<Vector<Real>> Pv = v.
clone();
137 Pv->axpy(static_cast<Real>(-1),v);
138 Real diff = Pv->norm();
139 return (diff <= ROL_EPSILON<Real>());
144 template<
typename Real>
146 throw Exception::NotImplemented(
">>> BoundConstraint::applyInverseScalingFunction : This function has not been implemeted!");
149 template<
typename Real>
151 throw Exception::NotImplemented(
">>> BoundConstraint::applyScalingFunctionJacobian : This function has not been implemeted!");
154 template<
typename Real>
159 template<
typename Real>
164 template<
typename Real>
170 template<
typename Real>
175 template<
typename Real>
180 template<
typename Real>
186 template<
typename Real>
191 template<
typename Real>
196 template<
typename Real>
198 return (isLowerActivated() || isUpperActivated());
201 template<
typename Real>
204 pruneUpperActive(v,x,eps);
205 pruneLowerActive(v,x,eps);
209 template<
typename Real>
212 pruneUpperActive(v,g,x,xeps,geps);
213 pruneLowerActive(v,g,x,xeps,geps);
217 template<
typename Real>
219 if (isLowerActivated()) {
221 Ptr<Vector<Real>> tmp = v.
clone();
223 pruneLowerActive(*tmp,x,eps);
228 template<
typename Real>
230 if (isUpperActivated()) {
232 Ptr<Vector<Real>> tmp = v.
clone();
234 pruneUpperActive(*tmp,x,eps);
239 template<
typename Real>
241 if (isLowerActivated()) {
243 Ptr<Vector<Real>> tmp = v.
clone();
245 pruneLowerActive(*tmp,g,x,xeps,geps);
250 template<
typename Real>
252 if (isUpperActivated()) {
254 Ptr<Vector<Real>> tmp = v.
clone();
256 pruneUpperActive(*tmp,g,x,xeps,geps);
261 template<
typename Real>
265 Ptr<Vector<Real>> tmp = v.
clone();
267 pruneActive(*tmp,x,eps);
272 template<
typename Real>
276 Ptr<Vector<Real>> tmp = v.
clone();
278 pruneActive(*tmp,g,x,xeps,geps);
283 template<
typename Real>
286 Ptr<Vector<Real>> tmp = g.
clone();
288 pruneActive(g,*tmp,x);
292 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.
Real computeInf(const Vector< Real > &x) const
virtual void applyScalingFunctionJacobian(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply scaling function Jacobian.
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.
virtual void applyInverseScalingFunction(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply inverse scaling function.
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.
virtual int dimension() const
Return dimension of the vector space.
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.