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) );
typename PV< Real >::size_type size_type
Contains definitions of custom data types in ROL.
A composite composite BoundConstraint formed from bound constraints on subvectors of a PartitionedVec...
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 pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the upper -active set.
BoundConstraint_Partitioned(const std::vector< Ptr< BoundConstraint< Real >>> &bnd, const std::vector< Ptr< Vector< Real >>> &x)
std::vector< Ptr< BoundConstraint< Real > > > bnd_
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
~BoundConstraint_Partitioned()
std::vector< Real >::size_type uint
PartitionedVector< Real > PV
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.
void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
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.
Provides the interface to apply upper and lower bound constraints.
virtual const Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
bool isLowerActivated(void) const
Check if lower bound are on.
Ptr< Vector< Real > > upper_
bool isActivated(void) const
Check if bounds are on.
void deactivate(void)
Turn off bounds.
Ptr< Vector< Real > > lower_
void activate(void)
Turn on bounds.
bool isUpperActivated(void) const
Check if upper bound are on.
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Ptr< const Vector< Real > > get(size_type i) const
Defines the linear algebra or vector space interface.
Ptr< BoundConstraint< Real > > CreateBoundConstraint_Partitioned(const Ptr< BoundConstraint< Real >> &bnd1, const Ptr< BoundConstraint< Real >> &bnd2)