113 const Real
zero(0), one(1);
114 ROL_TEST_FOR_EXCEPTION((
prob_ <=
zero) || (
prob_ >= one), std::invalid_argument,
115 ">>> ERROR (ROL::HMCR): Confidence level must be between 0 and 1!");
117 ">>> ERROR (ROL::HMCR): Convex combination parameter must be positive!");
118 ROL_TEST_FOR_EXCEPTION((
order_ < 2), std::invalid_argument,
119 ">>> ERROR (ROL::HMCR): Norm order is less than 2!");
120 ROL_TEST_FOR_EXCEPTION(
plusFunction_ == ROL::nullPtr, std::invalid_argument,
121 ">>> ERROR (ROL::HMCR): PlusFunction pointer is null!");
134 HMCR(
const Real prob,
const Real lambda,
const unsigned order,
156 HMCR( ROL::ParameterList &parlist )
160 ROL::ParameterList &list
161 = parlist.sublist(
"SOL").sublist(
"Risk Measure").sublist(
"HMCR");
163 prob_ = list.get<Real>(
"Confidence Level");
164 lambda_ = list.get<Real>(
"Convex Combination Parameter");
165 order_ = (unsigned)list.get<
int>(
"Order",2);
190 const std::vector<Real> &xstat,
192 const Real rorder =
static_cast<Real
>(
order_);
194 Real val = computeValue(obj,x,tol);
198 pnorm_ += weight_*std::pow(pf,rorder);
202 const std::vector<Real> &xstat,
205 const Real power = one/
static_cast<Real
>(
order_);
206 std::vector<Real> val_in(2), val_out(2);
209 sampler.
sumAll(&val_in[0],&val_out[0],2);
210 return (one-
lambda_)*val_out[0]
216 const std::vector<Real> &xstat,
219 const Real rorder0 =
static_cast<Real
>(
order_);
220 const Real rorder1 = rorder0 - one;
222 computeGradient(*dualVector_,obj,x,tol);
223 g_->axpy(weight_,*dualVector_);
225 Real val = computeValue(obj,x,tol);
229 Real pf0p0 = std::pow(pf0,rorder0);
230 Real pf0p1 = std::pow(pf0,rorder1);
235 hv_->axpy(weight_*pf0p1*pf1,*dualVector_);
239 std::vector<Real> &gstat,
241 const std::vector<Real> &xstat,
243 const Real
zero(0), one(1);
244 std::vector<Real> val_in(2), val_out(2);
247 sampler.
sumAll(&val_in[0],&val_out[0],2);
252 if ( val_out[0] >
zero ) {
253 const Real rorder0 =
static_cast<Real
>(
order_);
254 const Real rorder1 = rorder0 - one;
255 Real denom = std::pow(val_out[0],rorder1/rorder0);
258 sampler.
sumAll(*hv_,*dualVector_);
268 const std::vector<Real> &vstat,
270 const std::vector<Real> &xstat,
273 const Real rorder0 =
static_cast<Real
>(
order_);
274 const Real rorder1 = rorder0-one;
275 const Real rorder2 = rorder1-one;
277 computeHessVec(*dualVector_,obj,v,x,tol);
278 hv_->axpy(weight_,*dualVector_);
280 Real val = computeValue(obj,x,tol);
285 Real pf0p0 = std::pow(pf0,rorder0);
286 Real pf0p1 = std::pow(pf0,rorder1);
287 Real pf0p2 = std::pow(pf0,rorder2);
289 Real scale1 = pf0p1*pf1;
290 g_->axpy(weight_*scale1,*dualVector_);
292 Real gv = computeGradVec(*dualVector_,obj,v,x,tol);
293 Real scale0 = (rorder1*pf0p2*pf1*pf1 + pf0p1*pf2)*(gv-vstat[0]);
298 coeff2_ += weight_*rorder1*scale1*(vstat[0]-gv);
300 g_->axpy(weight_*scale0,*dualVector_);
305 std::vector<Real> &hvstat,
307 const std::vector<Real> &vstat,
309 const std::vector<Real> &xstat,
311 const Real
zero(0), one(1);
312 std::vector<Real> val_in(4), val_out(4);
316 sampler.
sumAll(&val_in[0],&val_out[0],4);
322 if ( val_out[0] >
zero ) {
323 const Real rorder0 =
static_cast<Real
>(
order_);
324 const Real rorder1 = rorder0-one;
325 const Real rorder2 = rorder0 + rorder1;
328 Real denom1 = std::pow(val_out[0],rorder1/rorder0);
329 Real denom2 = std::pow(val_out[0],rorder2/rorder0);
332 sampler.
sumAll(*g_,*dualVector_);
333 hv.
axpy(coeff/denom1,*dualVector_);
337 hv.
axpy(coeff*val_out[3]/denom2,*dualVector_);
339 var = -coeff*(val_out[1]/denom1 + val_out[3]*val_out[2]/denom2);
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
void initialize(const Vector< Real > &x)
HMCR(const Real prob, const Real lambda, const unsigned order, const ROL::Ptr< PlusFunction< Real > > &pf)
Constructor.
ROL::Ptr< Vector< Real > > mDualVector_
HMCR(ROL::ParameterList &parlist)
Constructor.
void getGradient(Vector< Real > &g, std::vector< Real > &gstat, const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
void checkInputs(void) const
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)
void updateGradient(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
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 updateValue(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
ROL::Ptr< PlusFunction< Real > > plusFunction_
Provides the interface to evaluate objective functions.
Provides the interface to implement any functional that maps a random variable to a (extended) real n...
void sumAll(Real *input, Real *output, int dim) const
Defines the linear algebra or vector space interface.
virtual void scale(const Real alpha)=0
Compute where .
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .