44 #ifndef ROL_SIMULATED_BOUND_CONSTRAINT_H
45 #define ROL_SIMULATED_BOUND_CONSTRAINT_H
61 const ROL::Ptr<SampleGenerator<Real> >
sampler_;
62 const ROL::Ptr<BoundConstraint<Real> >
bnd_;
63 ROL::Ptr<Vector<Real> >
l_;
64 ROL::Ptr<Vector<Real> >
u_;
70 catch (
const std::bad_cast &e) {
79 catch (
const std::bad_cast &e) {
90 int nsamp =
sampler_->numMySamples();
91 std::vector<ROL::Ptr<Vector<Real> > > lvec(nsamp), uvec(nsamp);
92 for (
int k=0; k<
sampler_->numMySamples(); ++k) {
93 lvec[k] =
bnd_->getLowerBound()->clone();
94 lvec[k]->set(*
bnd_->getLowerBound());
95 uvec[k] =
bnd_->getUpperBound()->clone();
96 uvec[k]->set(*
bnd_->getUpperBound());
98 l_ = ROL::makePtr<SimulatedVector<Real>>(lvec,
sampler_->getBatchManager());
99 u_ = ROL::makePtr<SimulatedVector<Real>>(uvec,
sampler_->getBatchManager());
103 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
104 if(
bnd_->isActivated() ) {
111 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
112 if(
bnd_->isActivated() ) {
119 if(
bnd_->isActivated() ) {
120 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
127 if(
bnd_->isActivated() ) {
128 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
135 if(
bnd_->isActivated() ) {
136 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
143 if(
bnd_->isActivated() ) {
144 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
159 bool feasible =
true;
160 if(
bnd_->isActivated()) {
161 for(
int k=0; k<
sampler_->numMySamples(); ++k ) {
SimulatedBoundConstraint(const ROL::Ptr< SampleGenerator< Real > > &sampler, const ROL::Ptr< BoundConstraint< Real > > &bnd)
const ROL::Ptr< BoundConstraint< Real > > bnd_
const ROL::Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
A BoundConstraint formed from a single bound constraint replacated according to a SampleGenerator...
void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible 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.
ROL::Ptr< Vector< Real > > u_
Defines the linear algebra or vector space interface.
Defines the linear algebra of a vector space on a generic partitioned vector where the individual vec...
const Vector< Real > & getVector(const Vector< Real > &x, int k) const
const ROL::Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
const ROL::Ptr< SampleGenerator< Real > > sampler_
~SimulatedBoundConstraint()
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
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 -binding set.
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.
ROL::Ptr< Vector< Real > > l_
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.
Vector< Real > & getVector(Vector< Real > &x, int k)