44 #ifndef ROL_SIMULATED_OBJECTIVE_CVAR_H
45 #define ROL_SIMULATED_OBJECTIVE_CVAR_H
57 const ROL::Ptr<SampleGenerator<Real> >
sampler_;
58 const ROL::Ptr<Objective_SimOpt<Real> >
pobj_;
59 const ROL::Ptr<PlusFunction<Real> >
pfunc_;
73 pobj_->update(x,flag,iter);
77 pobj_->update(x,type,iter);
83 ROL::Ptr<const Vector<Real> > uptr = uz.
get_1();
84 ROL::Ptr<const Vector<Real> > zptr = uz.
get_2();
88 ROL::Ptr<const Vector<Real> > z = rz.
getVector();
90 std::vector<Real> param;
91 Real weight(0), one(1);
97 param =
sampler_->getMyPoint(static_cast<int>(i));
98 weight =
sampler_->getMyWeight(static_cast<int>(i));
99 pobj_->setParameter(param);
102 tmpval =
pobj_->value(*(pu.
get(i)), *z, tol);
103 tmpplus =
pfunc_->evaluate(tmpval-t, 0);
104 tmpsum += tmpplus*weight;
107 val *= (one/(one-
alpha_));
118 ROL::Ptr<const Vector<Real> > xuptr = xuz.
get_1();
119 ROL::Ptr<const Vector<Real> > xzptr = xuz.
get_2();
123 ROL::Ptr<const Vector<Real> > xz = rxz.
getVector();
126 ROL::Ptr<Vector<Real> > guptr = guz.
get_1();
127 ROL::Ptr<Vector<Real> > gzptr = guz.
get_2();
130 ROL::Ptr<Vector<Real> > gz = rgz.
getVector();
132 std::vector<Real> param;
133 Real weight(0), one(1), sum(0), tmpsum(0), tmpval(0), tmpplus(0);
136 ROL::Ptr<Vector<Real> > tmp1 = gz->clone();
137 ROL::Ptr<Vector<Real> > tmp2 = gz->clone();
139 param =
sampler_->getMyPoint(static_cast<int>(i));
140 weight =
sampler_->getMyWeight(static_cast<int>(i));
141 pobj_->setParameter(param);
144 tmpval =
pobj_->value(*(pxu.
get(i)), *xz, tol);
145 tmpplus =
pfunc_->evaluate(tmpval-xt, 1);
146 tmpsum += weight*tmpplus;
150 pobj_->gradient(gi, xi, tol);
151 gi.scale(weight*tmpplus);
158 gz->scale(one/(one-
alpha_));
Provides the interface to evaluate objective functions.
Provides the interface to evaluate simulation-based objective functions.
typename PV< Real >::size_type size_type
const ROL::Ptr< PlusFunction< Real > > pfunc_
ROL::Ptr< const Vector< Real > > get_2() const
Defines the linear algebra or vector space interface for simulation-based optimization.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
SimulatedObjectiveCVaR(const ROL::Ptr< SampleGenerator< Real > > &sampler, const ROL::Ptr< Objective_SimOpt< Real > > &pobj, const ROL::Ptr< PlusFunction< Real > > &pfunc, const Real &alpha)
void setStatistic(const Real stat, const int comp=0, const int index=0)
virtual void zero()
Set to zero vector.
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...
ROL::Ptr< const Vector< Real > > get(size_type i) const
size_type numVectors() const
Ptr< std::vector< Real > > getStatistic(const int comp=0, const int index=0)
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual ~SimulatedObjectiveCVaR()
const ROL::Ptr< SampleGenerator< Real > > sampler_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Ptr< const Vector< Real > > getVector(void) const
const ROL::Ptr< Objective_SimOpt< Real > > pobj_
ROL::Ptr< const Vector< Real > > get_1() const