44#ifndef ROL_BOUND_CONSTRAINT_PARTITIONED_H
45#define ROL_BOUND_CONSTRAINT_PARTITIONED_H
60template<
typename Real>
65 typedef typename std::vector<Real>::size_type
uint;
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) {
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)));
224 PV &dvpv =
dynamic_cast<PV&
>(dv);
225 const PV &vpv =
dynamic_cast<const PV&
>(v);
226 const PV &xpv =
dynamic_cast<const PV&
>(x);
227 const PV &gpv =
dynamic_cast<const PV&
>(g);
230 bnd_[k]->applyInverseScalingFunction(*(dvpv.
get(k)),*(vpv.
get(k)),*(xpv.
get(k)),*(gpv.
get(k)));
236 PV &dvpv =
dynamic_cast<PV&
>(dv);
237 const PV &vpv =
dynamic_cast<const PV&
>(v);
238 const PV &xpv =
dynamic_cast<const PV&
>(x);
239 const PV &gpv =
dynamic_cast<const PV&
>(g);
242 bnd_[k]->applyScalingFunctionJacobian(*(dvpv.
get(k)),*(vpv.
get(k)),*(xpv.
get(k)),*(gpv.
get(k)));
250template<
typename Real>
251Ptr<BoundConstraint<Real>>
258 Ptr<BND> temp[] = {bnd1, bnd2};
259 return makePtr<BNDP>( std::vector<Ptr<BND>>(temp,temp+2) );
Contains definitions of custom data types in ROL.
A composite composite BoundConstraint formed from bound constraints on subvectors of a PartitionedVec...
BoundConstraint_Partitioned(const std::vector< Ptr< BoundConstraint< Real > > > &bnd, const std::vector< Ptr< Vector< Real > > > &x)
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.
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 applyScalingFunctionJacobian(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply scaling function Jacobian.
void applyInverseScalingFunction(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply inverse scaling function.
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)