44 #ifndef ROL_STOCHASTICOBJECTIVE_HPP
45 #define ROL_STOCHASTICOBJECTIVE_HPP
60 Ptr<RandVarFunctional<Real>>
rvf_;
83 if (xstat == nullPtr) {
84 xstat = makePtr<const std::vector<Real>>(0);
92 if (xstat == nullPtr) {
93 xstat = makePtr<std::vector<Real>>(0);
106 const bool storage =
true,
107 const int comp = 0,
const int index = 0 )
111 rvf->useStorage(storage);
118 const bool storage =
true,
119 const int comp = 0,
const int index = 0 )
125 const bool storage =
true,
126 const int comp = 0,
const int index = 0 )
130 ROL::ParameterList &parlist,
134 const int comp = 0,
const int index = 0 )
138 std::string type =parlist.sublist(
"SOL").get(
"Stochastic Component Type",
"Risk Averse");
140 if (type ==
"Risk Averse") {
141 name = parlist.sublist(
"SOL").sublist(
"Risk Measure").get(
"Name",
"CVaR");
144 if (type ==
"Risk Averse" && name ==
"Convex Combination Risk Measure") {
145 rvf_ = makePtr<ConvexCombinationRiskMeasure<Real>>(parlist);
148 rvf_ = RandVarFunctionalFactory<Real>(parlist);
150 bool storage = parlist.sublist(
"SOL").get(
"Store Sampled Value and Gradient",
true);
151 rvf_->useStorage(storage);
155 ROL::ParameterList &parlist,
158 const int comp = 0,
const int index = 0 )
162 ROL::ParameterList &parlist,
164 const int comp = 0,
const int index = 0 )
169 return rvf_->computeStatistic(xstat);
175 rvf_->resetStorage(flag);
177 obj_->update(*x0,flag,iter);
189 rvf_->initialize(*x0);
191 for (
int i = 0; i <
vsampler_->numMySamples(); i++ ) {
193 rvf_->updateValue(*
obj_,*x0,*xstat,tol);
204 Ptr<std::vector<Real>> gstat =
getStat(g);
205 rvf_->initialize(*x0);
206 for (
int i = 0; i <
gsampler_->numMySamples(); i++ ) {
208 rvf_->updateGradient(*
obj_,*x0,*xstat,tol);
221 Ptr<std::vector<Real>> hvstat =
getStat(hv);
222 rvf_->initialize(*x0);
223 for (
int i = 0; i <
hsampler_->numMySamples(); i++ ) {
225 rvf_->updateHessVec(*
obj_,*v0,*vstat,*x0,*xstat,tol);
227 rvf_->getHessVec(*hv0,*hvstat,*v0,*vstat,*x0,*xstat,*
hsampler_);