44 #ifndef PH_DEVIATIONOBJECTIVE_H
45 #define PH_DEVIATIONOBJECTIVE_H
61 const Ptr<Objective<Real>>
obj_;
62 Ptr<ExpectationQuad<Real>>
quad_;
101 Ptr<const std::vector<Real>> xstat = xrv.
getStatistic();
102 if (xstat == nullPtr) {
103 xstat = makePtr<const std::vector<Real>>(0);
111 if (xstat == nullPtr) {
112 xstat = makePtr<std::vector<Real>>(0);
120 ParameterList &parlist)
125 std::string risk = parlist.sublist(
"SOL").sublist(
"Deviation Measure").get(
"Name",
"Variance");
129 quad_ = makePtr<MeanVarianceQuadrangle<Real>>(parlist);
break;
131 quad_ = makePtr<TruncatedMeanQuadrangle<Real>>(parlist);
break;
133 quad_ = makePtr<QuantileQuadrangle<Real>>(parlist);
break;
135 quad_ = makePtr<MoreauYosidaCVaR<Real>>(parlist);
break;
137 quad_ = makePtr<GenMoreauYosidaCVaR<Real>>(parlist);
break;
139 quad_ = makePtr<LogExponentialQuadrangle<Real>>(parlist);
break;
141 quad_ = makePtr<LogQuantileQuadrangle<Real>>(parlist);
break;
143 quad_ = makePtr<SmoothedWorstCaseQuadrangle<Real>>(parlist);
break;
145 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
146 "Invalid deviation measure type " << risk <<
"!");
152 obj_->update(*xvec,flag,iter);
161 Real err =
quad_->error(
val_-(*xstat)[0],0);
167 Ptr<std::vector<Real>> gstat =
getStat(g);
171 Real err =
quad_->error(
val_-(*xstat)[0],1);
173 gvec->set(*
g_); gvec->scale(err);
179 Ptr<std::vector<Real>> hstat =
getStat(hv);
185 Real err1 =
quad_->error(
val_-(*xstat)[0],1);
186 Real err2 =
quad_->error(
val_-(*xstat)[0],2);
188 Real gv = vvec->dot(
g_->dual());
189 obj_->hessVec(*hvec,*vvec,*xvec,tol);
190 hvec->scale(err1); hvec->axpy(err2*(gv-(*vstat)[0]),*
g_);
191 (*hstat)[0] = err2*((*vstat)[0]-gv);
195 obj_->setParameter(param);
const Ptr< Objective< Real > > obj_
Provides the interface to evaluate objective functions.
ROL::Ptr< std::vector< Real > > getStatistic(const int comp=0, const int index=0)
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Provides the interface for the progressive hedging deviation objective.
ROL::Ptr< const Vector< Real > > getVector(void) const
bool isGradientInitialized_
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Ptr< const Vector< Real > > getConstVector(const Vector< Real > &x) const
void getGradient(const Vector< Real > &x, Real &tol)
Defines the linear algebra or vector space interface.
void setParameter(const std::vector< Real > ¶m)
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Ptr< const std::vector< Real > > getConstStat(const Vector< Real > &x) const
void getValue(const Vector< Real > &x, Real &tol)
virtual void setParameter(const std::vector< Real > ¶m)
Ptr< Vector< Real > > getVector(Vector< Real > &x) const
PH_DeviationObjective(const Ptr< Objective< Real >> &obj, ParameterList &parlist)
Ptr< ExpectationQuad< Real > > quad_
Ptr< std::vector< Real > > getStat(Vector< Real > &x) const
EDeviationMeasure StringToEDeviationMeasure(std::string s)