44 #ifndef ROL_PD_MEANSEMIDEVIATION_HPP
45 #define ROL_PD_MEANSEMIDEVIATION_HPP
81 values_ = makePtr<SampledScalar<Real>>();
82 gradvecs_ = makePtr<SampledScalar<Real>>();
84 hessvecs_ = makePtr<SampledVector<Real>>();
97 ROL_TEST_FOR_EXCEPTION((
coeff_ < zero), std::invalid_argument,
98 ">>> ERROR (ROL::PD_MeanSemiDeviation): Element of coefficient array out of range!");
129 const std::vector<Real> &xstat,
136 const std::vector<Real> &xstat,
142 Real diff(0), pf0(0), dev(0), weight(0), lam(0);
151 sampler.
sumAll(&pf0,&dev,1);
159 const std::vector<Real> &xstat,
168 std::vector<Real> &gstat,
170 const std::vector<Real> &xstat,
177 Real diff(0), pf(0), pf1(0), dev(0), one(1), weight(0), lam(0);
188 sampler.
sumAll(&pf,&dev,1);
196 const std::vector<Real> &vstat,
198 const std::vector<Real> &xstat,
210 std::vector<Real> &hvstat,
212 const std::vector<Real> &vstat,
214 const std::vector<Real> &xstat,
218 std::vector<Real> mval(2), gval(2);
220 sampler.
sumAll(&mval[0],&gval[0],2);
221 Real ev = gval[0], egv = gval[1];
223 std::vector<Real> mvec(3), gvec(3);
224 Real diff(0), gv(0), pf1(0), pf2(0), weight(0), lam(0);
233 mvec[0] += weight * pf1;
234 mvec[1] += weight * pf2;
235 mvec[2] += weight * pf2 * gv;
237 sampler.
sumAll(&mvec[0],&gvec[0],3);
238 Real c1 = one -
coeff_ * gvec[0];
239 Real c2 =
coeff_ * (gvec[1]*egv - gvec[2]);
virtual void setHessVecStorage(const Ptr< SampledScalar< Real >> &gradvec_storage, const Ptr< SampledVector< Real >> &hessvec_storage)
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)
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< SampledScalar< Real > > values_
Real ppf(const Real x, const Real t, const Real r, const int deriv=0) const
Ptr< SampledScalar< Real > > gradvecs_
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Return risk measure value.
void initializeStorage(void)
void setStorage(const Ptr< SampledScalar< Real >> &value_storage, const Ptr< SampledVector< Real >> &gradient_storage)
virtual std::vector< Real > getMyPoint(const int i) const
Real getPenaltyParameter(void) const
virtual Real getMyWeight(const int i) const
Ptr< Vector< Real > > dualVector_
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 setHessVecStorage(const Ptr< SampledScalar< Real >> &gradvec_storage, const Ptr< SampledVector< Real >> &hessvec_storage)
virtual void setStorage(const Ptr< SampledScalar< Real >> &value_storage, const Ptr< SampledVector< 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< SampledScalar< Real >> &value_storage, const Ptr< SampledVector< 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)
Ptr< SampledVector< Real > > gradients_
PD_MeanSemiDeviation(const Real coeff)
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< SampledScalar< Real >> &gradvec_storage, const Ptr< SampledVector< 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< SampledVector< Real > > hessvecs_