10 #ifndef ROL_SIMULATED_OBJECTIVE_H
11 #define ROL_SIMULATED_OBJECTIVE_H
21 const ROL::Ptr<SampleGenerator<Real> >
sampler_;
22 const ROL::Ptr<Objective_SimOpt<Real> >
pobj_;
33 pobj_->update(x,flag,iter);
36 pobj_->update(x,type,iter);
43 ROL::Ptr<const Vector<Real> > uptr = uz.
get_1();
44 ROL::Ptr<const Vector<Real> > zptr = uz.
get_2();
47 std::vector<Real> param;
53 param =
sampler_->getMyPoint(static_cast<int>(i));
54 weight =
sampler_->getMyWeight(static_cast<int>(i));
55 pobj_->setParameter(param);
57 tmpval =
pobj_->value(*(pu.
get(i)), *zptr, tol);
58 tmpsum += tmpval*weight;
70 ROL::Ptr<const Vector<Real> > xuptr = xuz.
get_1();
71 ROL::Ptr<const Vector<Real> > xzptr = xuz.
get_2();
75 ROL::Ptr<Vector<Real> > guptr = guz.
get_1();
76 ROL::Ptr<Vector<Real> > gzptr = guz.
get_2();
79 std::vector<Real> param;
81 ROL::Ptr<Vector<Real> > tmp1 = gzptr->clone();
82 ROL::Ptr<Vector<Real> > tmp2 = gzptr->clone();
84 param =
sampler_->getMyPoint(static_cast<int>(i));
85 weight =
sampler_->getMyWeight(static_cast<int>(i));
86 pobj_->setParameter(param);
90 pobj_->gradient(gi, xi, tol);
106 ROL::Ptr<const Vector<Real> > xuptr = xuz.
get_1();
107 ROL::Ptr<const Vector<Real> > xzptr = xuz.
get_2();
111 ROL::Ptr<const Vector<Real> > vuptr = vuz.
get_1();
112 ROL::Ptr<const Vector<Real> > vzptr = vuz.
get_2();
116 ROL::Ptr<Vector<Real> > hvuptr = hvuz.
get_1();
117 ROL::Ptr<Vector<Real> > hvzptr = hvuz.
get_2();
120 std::vector<Real> param;
122 ROL::Ptr<Vector<Real> > tmp1 = hvzptr->clone();
123 ROL::Ptr<Vector<Real> > tmp2 = hvzptr->clone();
125 param =
sampler_->getMyPoint(static_cast<int>(i));
126 weight =
sampler_->getMyWeight(static_cast<int>(i));
127 pobj_->setParameter(param);
132 pobj_->hessVec(hvi, vi, xi, tol);
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< SampleGenerator< Real > > sampler_
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.
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
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
size_type numVectors() const
virtual ~SimulatedObjective()
const ROL::Ptr< Objective_SimOpt< Real > > pobj_
SimulatedObjective(const ROL::Ptr< SampleGenerator< Real > > &sampler, const ROL::Ptr< Objective_SimOpt< Real > > &pobj)
void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
ROL::Ptr< const Vector< Real > > get_1() const