94 TEUCHOS_TEST_FOR_EXCEPTION((prob_ <= zero) || (prob_ >= one), std::invalid_argument,
95 ">>> ERROR (ROL::CVaR): Confidence level must be between 0 and 1!");
96 TEUCHOS_TEST_FOR_EXCEPTION((coeff_ < zero) || (coeff_ > one), std::invalid_argument,
97 ">>> ERROR (ROL::CVaR): Convex combination parameter must be positive!");
98 TEUCHOS_TEST_FOR_EXCEPTION(plusFunction_ == Teuchos::null, std::invalid_argument,
99 ">>> ERROR (ROL::CVaR): PlusFunction pointer is null!");
112 CVaR(
const Real prob,
const Real coeff,
114 :
RiskMeasure<Real>(), plusFunction_(pf), prob_(prob), coeff_(coeff),
115 xvar_(0), vvar_(0), firstReset_(true) {
129 CVaR( Teuchos::ParameterList &parlist )
130 :
RiskMeasure<Real>(), xvar_(0), vvar_(0), firstReset_(true) {
131 Teuchos::ParameterList &list
132 = parlist.sublist(
"SOL").sublist(
"Risk Measure").sublist(
"CVaR");
134 prob_ = list.get<Real>(
"Confidence Level");
135 coeff_ = list.get<Real>(
"Convex Combination Parameter");
146 dualVector_ = (x0->dual()).clone();
160 void update(
const Real val,
const Real weight) {
162 Real pf = plusFunction_->evaluate(val-xvar_,0);
168 Real pf = plusFunction_->evaluate(val-xvar_,1);
170 Real c = (one-
coeff_) + coeff_/(one-prob_)*pf;
177 Real pf1 = plusFunction_->evaluate(val-xvar_,1);
178 Real pf2 = plusFunction_->evaluate(val-xvar_,2);
180 Real c = pf2*coeff_/(one-
prob_)*(gv-vvar_);
182 c = (one-
coeff_) + coeff_/(one-prob_)*pf1;
188 sampler.
sumAll(&val,&cvar,1);
189 cvar += coeff_*
xvar_;
196 sampler.
sumAll(&val,&var,1);
199 var *= -coeff_/(one-
prob_);
208 sampler.
sumAll(&val,&var,1);
211 var *= coeff_/(one-
prob_);
Teuchos::RCP< Vector< Real > > dualVector_
Real getValue(SampleGenerator< Real > &sampler)
Return risk measure value.
void getGradient(Vector< Real > &g, SampleGenerator< Real > &sampler)
Return risk measure (sub)gradient.
void getHessVec(Vector< Real > &hv, SampleGenerator< Real > &sampler)
Return risk measure Hessian-times-a-vector.
Provides an interface for a convex combination of the expected value and the conditional value-at-ris...
void update(const Real val, const Real weight)
Update internal risk measure storage for value computation.
void sumAll(Real *input, Real *output, int dim) const
CVaR(const Real prob, const Real coeff, const Teuchos::RCP< PlusFunction< Real > > &pf)
Constructor.
void update(const Real val, const Vector< Real > &g, const Real weight)
Update internal risk measure storage for gradient computation.
Defines the linear algebra or vector space interface.
Teuchos::RCP< const Vector< Real > > getVector(void) const
void setVector(const Vector< Real > &vec)
void setStatistic(const Real stat)
Teuchos::RCP< PlusFunction< Real > > plusFunction_
void update(const Real val, const Vector< Real > &g, const Real gv, const Vector< Real > &hv, const Real weight)
Update internal risk measure storage for Hessian-time-a-vector computation.
void checkInputs(void) const
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
Reset internal risk measure storage. Called for value and gradient computation.
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x, Teuchos::RCP< Vector< Real > > &v0, const Vector< Real > &v)
Reset internal risk measure storage. Called for Hessian-times-a-vector computation.
Teuchos::RCP< const StdVector< Real > > getStatistic(void) const
virtual void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
Reset internal risk measure storage. Called for value and gradient computation.
Provides the interface to implement risk measures.
CVaR(Teuchos::ParameterList &parlist)
Constructor.