10 #ifndef ROL_PD_MEANSEMIDEVIATION_HPP
11 #define ROL_PD_MEANSEMIDEVIATION_HPP
47 values_ = makePtr<ScalarController<Real>>();
48 gradvecs_ = makePtr<ScalarController<Real>>();
49 gradients_ = makePtr<VectorController<Real>>();
50 hessvecs_ = makePtr<VectorController<Real>>();
63 ROL_TEST_FOR_EXCEPTION((
coeff_ < zero), std::invalid_argument,
64 ">>> ERROR (ROL::PD_MeanSemiDeviation): Element of coefficient array out of range!");
95 const std::vector<Real> &xstat,
102 const std::vector<Real> &xstat,
108 Real diff(0), pf0(0), dev(0), weight(0), lam(0);
117 sampler.
sumAll(&pf0,&dev,1);
125 const std::vector<Real> &xstat,
134 std::vector<Real> &gstat,
136 const std::vector<Real> &xstat,
143 Real diff(0), pf(0), pf1(0), dev(0), one(1), weight(0), lam(0);
154 sampler.
sumAll(&pf,&dev,1);
162 const std::vector<Real> &vstat,
164 const std::vector<Real> &xstat,
176 std::vector<Real> &hvstat,
178 const std::vector<Real> &vstat,
180 const std::vector<Real> &xstat,
184 std::vector<Real> mval(2), gval(2);
186 sampler.
sumAll(&mval[0],&gval[0],2);
187 Real ev = gval[0], egv = gval[1];
189 std::vector<Real> mvec(3), gvec(3);
190 Real diff(0), gv(0), pf1(0), pf2(0), weight(0), lam(0);
199 mvec[0] += weight * pf1;
200 mvec[1] += weight * pf2;
201 mvec[2] += weight * pf2 * gv;
203 sampler.
sumAll(&mvec[0],&gvec[0],3);
204 Real c1 = one -
coeff_ * gvec[0];
205 Real c2 =
coeff_ * (gvec[1]*egv - gvec[2]);
Provides the interface to evaluate objective functions.
void computeHessVec(Vector< Real > &hv, Objective< Real > &obj, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
virtual void setHessVecStorage(const Ptr< ScalarController< Real >> &gradvec_storage, const Ptr< VectorController< Real >> &hessvec_storage)
Real computeValue(Objective< Real > &obj, const Vector< Real > &x, Real &tol)
virtual void plus(const Vector &x)=0
Compute , where .
Ptr< Vector< Real > > hv_
Ptr< ScalarController< Real > > values_
Real ppf(const Real x, const Real t, const Real r, const int deriv=0) const
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Return risk measure value.
void initializeStorage(void)
virtual std::vector< Real > getMyPoint(const int i) const
Real getPenaltyParameter(void) const
virtual Real getMyWeight(const int i) const
Ptr< Vector< Real > > dualVector_
void setHessVecStorage(const Ptr< ScalarController< Real >> &gradvec_storage, const Ptr< VectorController< Real >> &hessvec_storage)
virtual void setStorage(const Ptr< ScalarController< Real >> &value_storage, const Ptr< VectorController< Real >> &gradient_storage)
Defines the linear algebra or vector space interface.
virtual int numMySamples(void) const
void updateGradient(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Update internal risk measure storage for gradient computation.
void sumAll(Real *input, Real *output, int dim) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
void setStorage(const Ptr< ScalarController< Real >> &value_storage, const Ptr< VectorController< Real >> &gradient_storage)
void getHessVec(Vector< Real > &hv, std::vector< Real > &hvstat, const Vector< Real > &v, const std::vector< Real > &vstat, const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Return risk measure Hessian-times-a-vector.
virtual void setStorage(const Ptr< ScalarController< Real >> &value_storage, const Ptr< VectorController< Real >> &gradient_storage)
void getMultiplier(Real &lam, const std::vector< Real > &pt) const
void computeGradient(Vector< Real > &g, Objective< Real > &obj, const Vector< Real > &x, Real &tol)
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
Real computeGradVec(Vector< Real > &g, Objective< Real > &obj, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Provides the interface to implement any functional that maps a random variable to a (extended) real n...
void setValue(const Real val, const std::vector< Real > &pt)
PD_MeanSemiDeviation(const Real coeff)
Ptr< VectorController< Real > > hessvecs_
void updateValue(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Update internal storage for value computation.
virtual void setHessVecStorage(const Ptr< ScalarController< Real >> &gradvec_storage, const Ptr< VectorController< Real >> &hessvec_storage)
void getGradient(Vector< Real > &g, std::vector< Real > &gstat, const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Return risk measure (sub)gradient.
void updateHessVec(Objective< Real > &obj, const Vector< Real > &v, const std::vector< Real > &vstat, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Update internal risk measure storage for Hessian-time-a-vector computation.
void initialize(const Vector< Real > &x)
Initialize temporary variables.
Ptr< VectorController< Real > > gradients_
Ptr< ScalarController< Real > > gradvecs_