44#ifndef ROL_RISKNEUTRALOBJECTIVE_HPP
45#define ROL_RISKNEUTRALOBJECTIVE_HPP
86 const std::vector<Real> ¶m, Real &tol) {
87 bool isComputed =
false;
101 const std::vector<Real> ¶m, Real &tol) {
102 bool isComputed =
false;
116 const std::vector<Real> ¶m, Real &tol) {
127 const bool storage =
true )
138 const bool storage =
true )
148 const bool storage =
true )
161 value_ =
static_cast<Real
>(0);
178 value_ =
static_cast<Real
>(0);
194 Real myval(0), ptval(0), val(0), one(1), two(2), error(two*tol + one);
195 std::vector<Real> ptvals;
196 while ( error > tol ) {
198 for (
int i =
ValueSampler_->start(); i < ValueSampler_->numMySamples(); ++i ) {
201 ptvals.push_back(ptval);
216 std::vector<Ptr<Vector<Real>>> ptgs;
217 Real one(1), two(2), error(two*tol + one);
218 while ( error > tol ) {
220 for (
int i =
GradientSampler_->start(); i < GradientSampler_->numMySamples(); ++i ) {
Provides the interface to evaluate objective functions.
RiskNeutralObjective(const Ptr< Objective< Real > > &pObj, const Ptr< SampleGenerator< Real > > &sampler, const bool storage=true)
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Ptr< Objective< Real > > ParametrizedObjective_
Ptr< SampleGenerator< Real > > HessianSampler_
RiskNeutralObjective(const Ptr< Objective< Real > > &pObj, const Ptr< SampleGenerator< Real > > &vsampler, const Ptr< SampleGenerator< Real > > &gsampler, const bool storage=true)
void getHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const std::vector< Real > ¶m, Real &tol)
void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Ptr< SampleGenerator< Real > > GradientSampler_
void getValue(Real &val, const Vector< Real > &x, const std::vector< Real > ¶m, Real &tol)
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply preconditioner to vector.
RiskNeutralObjective(const Ptr< Objective< Real > > &pObj, const Ptr< SampleGenerator< Real > > &vsampler, const Ptr< SampleGenerator< Real > > &gsampler, const Ptr< SampleGenerator< Real > > &hsampler, const bool storage=true)
Ptr< Vector< Real > > gradient_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Ptr< SampleGenerator< Real > > ValueSampler_
Ptr< VectorController< Real > > gradient_storage_
Ptr< Vector< Real > > pointDual_
Ptr< ScalarController< Real > > value_storage_
Ptr< Vector< Real > > sumDual_
void initialize(const Vector< Real > &x)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
void getGradient(Vector< Real > &g, const Vector< Real > &x, const std::vector< Real > ¶m, Real &tol)
Defines the linear algebra or vector space interface.
virtual void set(const Vector &x)
Set where .
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
virtual void zero()
Set to zero vector.