10 #ifndef PH_DEVIATIONOBJECTIVE_H
11 #define PH_DEVIATIONOBJECTIVE_H
27 const Ptr<Objective<Real>>
obj_;
28 Ptr<ExpectationQuad<Real>>
quad_;
68 if (xstat == nullPtr) {
69 xstat = makePtr<const std::vector<Real>>(0);
77 if (xstat == nullPtr) {
78 xstat = makePtr<std::vector<Real>>(0);
86 ParameterList &parlist)
91 std::string risk = parlist.sublist(
"SOL").sublist(
"Deviation Measure").get(
"Name",
"Variance");
95 quad_ = makePtr<MeanVarianceQuadrangle<Real>>(parlist);
break;
97 quad_ = makePtr<TruncatedMeanQuadrangle<Real>>(parlist);
break;
99 quad_ = makePtr<QuantileQuadrangle<Real>>(parlist);
break;
101 quad_ = makePtr<MoreauYosidaCVaR<Real>>(parlist);
break;
103 quad_ = makePtr<GenMoreauYosidaCVaR<Real>>(parlist);
break;
105 quad_ = makePtr<LogExponentialQuadrangle<Real>>(parlist);
break;
107 quad_ = makePtr<LogQuantileQuadrangle<Real>>(parlist);
break;
109 quad_ = makePtr<SmoothedWorstCaseQuadrangle<Real>>(parlist);
break;
111 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
112 "Invalid deviation measure type " << risk <<
"!");
118 obj_->update(*xvec,flag,iter);
127 Real err =
quad_->error(
val_-(*xstat)[0],0);
133 Ptr<std::vector<Real>> gstat =
getStat(g);
137 Real err =
quad_->error(
val_-(*xstat)[0],1);
139 gvec->set(*
g_); gvec->scale(err);
145 Ptr<std::vector<Real>> hstat =
getStat(hv);
151 Real err1 =
quad_->error(
val_-(*xstat)[0],1);
152 Real err2 =
quad_->error(
val_-(*xstat)[0],2);
155 Real gv = vvec->apply(*
g_);
156 obj_->hessVec(*hvec,*vvec,*xvec,tol);
157 hvec->scale(err1); hvec->axpy(err2*(gv-(*vstat)[0]),*
g_);
158 (*hstat)[0] = err2*((*vstat)[0]-gv);
162 obj_->setParameter(param);
const Ptr< Objective< Real > > obj_
Provides the interface to evaluate objective functions.
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.
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)
Ptr< std::vector< Real > > getStatistic(const int comp=0, const int index=0)
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< const Vector< Real > > getVector(void) const
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)