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();
105 catch (std::exception &e1) {
107 lp[k] = x[k]->clone();
110 catch (std::exception &e2) {
116 up[k] = x[k]->clone();
124 catch (std::exception &e1) {
126 up[k] = x[k]->clone();
129 catch (std::exception &e2) {
147 PV &xpv =
dynamic_cast<PV&
>(x);
156 PV &xpv =
dynamic_cast<PV&
>(x);
159 bnd_[k]->projectInterior(*xpv.
get(k));
165 PV &vpv =
dynamic_cast<PV&
>(v);
166 const PV &xpv =
dynamic_cast<const PV&
>(x);
169 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
175 PV &vpv =
dynamic_cast<PV&
>(v);
176 const PV &gpv =
dynamic_cast<const PV&
>(g);
177 const PV &xpv =
dynamic_cast<const PV&
>(x);
180 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),xeps,geps);
186 PV &vpv =
dynamic_cast<PV&
>(v);
187 const PV &xpv =
dynamic_cast<const PV&
>(x);
190 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(xpv.
get(k)),eps);
196 PV &vpv =
dynamic_cast<PV&
>(v);
197 const PV &gpv =
dynamic_cast<const PV&
>(g);
198 const PV &xpv =
dynamic_cast<const PV&
>(x);
201 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(gpv.
get(k)),*(xpv.
get(k)),xeps,geps);
207 bool feasible =
true;
208 const PV &vs =
dynamic_cast<const PV&
>(v);
211 feasible = feasible &&
bnd_[k]->isFeasible(*(vs.
get(k)));
218 PV &dvpv =
dynamic_cast<PV&
>(dv);
219 const PV &vpv =
dynamic_cast<const PV&
>(v);
220 const PV &xpv =
dynamic_cast<const PV&
>(x);
221 const PV &gpv =
dynamic_cast<const PV&
>(g);
224 bnd_[k]->applyInverseScalingFunction(*(dvpv.
get(k)),*(vpv.
get(k)),*(xpv.
get(k)),*(gpv.
get(k)));
230 PV &dvpv =
dynamic_cast<PV&
>(dv);
231 const PV &vpv =
dynamic_cast<const PV&
>(v);
232 const PV &xpv =
dynamic_cast<const PV&
>(x);
233 const PV &gpv =
dynamic_cast<const PV&
>(g);
236 bnd_[k]->applyScalingFunctionJacobian(*(dvpv.
get(k)),*(vpv.
get(k)),*(xpv.
get(k)),*(gpv.
get(k)));
244 template<
typename Real>
245 Ptr<BoundConstraint<Real>>
252 Ptr<BND> temp[] = {bnd1, bnd2};
253 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)
ROL::Ptr< const Vector< Real > > get(size_type i) const
void applyScalingFunctionJacobian(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply scaling function Jacobian.
void activate(void)
Turn on bounds.
bool isActivated(void) const
Check if bounds are on.
Defines the linear algebra of vector space on a generic partitioned vector.
Contains definitions of custom data types in ROL.
Defines the linear algebra or vector space interface.
virtual const Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
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_
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...
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
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.
void applyInverseScalingFunction(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply inverse scaling function.
~BoundConstraint_Partitioned()
std::vector< Real >::size_type uint
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
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.
bool isLowerActivated(void) const
Check if lower bound are on.
bool isUpperActivated(void) const
Check if upper bound are on.
void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.