44 #ifndef ROL_BOUND_CONSTRAINT_PARTITIONED_H 45 #define ROL_BOUND_CONSTRAINT_PARTITIONED_H 65 typedef typename std::vector<Real>::size_type
uint;
68 std::vector<Teuchos::RCP<BoundConstraint<Real> > >
bnd_;
86 std::cout <<
bnd_[k]->isActivated() << std::endl;
92 std::cout << BoundConstraint<Real>::isActivated() << std::endl;
93 std::vector<Teuchos::RCP<Vector<Real> > > lp;
94 std::vector<Teuchos::RCP<Vector<Real> > > up;
101 l_ = Teuchos::rcp(
new PV(lp) );
102 u_ = Teuchos::rcp(
new PV(up) );
115 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
119 bnd_[k]->update(*(xpv.
get(k)),flag,iter);
134 PV &xpv = Teuchos::dyn_cast<
PV>(x);
155 PV &vpv = Teuchos::dyn_cast<
PV>(v);
156 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
160 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(xpv.get(k)),eps);
183 PV &vpv = Teuchos::dyn_cast<
PV>(v);
184 const PV &gpv = Teuchos::dyn_cast<
const PV>(g);
185 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
189 bnd_[k]->pruneUpperActive(*(vpv.
get(k)),*(gpv.get(k)),*(xpv.get(k)),eps);
210 PV &vpv = Teuchos::dyn_cast<
PV>(v);
211 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
215 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(xpv.get(k)),eps);
237 PV &vpv = Teuchos::dyn_cast<
PV>(v);
238 const PV &gpv = Teuchos::dyn_cast<
const PV>(g);
239 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
243 bnd_[k]->pruneLowerActive(*(vpv.
get(k)),*(gpv.get(k)),*(xpv.get(k)),eps);
316 PV &vpv = Teuchos::dyn_cast<
PV>(v);
317 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
324 bnd_[k]->pruneActive(*(vpv.
get(k)),*(xpv.get(k)),eps);
343 PV &vpv = Teuchos::dyn_cast<
PV>(v);
344 const PV &gpv = Teuchos::dyn_cast<
const PV>(g);
345 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
354 bnd_[k]->pruneActive(*(vpv.
get(k)),*(gpv.get(k)),*(xpv.get(k)),eps);
366 bool feasible =
true;
367 const PV &vs = Teuchos::dyn_cast<
const PV>(v);
371 feasible = feasible &&
bnd_[k]->isFeasible(*(vs.
get(k)));
402 Teuchos::RCP<BoundConstraint<Real> >
406 using Teuchos::RCP;
using Teuchos::rcp;
409 RCP<BND> temp[] = {bnd1, bnd2};
410 return rcp(
new BNDP( std::vector<RCP<BND> >(temp,temp+2) ) );
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the -active set.
void activate(void)
Turn on bounds.
Teuchos::RCP< BoundConstraint< Real > > CreateBoundConstraint_Partitioned(const Teuchos::RCP< BoundConstraint< Real > > &bnd1, const Teuchos::RCP< BoundConstraint< Real > > &bnd2)
Defines the linear algebra of vector space on a generic partitioned vector.
Teuchos::RCP< const Vector< Real > > get(size_type i) const
Contains definitions of custom data types in ROL.
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 setVectorToLowerBound(Vector< Real > &l)
Set the input vector to the lower bound.
BoundConstraint_Partitioned(const std::vector< Teuchos::RCP< BoundConstraint< Real > > > &bnd)
Default constructor.
Defines the linear algebra or vector space interface.
void pruneActive(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.
const Teuchos::RCP< Vector< Real > > getUpperVectorRCP(void)
Return the ref count pointer to the upper bound vector.
void setVectorToUpperBound(Vector< Real > &u)
Set the input vector to the upper bound.
bool isActivated(void)
Check if bounds are on.
const Teuchos::RCP< const Vector< Real > > getUpperVectorRCP(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 eps=0.0)
Set variables to zero if they correspond to the lower -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.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update bounds.
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 eps=0.0)
Set variables to zero if they correspond to the upper -binding set.
Provides the interface to apply upper and lower bound constraints.
std::vector< Teuchos::RCP< BoundConstraint< Real > > > bnd_
~BoundConstraint_Partitioned()
std::vector< Real >::size_type uint
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
const Teuchos::RCP< const Vector< Real > > getLowerVectorRCP(void) const
Return the ref count pointer to the lower bound vector.
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
virtual void set(const Vector &x)
Set where .
PartitionedVector< Real > PV
void deactivate(void)
Turn off bounds.
const Teuchos::RCP< Vector< Real > > getLowerVectorRCP(void)
Return the ref count pointer to the lower bound vector.