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_);
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;
229 Real pf0p0 = std::pow(pf0,rorder0);
230 Real pf0p1 = std::pow(pf0,rorder1);
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);
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;
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;
293 Real scale0 = (rorder1*pf0p2*pf1*pf1 + pf0p1*pf2)*(gv-vstat[0]);
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);
339 var = -coeff*(val_out[1]/denom1 + val_out[3]*val_out[2]/denom2);
Provides the interface to evaluate objective functions.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void computeHessVec(Vector< Real > &hv, Objective< Real > &obj, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
virtual void scale(const Real alpha)=0
Compute where .
Real computeValue(Objective< Real > &obj, const Vector< Real > &x, Real &tol)
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
ROL::Ptr< PlusFunction< Real > > plusFunction_
Ptr< Vector< Real > > hv_
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
Return risk measure value.
Ptr< Vector< Real > > dualVector_
ROL::Ptr< Vector< Real > > mDualVector_
Defines the linear algebra or vector space interface.
void sumAll(Real *input, Real *output, int dim) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
void initialize(const Vector< Real > &x)
Initialize temporary variables.
void checkInputs(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 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.
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.
HMCR(const Real prob, const Real lambda, const unsigned order, const ROL::Ptr< PlusFunction< Real > > &pf)
Constructor.
void computeGradient(Vector< Real > &g, Objective< Real > &obj, const Vector< Real > &x, Real &tol)
HMCR(ROL::ParameterList &parlist)
Constructor.
void updateValue(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
Update internal storage for value computation.
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...
Provides an interface for a convex combination of the expected value and the higher moment coherent r...
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
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.