44#ifndef ROL_MIXEDQUANTILEQUADRANGLE_HPP
45#define ROL_MIXEDQUANTILEQUADRANGLE_HPP
50#include "ROL_ParameterList.hpp"
117 ROL_TEST_FOR_EXCEPTION((pSize!=cSize),std::invalid_argument,
118 ">>> ERROR (ROL::MixedCVaR): Probability and coefficient arrays have different sizes!");
119 Real sum(0),
zero(0), one(1);
120 for (
int i = 0; i < pSize; i++) {
121 ROL_TEST_FOR_EXCEPTION((
prob_[i]>one ||
prob_[i]<
zero), std::invalid_argument,
122 ">>> ERROR (ROL::MixedCVaR): Element of probability array out of range!");
123 ROL_TEST_FOR_EXCEPTION((
coeff_[i]>one ||
coeff_[i]<
zero), std::invalid_argument,
124 ">>> ERROR (ROL::MixedCVaR): Element of coefficient array out of range!");
127 ROL_TEST_FOR_EXCEPTION((std::abs(sum-one) > std::sqrt(
ROL_EPSILON<Real>())),std::invalid_argument,
128 ">>> ERROR (ROL::MixedCVaR): Coefficients do not sum to one!");
129 ROL_TEST_FOR_EXCEPTION(
plusFunction_ == ROL::nullPtr, std::invalid_argument,
130 ">>> ERROR (ROL::MixedCVaR): PlusFunction pointer is null!");
138 ROL::ParameterList &list
139 = parlist.sublist(
"SOL").sublist(
"Risk Measure").sublist(
"Mixed CVaR");
141 prob_ = ROL::getArrayFromStringParameter<Real>(list,
"Probability Array");
142 coeff_ = ROL::getArrayFromStringParameter<Real>(list,
"Coefficient Array");
149 const std::vector<Real> &coeff,
162 if (xstat != nullPtr) {
163 for (
int i = 0; i <
size_; ++i) {
164 stat =
coeff_[i]*(*xstat)[i];
172 const std::vector<Real> &xstat,
175 Real val = computeValue(obj,x,tol);
176 for (
int i = 0; i <
size_; i++) {
183 const std::vector<Real> &xstat,
186 sampler.
sumAll(&val_,&cvar,1);
187 for (
int i = 0; i <
size_; i++) {
188 cvar +=
coeff_[i]*xstat[i];
195 const std::vector<Real> &xstat,
197 Real pf(0), c(0), one(1);
198 Real val = computeValue(obj,x,tol);
199 for (
int i = 0; i <
size_; i++) {
204 computeGradient(*dualVector_,obj,x,tol);
205 g_->axpy(c,*dualVector_);
211 std::vector<Real> &gstat,
213 const std::vector<Real> &xstat,
216 for (
int i = 0; i <
size_; i++) {
224 const std::vector<Real> &vstat,
226 const std::vector<Real> &xstat,
228 Real pf1(0), pf2(0), c(0), one(1);
229 Real val = computeValue(obj,x,tol);
230 for (
int i = 0; i <
size_; i++) {
234 Real gv = computeGradVec(*dualVector_,obj,v,x,tol);
235 c = weight_*
coeff_[i]/(one-
prob_[i])*pf2*(gv-vstat[i]);
237 hv_->axpy(c,*dualVector_);
241 computeHessVec(*dualVector_,obj,v,x,tol);
248 std::vector<Real> &hvstat,
250 const std::vector<Real> &vstat,
252 const std::vector<Real> &xstat,
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
MixedCVaR(ROL::ParameterList &parlist)
void updateValue(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
std::vector< Real > prob_
std::vector< Real > coeff_
MixedCVaR(const std::vector< Real > &prob, const std::vector< Real > &coeff, const ROL::Ptr< PlusFunction< Real > > &pf)
Real computeStatistic(const Ptr< std::vector< Real > > &xstat) const
void updateGradient(Objective< Real > &obj, const Vector< Real > &x, const std::vector< Real > &xstat, Real &tol)
void initializeMCVAR(void)
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 initialize(const Vector< Real > &x)
ROL::Ptr< PlusFunction< Real > > plusFunction_
Real getValue(const Vector< Real > &x, const std::vector< Real > &xstat, SampleGenerator< Real > &sampler)
void getGradient(Vector< Real > &g, std::vector< Real > &gstat, 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)
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.
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.