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_);
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;
195 Real pf0p0 = std::pow(pf0,rorder0);
196 Real pf0p1 = std::pow(pf0,rorder1);
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);
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;
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;
259 Real scale0 = (rorder1*pf0p2*pf1*pf1 + pf0p1*pf2)*(gv-vstat[0]);
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);
305 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.