10 #ifndef ROL_SIMULATED_OBJECTIVE_CVAR_H
11 #define ROL_SIMULATED_OBJECTIVE_CVAR_H
23 const ROL::Ptr<SampleGenerator<Real> >
sampler_;
24 const ROL::Ptr<Objective_SimOpt<Real> >
pobj_;
25 const ROL::Ptr<PlusFunction<Real> >
pfunc_;
39 pobj_->update(x,flag,iter);
43 pobj_->update(x,type,iter);
49 ROL::Ptr<const Vector<Real> > uptr = uz.
get_1();
50 ROL::Ptr<const Vector<Real> > zptr = uz.
get_2();
54 ROL::Ptr<const Vector<Real> > z = rz.
getVector();
56 std::vector<Real> param;
57 Real weight(0), one(1);
63 param =
sampler_->getMyPoint(static_cast<int>(i));
64 weight =
sampler_->getMyWeight(static_cast<int>(i));
65 pobj_->setParameter(param);
68 tmpval =
pobj_->value(*(pu.
get(i)), *z, tol);
69 tmpplus =
pfunc_->evaluate(tmpval-t, 0);
70 tmpsum += tmpplus*weight;
84 ROL::Ptr<const Vector<Real> > xuptr = xuz.
get_1();
85 ROL::Ptr<const Vector<Real> > xzptr = xuz.
get_2();
89 ROL::Ptr<const Vector<Real> > xz = rxz.
getVector();
92 ROL::Ptr<Vector<Real> > guptr = guz.
get_1();
93 ROL::Ptr<Vector<Real> > gzptr = guz.
get_2();
96 ROL::Ptr<Vector<Real> > gz = rgz.
getVector();
98 std::vector<Real> param;
99 Real weight(0), one(1), sum(0), tmpsum(0), tmpval(0), tmpplus(0);
102 ROL::Ptr<Vector<Real> > tmp1 = gz->clone();
103 ROL::Ptr<Vector<Real> > tmp2 = gz->clone();
105 param =
sampler_->getMyPoint(static_cast<int>(i));
106 weight =
sampler_->getMyWeight(static_cast<int>(i));
107 pobj_->setParameter(param);
110 tmpval =
pobj_->value(*(pxu.
get(i)), *xz, tol);
111 tmpplus =
pfunc_->evaluate(tmpval-xt, 1);
112 tmpsum += weight*tmpplus;
116 pobj_->gradient(gi, xi, tol);
117 gi.scale(weight*tmpplus);
124 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