44 #ifndef PH_OBJECTIVE_H
45 #define PH_OBJECTIVE_H
74 const Real penaltyParam,
75 ParameterList &parlist)
79 std::string type = parlist.sublist(
"SOL").get(
"Stochastic Component Type",
"Risk Neutral");
80 if (type ==
"Risk Averse") {
81 obj_ = makePtr<PH_RiskObjective<Real>>(obj,parlist);
83 else if (type ==
"Deviation") {
84 obj_ = makePtr<PH_DeviationObjective<Real>>(obj,parlist);
86 else if (type ==
"Regret") {
87 obj_ = makePtr<PH_RegretObjective<Real>>(obj,parlist);
89 else if (type ==
"Error") {
90 obj_ = makePtr<PH_ErrorObjective<Real>>(obj,parlist);
92 else if (type ==
"Probability") {
93 std::string prob = parlist.sublist(
"SOL").sublist(
"Probability").get(
"Name",
"bPOE");
94 if (prob ==
"Smoothed POE") {
95 obj_ = makePtr<PH_ProbObjective<Real>>(obj,parlist);
97 else if (prob ==
"bPOE") {
98 obj_ = makePtr<PH_bPOEObjective<Real>>(obj,parlist);
101 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
102 "Invalid probability type " << prob <<
"!");
105 else if (type ==
"Risk Neutral") {
109 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
110 "Invalid stochastic component type " << type <<
"!");
116 const Real penaltyParam) {
123 obj_->update(x,flag,iter);
127 const Real half(0.5), one(1);
128 Real val =
obj_->value(x,tol);
129 Real wx = x.
dot(*
w_);
137 obj_->gradient(g,x,tol);
145 obj_->hessVec(hv,v,x,tol);
150 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)