10 #ifndef PH_OBJECTIVE_H
11 #define PH_OBJECTIVE_H
40 const Real penaltyParam,
41 ParameterList &parlist)
45 std::string type = parlist.sublist(
"SOL").get(
"Type",
"Risk Neutral");
46 if (type ==
"Risk Averse") {
47 obj_ = makePtr<PH_RiskObjective<Real>>(obj,parlist);
49 else if (type ==
"Deviation") {
50 obj_ = makePtr<PH_DeviationObjective<Real>>(obj,parlist);
52 else if (type ==
"Regret") {
53 obj_ = makePtr<PH_RegretObjective<Real>>(obj,parlist);
55 else if (type ==
"Error") {
56 obj_ = makePtr<PH_ErrorObjective<Real>>(obj,parlist);
58 else if (type ==
"Probability") {
59 std::string prob = parlist.sublist(
"SOL").sublist(
"Probability").get(
"Name",
"bPOE");
60 if (prob ==
"Smoothed POE") {
61 obj_ = makePtr<PH_ProbObjective<Real>>(obj,parlist);
63 else if (prob ==
"bPOE") {
64 obj_ = makePtr<PH_bPOEObjective<Real>>(obj,parlist);
67 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
68 "Invalid probability type " << prob <<
"!");
71 else if (type ==
"Risk Neutral") {
75 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
76 "Invalid stochastic component type " << type <<
"!");
82 const Real penaltyParam) {
89 obj_->update(x,flag,iter);
93 const Real half(0.5), one(1);
94 Real val =
obj_->value(x,tol);
103 obj_->gradient(g,x,tol);
111 obj_->hessVec(hv,v,x,tol);
116 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...
Real value(const Vector< Real > &x, Real &tol)
Compute value.
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Ptr< Objective< Real > > obj_
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
Provides the interface for the progressive hedging objective.
void setData(const Ptr< const Vector< Real >> &xbar, const Ptr< const Vector< Real >> &w, const Real penaltyParam)
Ptr< const Vector< Real > > w_
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual void setParameter(const std::vector< Real > ¶m)
Ptr< Vector< Real > > xprimal_
PH_Objective(const Ptr< Objective< Real >> &obj, const Ptr< Vector< Real >> &x, const Real penaltyParam, ParameterList &parlist)
Ptr< const Vector< Real > > xbar_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
void setParameter(const std::vector< Real > ¶m)