44 #ifndef PH_RISKOBJECTIVE_H
45 #define PH_RISKOBJECTIVE_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(
"Risk Measure").get(
"Name",
"CVaR");
129 quad_ = makePtr<QuantileQuadrangle<Real>>(parlist);
break;
131 quad_ = makePtr<MoreauYosidaCVaR<Real>>(parlist);
break;
133 quad_ = makePtr<GenMoreauYosidaCVaR<Real>>(parlist);
break;
135 quad_ = makePtr<LogExponentialQuadrangle<Real>>(parlist);
break;
137 quad_ = makePtr<MeanVarianceQuadrangle<Real>>(parlist);
break;
139 quad_ = makePtr<TruncatedMeanQuadrangle<Real>>(parlist);
break;
141 quad_ = makePtr<LogQuantileQuadrangle<Real>>(parlist);
break;
143 quad_ = makePtr<SmoothedWorstCaseQuadrangle<Real>>(parlist);
break;
149 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
150 "Invalid risk measure type " << risk <<
"!");
156 obj_->update(*xvec,flag,iter);
165 Real reg =
quad_->regret(
val_-(*xstat)[0],0);
166 return (*xstat)[0] + reg;
171 Ptr<std::vector<Real>> gstat =
getStat(g);
175 Real reg =
quad_->regret(
val_-(*xstat)[0],1);
177 gvec->set(*
g_); gvec->scale(reg);
178 (*gstat)[0] =
static_cast<Real
>(1)-reg;
183 Ptr<std::vector<Real>> hstat =
getStat(hv);
189 Real reg1 =
quad_->regret(
val_-(*xstat)[0],1);
190 Real reg2 =
quad_->regret(
val_-(*xstat)[0],2);
192 Real gv = vvec->dot(
g_->dual());
193 obj_->hessVec(*hvec,*vvec,*xvec,tol);
194 hvec->scale(reg1); hvec->axpy(reg2*(gv-(*vstat)[0]),*
g_);
195 (*hstat)[0] = reg2*((*vstat)[0]-gv);
199 obj_->setParameter(param);
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.
Ptr< Vector< Real > > getVector(Vector< Real > &x) const
ROL::Ptr< const Vector< Real > > getVector(void) 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< 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)
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_