ROL
ROL_MeanValueObjective.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef ROL_MEANVALUEOBJECTIVE_HPP
11 #define ROL_MEANVALUEOBJECTIVE_HPP
12 
13 #include "ROL_Objective.hpp"
14 #include "ROL_SampleGenerator.hpp"
15 
16 namespace ROL {
17 
18 template<typename Real>
19 class MeanValueObjective : public Objective<Real> {
20 private:
21  const Ptr<Objective<Real>> obj_;
22 
23 public:
24  MeanValueObjective( const Ptr<Objective<Real>> &obj,
25  const Ptr<SampleGenerator<Real>> &sampler);
26 
27  void update( const Vector<Real> &x, UpdateType type, int iter = -1 ) override;
28  void update( const Vector<Real> &x, bool flag = true, int iter = -1 ) override;
29  Real value( const Vector<Real> &x, Real &tol ) override;
30  void gradient( Vector<Real> &g, const Vector<Real> &x, Real &tol ) override;
31  void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) override;
32  void precond( Vector<Real> &Pv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) override;
33 
34 private:
35  std::vector<Real> computeSampleMean(const Ptr<SampleGenerator<Real>> &sampler) const;
36 };
37 
38 }
39 
41 
42 #endif
Provides the interface to evaluate objective functions.
MeanValueObjective(const Ptr< Objective< Real >> &obj, const Ptr< SampleGenerator< Real >> &sampler)
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply preconditioner to vector.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
std::vector< Real > computeSampleMean(const Ptr< SampleGenerator< Real >> &sampler) const
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
const Ptr< Objective< Real > > obj_