79 const Real
zero(0), one(1);
80 ROL_TEST_FOR_EXCEPTION((
prob_ <=
zero) || (
prob_ >= one), std::invalid_argument,
81 ">>> ERROR (ROL::HMCR): Confidence level must be between 0 and 1!");
83 ">>> ERROR (ROL::HMCR): Convex combination parameter must be positive!");
84 ROL_TEST_FOR_EXCEPTION((
order_ < 2), std::invalid_argument,
85 ">>> ERROR (ROL::HMCR): Norm order is less than 2!");
86 ROL_TEST_FOR_EXCEPTION(
plusFunction_ == ROL::nullPtr, std::invalid_argument,
87 ">>> ERROR (ROL::HMCR): PlusFunction pointer is null!");
100 HMCR(
const Real prob,
const Real lambda,
const unsigned order,
122 HMCR( ROL::ParameterList &parlist )
126 ROL::ParameterList &list
127 = parlist.sublist(
"SOL").sublist(
"Risk Measure").sublist(
"HMCR");
129 prob_ = list.get<Real>(
"Confidence Level");
130 lambda_ = list.get<Real>(
"Convex Combination Parameter");
131 order_ = (unsigned)list.get<
int>(
"Order",2);
156 const std::vector<Real> &xstat,
158 const Real rorder =
static_cast<Real
>(
order_);
160 Real val = computeValue(obj,x,tol);
164 pnorm_ += weight_*std::pow(pf,rorder);
168 const std::vector<Real> &xstat,
171 const Real power = one/
static_cast<Real
>(
order_);
172 std::vector<Real> val_in(2), val_out(2);
175 sampler.
sumAll(&val_in[0],&val_out[0],2);
176 return (one-
lambda_)*val_out[0]
182 const std::vector<Real> &xstat,
185 const Real rorder0 =
static_cast<Real
>(
order_);
186 const Real rorder1 = rorder0 - one;
188 computeGradient(*dualVector_,obj,x,tol);
189 g_->axpy(weight_,*dualVector_);
191 Real val = computeValue(obj,x,tol);
195 Real pf0p0 = std::pow(pf0,rorder0);
196 Real pf0p1 = std::pow(pf0,rorder1);
201 hv_->axpy(weight_*pf0p1*pf1,*dualVector_);
205 std::vector<Real> &gstat,
207 const std::vector<Real> &xstat,
209 const Real
zero(0), one(1);
210 std::vector<Real> val_in(2), val_out(2);
213 sampler.
sumAll(&val_in[0],&val_out[0],2);
218 if ( val_out[0] >
zero ) {
219 const Real rorder0 =
static_cast<Real
>(
order_);
220 const Real rorder1 = rorder0 - one;
221 Real denom = std::pow(val_out[0],rorder1/rorder0);
224 sampler.
sumAll(*hv_,*dualVector_);
234 const std::vector<Real> &vstat,
236 const std::vector<Real> &xstat,
239 const Real rorder0 =
static_cast<Real
>(
order_);
240 const Real rorder1 = rorder0-one;
241 const Real rorder2 = rorder1-one;
243 computeHessVec(*dualVector_,obj,v,x,tol);
244 hv_->axpy(weight_,*dualVector_);
246 Real val = computeValue(obj,x,tol);
251 Real pf0p0 = std::pow(pf0,rorder0);
252 Real pf0p1 = std::pow(pf0,rorder1);
253 Real pf0p2 = std::pow(pf0,rorder2);
255 Real scale1 = pf0p1*pf1;
256 g_->axpy(weight_*scale1,*dualVector_);
258 Real gv = computeGradVec(*dualVector_,obj,v,x,tol);
259 Real scale0 = (rorder1*pf0p2*pf1*pf1 + pf0p1*pf2)*(gv-vstat[0]);
264 coeff2_ += weight_*rorder1*scale1*(vstat[0]-gv);
266 g_->axpy(weight_*scale0,*dualVector_);
271 std::vector<Real> &hvstat,
273 const std::vector<Real> &vstat,
275 const std::vector<Real> &xstat,
277 const Real
zero(0), one(1);
278 std::vector<Real> val_in(4), val_out(4);
282 sampler.
sumAll(&val_in[0],&val_out[0],4);
288 if ( val_out[0] >
zero ) {
289 const Real rorder0 =
static_cast<Real
>(
order_);
290 const Real rorder1 = rorder0-one;
291 const Real rorder2 = rorder0 + rorder1;
294 Real denom1 = std::pow(val_out[0],rorder1/rorder0);
295 Real denom2 = std::pow(val_out[0],rorder2/rorder0);
298 sampler.
sumAll(*g_,*dualVector_);
299 hv.
axpy(coeff/denom1,*dualVector_);
303 hv.
axpy(coeff*val_out[3]/denom2,*dualVector_);
305 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 .