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,
97 Real val = computeValue(obj,x,tol);
98 val_ += weight_ * val;
102 const std::vector<Real> &xstat,
106 sampler.
sumAll(&val_,&ev,1);
108 Real diff(0), pf0(0), dev(0), weight(0), lam(0);
117 sampler.
sumAll(&pf0,&dev,1);
125 const std::vector<Real> &xstat,
127 Real val = computeValue(obj,x,tol);
128 val_ += weight_ * val;
129 computeGradient(*dualVector_,obj,x,tol);
130 g_->axpy(weight_,*dualVector_);
134 std::vector<Real> &gstat,
136 const std::vector<Real> &xstat,
140 sampler.
sumAll(&val_,&ev,1);
142 hv_->zero(); dualVector_->zero();
143 Real diff(0), pf(0), pf1(0), dev(0), one(1), weight(0), lam(0);
152 dualVector_->axpy(
coeff_ * pf1, *hv_);
154 sampler.
sumAll(&pf,&dev,1);
155 g_->scale(one -
coeff_ * dev);
156 g_->plus(*dualVector_);
162 const std::vector<Real> &vstat,
164 const std::vector<Real> &xstat,
166 Real val = computeValue(obj,x,tol);
167 val_ += weight_ * val;
168 Real gv = computeGradVec(*dualVector_,obj,v,x,tol);
170 g_->axpy(weight_, *dualVector_);
171 computeHessVec(*dualVector_,obj,v,x,tol);
172 hv_->axpy(weight_, *dualVector_);
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);
185 mval[0] = val_; mval[1] = gv_;
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]);
210 dualVector_->zero(); hv_->zero(); g_->zero();
221 hv_->axpy(weight *
coeff_ * pf2 * (gv-egv), *g_);
222 hv_->axpy(weight *
coeff_ *pf1, *dualVector_);
224 sampler.
sumAll(*hv_, *dualVector_);
225 hv.
plus(*dualVector_);
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
Provides the interface to evaluate objective functions.
void setStorage(const Ptr< ScalarController< Real > > &value_storage, const Ptr< VectorController< Real > > &gradient_storage)
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)
void updateGradient(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Ptr< VectorController< Real > > gradients_
void initialize(const Vector< Real > &x)
Ptr< ScalarController< Real > > values_
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)
PD_MeanSemiDeviation(const Real coeff)
void initializeStorage(void)
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Ptr< ScalarController< Real > > gradvecs_
Ptr< VectorController< Real > > hessvecs_
void getGradient(Vector< Real > &g, std::vector< Real > &gstat, const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
void updateValue(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
void setHessVecStorage(const Ptr< ScalarController< Real > > &gradvec_storage, const Ptr< VectorController< Real > > &hessvec_storage)
void getMultiplier(Real &lam, const std::vector< Real > &pt) const
PD_RandVarFunctional(void)
Real getPenaltyParameter(void) const
Real ppf(const Real x, const Real t, const Real r, const int deriv=0) const
virtual void setHessVecStorage(const Ptr< ScalarController< Real > > &gradvec_storage, const Ptr< VectorController< Real > > &hessvec_storage)
void setValue(const Real val, const std::vector< Real > &pt)
virtual void initialize(const Vector< Real > &x)
virtual void setStorage(const Ptr< ScalarController< Real > > &value_storage, const Ptr< VectorController< Real > > &gradient_storage)
Provides the interface to implement any functional that maps a random variable to a (extended) real n...
virtual int numMySamples(void) const
virtual std::vector< Real > getMyPoint(const int i) const
void sumAll(Real *input, Real *output, int dim) const
virtual Real getMyWeight(const int i) const
Defines the linear algebra or vector space interface.
virtual void plus(const Vector &x)=0
Compute , where .