44 #ifndef ROL_BOUND_CONSTRAINT_PARTITIONED_H 45 #define ROL_BOUND_CONSTRAINT_PARTITIONED_H 60 template<
typename Real>
68 std::vector<Ptr<BoundConstraint<Real>>>
bnd_;
93 std::vector<Ptr<Vector<Real>>> lp(
dim_);
94 std::vector<Ptr<Vector<Real>>> up(
dim_);
97 lp[k] = x[k]->clone();
102 lp[k]->setScalar(ROL_NINF<Real>());
105 catch (std::exception &e1) {
107 lp[k] = x[k]->clone();
108 lp[k]->setScalar(ROL_NINF<Real>());
110 catch (std::exception &e2) {
116 up[k] = x[k]->clone();
121 up[k]->setScalar(ROL_INF<Real>());
124 catch (std::exception &e1) {
126 up[k] = x[k]->clone();
127 up[k]->setScalar(ROL_INF<Real>());
129 catch (std::exception &e2) {
144 const PV &xpv =
dynamic_cast<const PV&
>(x);
147 bnd_[k]->update(*(xpv.
get(k)),flag,iter);
153 PV &xpv =
dynamic_cast<PV&
>(x);
162 PV &xpv =
dynamic_cast<PV&
>(x);
165 bnd_[k]->projectInterior(*xpv.
get(k));
171 PV &vpv =
dynamic_cast<PV&
>(v);
172 const PV &xpv =
dynamic_cast<const PV&
>(x);
175 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
181 PV &vpv =
dynamic_cast<PV&
>(v);
182 const PV &gpv =
dynamic_cast<const PV&
>(g);
183 const PV &xpv =
dynamic_cast<const PV&
>(x);
186 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),xeps,geps);
192 PV &vpv =
dynamic_cast<PV&
>(v);
193 const PV &xpv =
dynamic_cast<const PV&
>(x);
196 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
202 PV &vpv =
dynamic_cast<PV&
>(v);
203 const PV &gpv =
dynamic_cast<const PV&
>(g);
204 const PV &xpv =
dynamic_cast<const PV&
>(x);
207 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),xeps,geps);
213 bool feasible =
true;
214 const PV &vs =
dynamic_cast<const PV&
>(v);
217 feasible = feasible &&
bnd_[k]->isFeasible(*(vs.
get(k)));
226 template<
typename Real>
227 Ptr<BoundConstraint<Real>>
234 Ptr<BND> temp[] = {bnd1, bnd2};
235 return makePtr<BNDP>( std::vector<Ptr<BND>>(temp,temp+2) );
Ptr< Vector< Real > > upper_
typename PV< Real >::size_type size_type
BoundConstraint_Partitioned(const std::vector< Ptr< BoundConstraint< Real >>> &bnd, const std::vector< Ptr< Vector< Real >>> &x)
void activate(void)
Turn on bounds.
Defines the linear algebra of vector space on a generic partitioned vector.
Contains definitions of custom data types in ROL.
bool isActivated(void) const
Check if bounds are on.
bool isLowerActivated(void) const
Check if lower bound are on.
Defines the linear algebra or vector space interface.
std::vector< Ptr< BoundConstraint< Real > > > bnd_
Ptr< BoundConstraint< Real > > CreateBoundConstraint_Partitioned(const Ptr< BoundConstraint< Real >> &bnd1, const Ptr< BoundConstraint< Real >> &bnd2)
Ptr< Vector< Real > > lower_
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
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.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the upper -binding set.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
A composite composite BoundConstraint formed from bound constraints on subvectors of a PartitionedVec...
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the -binding set.
Provides the interface to apply upper and lower bound constraints.
~BoundConstraint_Partitioned()
std::vector< Real >::size_type uint
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
bool isUpperActivated(void) const
Check if upper bound are on.
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
PartitionedVector< Real > PV
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 deactivate(void)
Turn off bounds.
ROL::Ptr< const Vector< Real > > get(size_type i) const
virtual const Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.