ROL
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROL::StochasticObjective< Real > Class Template Reference

#include <ROL_StochasticObjective.hpp>

+ Inheritance diagram for ROL::StochasticObjective< Real >:

Public Member Functions

virtual ~StochasticObjective ()
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, const Ptr< RandVarFunctional< Real >> &rvf, const Ptr< SampleGenerator< Real >> &vsampler, const Ptr< SampleGenerator< Real >> &gsampler, const Ptr< SampleGenerator< Real >> &hsampler, const bool storage=true, const int comp=0, const int index=0)
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, const Ptr< RandVarFunctional< Real >> &rvf, const Ptr< SampleGenerator< Real >> &vsampler, const Ptr< SampleGenerator< Real >> &gsampler, const bool storage=true, const int comp=0, const int index=0)
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, const Ptr< RandVarFunctional< Real >> &rvf, const Ptr< SampleGenerator< Real >> &sampler, const bool storage=true, const int comp=0, const int index=0)
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, ParameterList &parlist, const Ptr< SampleGenerator< Real >> &vsampler, const Ptr< SampleGenerator< Real >> &gsampler, const Ptr< SampleGenerator< Real >> &hsampler, const int comp=0, const int index=0)
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, ROL::ParameterList &parlist, const Ptr< SampleGenerator< Real >> &vsampler, const Ptr< SampleGenerator< Real >> &gsampler, const int comp=0, const int index=0)
 
 StochasticObjective (const Ptr< Objective< Real >> &obj, ROL::ParameterList &parlist, const Ptr< SampleGenerator< Real >> &sampler, const int comp=0, const int index=0)
 
Real computeStatistic (const Vector< Real > &x) const
 
void setIndex (int ind)
 
void update (const Vector< Real > &x, UpdateType type, int iter=-1)
 Update objective function. More...
 
void update (const Vector< Real > &x, bool flag=true, int iter=-1)
 Update objective function. More...
 
Real value (const Vector< Real > &x, Real &tol)
 Compute value. More...
 
void gradient (Vector< Real > &g, const Vector< Real > &x, Real &tol)
 Compute gradient. More...
 
void hessVec (Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
 Apply Hessian approximation to vector. More...
 
virtual void precond (Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
 Apply preconditioner to vector. More...
 
- Public Member Functions inherited from ROL::Objective< Real >
virtual ~Objective ()
 
 Objective ()
 
virtual Real dirDeriv (const Vector< Real > &x, const Vector< Real > &d, Real &tol)
 Compute directional derivative. More...
 
virtual void invHessVec (Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
 Apply inverse Hessian approximation to vector. More...
 
virtual void prox (Vector< Real > &Pv, const Vector< Real > &v, Real t, Real &tol)
 
virtual std::vector
< std::vector< Real > > 
checkGradient (const Vector< Real > &x, const Vector< Real > &d, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1)
 Finite-difference gradient check. More...
 
virtual std::vector
< std::vector< Real > > 
checkGradient (const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &d, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1)
 Finite-difference gradient check. More...
 
virtual std::vector
< std::vector< Real > > 
checkGradient (const Vector< Real > &x, const Vector< Real > &d, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1)
 Finite-difference gradient check with specified step sizes. More...
 
virtual std::vector
< std::vector< Real > > 
checkGradient (const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &d, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1)
 Finite-difference gradient check with specified step sizes. More...
 
virtual std::vector
< std::vector< Real > > 
checkHessVec (const Vector< Real > &x, const Vector< Real > &v, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1)
 Finite-difference Hessian-applied-to-vector check. More...
 
virtual std::vector
< std::vector< Real > > 
checkHessVec (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1)
 Finite-difference Hessian-applied-to-vector check. More...
 
virtual std::vector
< std::vector< Real > > 
checkHessVec (const Vector< Real > &x, const Vector< Real > &v, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1)
 Finite-difference Hessian-applied-to-vector check with specified step sizes. More...
 
virtual std::vector
< std::vector< Real > > 
checkHessVec (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1)
 Finite-difference Hessian-applied-to-vector check with specified step sizes. More...
 
virtual std::vector< Real > checkHessSym (const Vector< Real > &x, const Vector< Real > &v, const Vector< Real > &w, const bool printToStream=true, std::ostream &outStream=std::cout)
 Hessian symmetry check. More...
 
virtual std::vector< Real > checkHessSym (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &w, const bool printToStream=true, std::ostream &outStream=std::cout)
 Hessian symmetry check. More...
 
virtual void setParameter (const std::vector< Real > &param)
 

Private Member Functions

Ptr< const Vector< Real > > getConstVector (const Vector< Real > &x) const
 
Ptr< Vector< Real > > getVector (Vector< Real > &x) const
 
Ptr< const std::vector< Real > > getConstStat (const Vector< Real > &x) const
 
Ptr< std::vector< Real > > getStat (Vector< Real > &x) const
 

Private Attributes

Ptr< Objective< Real > > obj_
 
Ptr< RandVarFunctional< Real > > rvf_
 
Ptr< SampleGenerator< Real > > vsampler_
 
Ptr< SampleGenerator< Real > > gsampler_
 
Ptr< SampleGenerator< Real > > hsampler_
 
const int comp_
 
int index_
 

Additional Inherited Members

- Protected Member Functions inherited from ROL::Objective< Real >
const std::vector< Real > getParameter (void) const
 

Detailed Description

template<class Real>
class ROL::StochasticObjective< Real >

Definition at line 22 of file ROL_StochasticObjective.hpp.

Constructor & Destructor Documentation

template<class Real >
virtual ROL::StochasticObjective< Real >::~StochasticObjective ( )
inlinevirtual

Definition at line 65 of file ROL_StochasticObjective.hpp.

template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
const Ptr< RandVarFunctional< Real >> &  rvf,
const Ptr< SampleGenerator< Real >> &  vsampler,
const Ptr< SampleGenerator< Real >> &  gsampler,
const Ptr< SampleGenerator< Real >> &  hsampler,
const bool  storage = true,
const int  comp = 0,
const int  index = 0 
)
inline

Definition at line 67 of file ROL_StochasticObjective.hpp.

template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
const Ptr< RandVarFunctional< Real >> &  rvf,
const Ptr< SampleGenerator< Real >> &  vsampler,
const Ptr< SampleGenerator< Real >> &  gsampler,
const bool  storage = true,
const int  comp = 0,
const int  index = 0 
)
inline

Definition at line 80 of file ROL_StochasticObjective.hpp.

template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
const Ptr< RandVarFunctional< Real >> &  rvf,
const Ptr< SampleGenerator< Real >> &  sampler,
const bool  storage = true,
const int  comp = 0,
const int  index = 0 
)
inline

