70 :
RiskMeasure<Real>(), plusFunction_(pf), xvar_(0.0), vvar_(0.0), firstReset_(true) {
71 prob_ = ((prob >= 0.0) ? ((prob <= 1.0) ? prob : 0.5) : 0.5);
72 coeff_ = ((coeff >= 0.0) ? ((coeff <= 1.0) ? coeff : 1.0) : 1.0);
83 dualVector_ = (x0->dual()).clone();
101 void update(
const Real val,
const Real weight) {
102 Real pf = plusFunction_->evaluate(val-xvar_,0);
107 Real pf = plusFunction_->evaluate(val-xvar_,1);
109 Real c = (1.0-
coeff_) + coeff_/(1.0-prob_)*pf;
115 Real pf1 = plusFunction_->evaluate(val-xvar_,1);
116 Real pf2 = plusFunction_->evaluate(val-xvar_,2);
118 Real c = pf2*coeff_/(1.0-
prob_)*(gv-vvar_);
120 c = (1.0-
coeff_) + coeff_/(1.0-prob_)*pf1;
127 sampler.
sumAll(&val,&cvar,1);
128 cvar += coeff_*
xvar_;
136 sampler.
sumAll(&val,&var,1);
139 var *= -coeff_/(1.0-
prob_);
149 sampler.
sumAll(&val,&var,1);
152 var *= coeff_/(1.0-
prob_);
Teuchos::RCP< Vector< Real > > dualVector_
Real getValue(SampleGenerator< Real > &sampler)
void getGradient(Vector< Real > &g, SampleGenerator< Real > &sampler)
void getHessVec(Vector< Real > &hv, SampleGenerator< Real > &sampler)
void update(const Real val, const Real weight)
void update(const Real val, const Vector< Real > &g, const Real weight)
Defines the linear algebra or vector space interface.
void sumAll(Real *input, Real *output, int dim) const
const Real getVaR() const
Teuchos::RCP< const Vector< Real > > getVector() const
void setVaR(const Real var)
CVaR(Real prob, Real coeff, Teuchos::RCP< PlusFunction< Real > > &pf)
Teuchos::RCP< PlusFunction< Real > > plusFunction_
void update(const Real val, const Vector< Real > &g, const Real gv, const Vector< Real > &hv, const Real weight)
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x, Teuchos::RCP< Vector< Real > > &v0, const Vector< Real > &v)
void setVector(const Vector< Real > &vec)