44 #ifndef ROL_SIMULATED_OBJECTIVE_CVAR_H 45 #define ROL_SIMULATED_OBJECTIVE_CVAR_H 57 const Teuchos::RCP<SampleGenerator<Real> >
sampler_;
58 const Teuchos::RCP<Objective_SimOpt<Real> >
pobj_;
59 const Teuchos::RCP<PlusFunction<Real> >
pfunc_;
70 : sampler_(sampler), pobj_(pobj), pfunc_(pfunc), alpha_(alpha) {}
73 pobj_->update(x,flag,iter);
79 Teuchos::RCP<const Vector<Real> > uptr = uz.
get_1();
80 Teuchos::RCP<const Vector<Real> > zptr = uz.
get_2();
84 Teuchos::RCP<const Vector<Real> > z = rz.
getVector();
86 std::vector<Real> param;
87 Real weight(0), one(1);
93 param = sampler_->getMyPoint(static_cast<int>(i));
94 weight = sampler_->getMyWeight(static_cast<int>(i));
95 pobj_->setParameter(param);
97 pobj_->update(*(pu.
get(i)), *z);
98 tmpval = pobj_->value(*(pu.
get(i)), *z, tol);
99 tmpplus = pfunc_->evaluate(tmpval-t, 0);
100 tmpsum += tmpplus*weight;
102 sampler_->sumAll(&tmpsum, &val, 1);
103 val *= (one/(one-
alpha_));
114 Teuchos::RCP<const Vector<Real> > xuptr = xuz.
get_1();
115 Teuchos::RCP<const Vector<Real> > xzptr = xuz.
get_2();
119 Teuchos::RCP<const Vector<Real> > xz = rxz.
getVector();
122 Teuchos::RCP<Vector<Real> > guptr = guz.
get_1();
123 Teuchos::RCP<Vector<Real> > gzptr = guz.
get_2();
126 Teuchos::RCP<Vector<Real> > gz = rgz.
getVector();
128 std::vector<Real> param;
129 Real weight(0), one(1), sum(0), tmpsum(0), tmpval(0), tmpplus(0);
132 Teuchos::RCP<Vector<Real> > tmp1 = gz->clone();
133 Teuchos::RCP<Vector<Real> > tmp2 = gz->clone();
135 param = sampler_->getMyPoint(static_cast<int>(i));
136 weight = sampler_->getMyWeight(static_cast<int>(i));
137 pobj_->setParameter(param);
138 pobj_->update(*(pxu.
get(i)), *xz);
140 tmpval = pobj_->value(*(pxu.
get(i)), *xz, tol);
141 tmpplus = pfunc_->evaluate(tmpval-xt, 1);
142 tmpsum += weight*tmpplus;
146 pobj_->gradient(gi, xi, tol);
147 gi.
scale(weight*tmpplus);
149 pgu.
get(i)->scale(one/(one-alpha_));
153 sampler_->sumAll(*tmp2, *gz);
154 gz->scale(one/(one-alpha_));
155 sampler_->sumAll(&tmpsum, &sum, 1);
Provides the interface to evaluate objective functions.
Provides the interface to evaluate simulation-based objective functions.
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.
size_type numVectors() const
Teuchos::RCP< const Vector< Real > > get_2() const
const Teuchos::RCP< SampleGenerator< Real > > sampler_
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
Teuchos::RCP< const Vector< Real > > getVector(void) const
Defines the linear algebra of a vector space on a generic partitioned vector where the individual vec...
void setStatistic(const Real stat)
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
void scale(const Real alpha)
Compute where .
Teuchos::RCP< const Vector< Real > > get_1() const
virtual ~SimulatedObjectiveCVaR()
const Teuchos::RCP< Objective_SimOpt< Real > > pobj_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
SimulatedObjectiveCVaR(const Teuchos::RCP< SampleGenerator< Real > > &sampler, const Teuchos::RCP< Objective_SimOpt< Real > > &pobj, const Teuchos::RCP< PlusFunction< Real > > &pfunc, const Real &alpha)
Teuchos::RCP< const StdVector< Real > > getStatistic(void) const
const Teuchos::RCP< PlusFunction< Real > > pfunc_
Teuchos::RCP< const Vector< Real > > get(size_type i) const