Definition at line 88 of file ROL_StochasticObjective.hpp.

template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
ParameterList &  parlist,
const Ptr< SampleGenerator< Real >> &  vsampler,
const Ptr< SampleGenerator< Real >> &  gsampler,
const Ptr< SampleGenerator< Real >> &  hsampler,
const int  comp = 0,
const int  index = 0 
)
inline
template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
ROL::ParameterList &  parlist,
const Ptr< SampleGenerator< Real >> &  vsampler,
const Ptr< SampleGenerator< Real >> &  gsampler,
const int  comp = 0,
const int  index = 0 
)
inline

Definition at line 117 of file ROL_StochasticObjective.hpp.

template<class Real >
ROL::StochasticObjective< Real >::StochasticObjective ( const Ptr< Objective< Real >> &  obj,
ROL::ParameterList &  parlist,
const Ptr< SampleGenerator< Real >> &  sampler,
const int  comp = 0,
const int  index = 0 
)
inline

Definition at line 124 of file ROL_StochasticObjective.hpp.

Member Function Documentation

template<class Real >
Ptr<const Vector<Real> > ROL::StochasticObjective< Real >::getConstVector ( const Vector< Real > &  x) const
inlineprivate
template<class Real >
Ptr<Vector<Real> > ROL::StochasticObjective< Real >::getVector ( Vector< Real > &  x) const
inlineprivate
template<class Real >
Ptr<const std::vector<Real> > ROL::StochasticObjective< Real >::getConstStat ( const Vector< Real > &  x) const
inlineprivate
template<class Real >
Ptr<std::vector<Real> > ROL::StochasticObjective< Real >::getStat ( Vector< Real > &  x) const
inlineprivate
template<class Real >
Real ROL::StochasticObjective< Real >::computeStatistic ( const Vector< Real > &  x) const
inline
template<class Real >
void ROL::StochasticObjective< Real >::setIndex ( int  ind)
inline
template<class Real >
void ROL::StochasticObjective< Real >::update ( const Vector< Real > &  x,
UpdateType  type,
int  iter = -1 
)
inlinevirtual

Update objective function.

This function updates the objective function at new iterations.

Parameters
[in]xis the new iterate.
[in]typeis the type of update requested.
[in]iteris the outer algorithm iterations count.

Reimplemented from ROL::Objective< Real >.

Definition at line 139 of file ROL_StochasticObjective.hpp.

References ROL::StochasticObjective< Real >::getConstVector(), ROL::StochasticObjective< Real >::gsampler_, ROL::StochasticObjective< Real >::hsampler_, ROL::StochasticObjective< Real >::obj_, ROL::Revert, ROL::StochasticObjective< Real >::rvf_, ROL::Trial, and ROL::StochasticObjective< Real >::vsampler_.

template<class Real >
void ROL::StochasticObjective< Real >::update ( const Vector< Real > &  x,
bool  flag = true,
int  iter = -1 
)
inlinevirtual

Update objective function.

This function updates the objective function at new iterations.

Parameters
[in]xis the new iterate.
[in]flagis true if the iterate has changed.
[in]iteris the outer algorithm iterations count.

Reimplemented from ROL::Objective< Real >.

