Go to the documentation of this file.
44 #ifndef ROL_BOUND_CONSTRAINT_PARTITIONED_H
45 #define ROL_BOUND_CONSTRAINT_PARTITIONED_H
68 std::vector<ROL::Ptr<BoundConstraint<Real> > >
bnd_;
91 std::vector<ROL::Ptr<Vector<Real> > > lp(
dim_);
92 std::vector<ROL::Ptr<Vector<Real> > > up(
dim_);
95 lp[k] = x[k]->clone();
100 lp[k]->setScalar(ROL_NINF<Real>());
103 catch (std::exception &e1) {
105 lp[k] = x[k]->clone();
106 lp[k]->setScalar(ROL_NINF<Real>());
108 catch (std::exception &e2) {
109 lp[k] = ROL::nullPtr;
114 up[k] = x[k]->clone();
119 up[k]->setScalar(ROL_INF<Real>());
122 catch (std::exception &e1) {
124 up[k] = x[k]->clone();
125 up[k]->setScalar(ROL_INF<Real>());
127 catch (std::exception &e2) {
128 up[k] = ROL::nullPtr;
134 l_ = ROL::makePtr<PV>(lp);
137 u_ = ROL::makePtr<PV>(up);
142 const PV &xpv = dynamic_cast<const PV&>(x);
145 bnd_[k]->update(*(xpv.
get(k)),flag,iter);
151 PV &xpv = dynamic_cast<PV&>(x);
160 PV &xpv = dynamic_cast<PV&>(x);
163 bnd_[k]->projectInterior(*xpv.
get(k));
169 PV &vpv = dynamic_cast<PV&>(v);
170 const PV &xpv = dynamic_cast<const PV&>(x);
173 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
179 PV &vpv = dynamic_cast<PV&>(v);
180 const PV &gpv = dynamic_cast<const PV&>(g);
181 const PV &xpv = dynamic_cast<const PV&>(x);
184 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),eps);
190 PV &vpv = dynamic_cast<PV&>(v);
191 const PV &xpv = dynamic_cast<const PV&>(x);
194 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
200 PV &vpv = dynamic_cast<PV&>(v);
201 const PV &gpv = dynamic_cast<const PV&>(g);
202 const PV &xpv = dynamic_cast<const PV&>(x);
205 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),eps);
229 bool feasible =
true;
230 const PV &vs = dynamic_cast<const PV&>(v);
233 feasible = feasible &&
bnd_[k]->isFeasible(*(vs.
get(k)));
243 ROL::Ptr<BoundConstraint<Real> >
250 ROL::Ptr<BND> temp[] = {bnd1, bnd2};
251 return ROL::makePtr<BNDP>( std::vector<ROL::Ptr<BND>>(temp,temp+2) );
virtual const ROL::Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
bool isActivated(void) const
Check if bounds are on.
const ROL::Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
bool isUpperActivated(void) const
Check if upper bound are on.
Defines the linear algebra of vector space on a generic partitioned vector.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the lower -active set.
void deactivate(void)
Turn off bounds.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update bounds.
virtual const ROL::Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
A composite composite BoundConstraint formed from bound constraints on subvectors of a PartitionedVec...
const ROL::Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
std::vector< Real >::size_type uint
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
Defines the linear algebra or vector space interface.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the -binding set.
Contains definitions of custom data types in ROL.
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
PartitionedVector< Real > PV
void activate(void)
Turn on bounds.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the upper -binding set.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the upper -active set.
typename PV< Real >::size_type size_type
ROL::Ptr< const Vector< Real > > get(size_type i) const
Provides the interface to apply upper and lower bound constraints.
BoundConstraint_Partitioned(const std::vector< ROL::Ptr< BoundConstraint< Real > > > &bnd, const std::vector< ROL::Ptr< Vector< Real > > > &x)
void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
std::vector< ROL::Ptr< BoundConstraint< Real > > > bnd_
~BoundConstraint_Partitioned()
bool isLowerActivated(void) const
Check if lower bound are on.
ROL::Ptr< BoundConstraint< Real > > CreateBoundConstraint_Partitioned(const ROL::Ptr< BoundConstraint< Real > > &bnd1, const ROL::Ptr< BoundConstraint< Real > > &bnd2)