10 #ifndef PH_RISKOBJECTIVE_H
11 #define PH_RISKOBJECTIVE_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(
"Risk Measure").get(
"Name",
"CVaR");
95 quad_ = makePtr<QuantileQuadrangle<Real>>(parlist);
break;
97 quad_ = makePtr<MoreauYosidaCVaR<Real>>(parlist);
break;
99 quad_ = makePtr<GenMoreauYosidaCVaR<Real>>(parlist);
break;
101 quad_ = makePtr<LogExponentialQuadrangle<Real>>(parlist);
break;
103 quad_ = makePtr<MeanVarianceQuadrangle<Real>>(parlist);
break;
105 quad_ = makePtr<TruncatedMeanQuadrangle<Real>>(parlist);
break;
107 quad_ = makePtr<LogQuantileQuadrangle<Real>>(parlist);
break;
109 quad_ = makePtr<SmoothedWorstCaseQuadrangle<Real>>(parlist);
break;
115 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
116 "Invalid risk measure type " << risk <<
"!");
122 obj_->update(*xvec,flag,iter);
131 Real reg =
quad_->regret(
val_-(*xstat)[0],0);
132 return (*xstat)[0] + reg;
137 Ptr<std::vector<Real>> gstat =
getStat(g);
141 Real reg =
quad_->regret(
val_-(*xstat)[0],1);
143 gvec->set(*
g_); gvec->scale(reg);
144 (*gstat)[0] =
static_cast<Real
>(1)-reg;
149 Ptr<std::vector<Real>> hstat =
getStat(hv);
155 Real reg1 =
quad_->regret(
val_-(*xstat)[0],1);
156 Real reg2 =
quad_->regret(
val_-(*xstat)[0],2);
159 Real gv = vvec->apply(*
g_);
160 obj_->hessVec(*hvec,*vvec,*xvec,tol);
161 hvec->scale(reg1); hvec->axpy(reg2*(gv-(*vstat)[0]),*
g_);
162 (*hstat)[0] = reg2*((*vstat)[0]-gv);
166 obj_->setParameter(param);
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.
Ptr< Vector< Real > > getVector(Vector< Real > &x) const
Ptr< const Vector< Real > > getConstVector(const Vector< Real > &x) const
ERiskMeasure StringToERiskMeasure(std::string s)
void getGradient(const Vector< Real > &x, Real &tol)
Defines the linear algebra or vector space interface.
PH_RiskObjective(const Ptr< Objective< Real >> &obj, ParameterList &parlist)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Provides the interface for the progressive hedging risk objective.
Ptr< std::vector< Real > > getStatistic(const int comp=0, const int index=0)
Ptr< const std::vector< Real > > getConstStat(const Vector< Real > &x) const
Ptr< ExpectationQuad< Real > > quad_
virtual void setParameter(const std::vector< Real > ¶m)
void getValue(const Vector< Real > &x, Real &tol)
Ptr< const Vector< Real > > getVector(void) const
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Ptr< std::vector< Real > > getStat(Vector< Real > &x) const
Real value(const Vector< Real > &x, Real &tol)
Compute value.
void setParameter(const std::vector< Real > ¶m)
bool isGradientInitialized_
const Ptr< Objective< Real > > obj_