Definition at line 153 of file ROL_StochasticObjective.hpp.

References ROL::StochasticObjective< Real >::getConstVector(), ROL::StochasticObjective< Real >::gsampler_, ROL::StochasticObjective< Real >::hsampler_, ROL::StochasticObjective< Real >::obj_, ROL::StochasticObjective< Real >::rvf_, and ROL::StochasticObjective< Real >::vsampler_.

template<class Real >
Real ROL::StochasticObjective< Real >::value ( const Vector< Real > &  x,
Real &  tol 
)
inlinevirtual

Compute value.

This function returns the objective function value.

Parameters
[in]xis the current iterate.
[in]tolis a tolerance for inexact objective function computation.

Implements ROL::Objective< Real >.

Definition at line 167 of file ROL_StochasticObjective.hpp.

References ROL::StochasticObjective< Real >::getConstStat(), ROL::StochasticObjective< Real >::getConstVector(), ROL::StochasticObjective< Real >::obj_, ROL::StochasticObjective< Real >::rvf_, and ROL::StochasticObjective< Real >::vsampler_.

template<class Real >
void ROL::StochasticObjective< Real >::gradient ( Vector< Real > &  g,
const Vector< Real > &  x,
Real &  tol 
)
inlinevirtual

Compute gradient.

This function returns the objective function gradient.

Parameters
[out]gis the gradient.
[in]xis the current iterate.
[in]tolis a tolerance for inexact objective function computation.

The default implementation is a finite-difference approximation based on the function value. This requires the definition of a basis \(\{\phi_i\}\) for the optimization vectors x and the definition of a basis \(\{\psi_j\}\) for the dual optimization vectors (gradient vectors g). The bases must be related through the Riesz map, i.e., \( R \{\phi_i\} = \{\psi_j\}\), and this must be reflected in the implementation of the ROL::Vector::dual() method.

Reimplemented from ROL::Objective< Real >.

Definition at line 180 of file ROL_StochasticObjective.hpp.

References ROL::StochasticObjective< Real >::getConstStat(), ROL::StochasticObjective< Real >::getConstVector(), ROL::StochasticObjective< Real >::getStat(), ROL::StochasticObjective< Real >::getVector(), ROL::StochasticObjective< Real >::gsampler_, ROL::StochasticObjective< Real >::obj_, ROL::StochasticObjective< Real >::rvf_, and ROL::Vector< Real >::zero().

template<class Real >
void ROL::StochasticObjective< Real >::hessVec ( Vector< Real > &  hv,
const Vector< Real > &  v,
const Vector< Real > &  x,
Real &  tol 
)
inlinevirtual

Apply Hessian approximation to vector.

This function applies the Hessian of the objective function to the vector \(v\).

Parameters
[out]hvis the the action of the Hessian on \(v\).
[in]vis the direction vector.
[in]xis the current iterate.
[in]tolis a tolerance for inexact objective function computation.

Reimplemented from ROL::Objective< Real >.

Definition at line 194 of file ROL_StochasticObjective.hpp.

References ROL::StochasticObjective< Real >::getConstStat(), ROL::StochasticObjective< Real >::getConstVector(), ROL::StochasticObjective< Real >::getStat(), ROL::StochasticObjective< Real >::getVector(), ROL::StochasticObjective< Real >::hsampler_, ROL::StochasticObjective< Real >::obj_, ROL::StochasticObjective< Real >::rvf_, and ROL::Vector< Real >::zero().

template<class Real >
virtual void ROL::StochasticObjective< Real >::precond ( Vector< Real > &  Pv,
const Vector< Real > &  v,
const Vector< Real > &  x,
Real &  tol 
)
inlinevirtual

Apply preconditioner to vector.

This function applies a preconditioner for the Hessian of the objective function to the vector \(v\).

Parameters
[out]Pvis the action of the Hessian preconditioner on \(v\).
[in]vis the direction vector.
[in]xis the current iterate.
[in]tolis a tolerance for inexact objective function computation.

Reimplemented from ROL::Objective< Real >.

Definition at line 211 of file ROL_StochasticObjective.hpp.

References ROL::Vector< Real >::dual(), and ROL::Vector< Real >::set().

Member Data Documentation

template<class Real >
Ptr<Objective<Real> > ROL::StochasticObjective< Real >::obj_
private
template<class Real >
Ptr<RandVarFunctional<Real> > ROL::StochasticObjective< Real >::rvf_
private
template<class Real >
Ptr<SampleGenerator<Real> > ROL::StochasticObjective< Real >::vsampler_
private
template<class Real >
Ptr<SampleGenerator<Real> > ROL::StochasticObjective< Real >::gsampler_
private
template<class Real >
Ptr<SampleGenerator<Real> > ROL::StochasticObjective< Real >::hsampler_
private
template<class Real >
const int ROL::StochasticObjective< Real >::comp_
private
template<class Real >
int ROL::StochasticObjective< Real >::index_
private

The documentation for this class was generated from the following file: