ROL
Public Member Functions | List of all members
ROL::Objective< Real > Class Template Referenceabstract

Provides the interface to evaluate objective functions. More...

#include <ROL_Objective.hpp>

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

Public Member Functions

virtual ~Objective ()
 
virtual void update (const Vector< Real > &x, bool flag=true, int iter=-1)
 Update objective function. More...
 
virtual Real value (const Vector< Real > &x, Real &tol)=0
 Compute value. More...
 
virtual void gradient (Vector< Real > &g, const Vector< Real > &x, Real &tol)
 Compute gradient. More...
 
virtual Real dirDeriv (const Vector< Real > &x, const Vector< Real > &d, Real &tol)
 Compute directional derivative. More...
 
virtual void hessVec (Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
 Apply Hessian approximation to vector. 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 precond (Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
 Apply preconditioner to vector. More...
 
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...
 

Detailed Description

template<class Real>
class ROL::Objective< Real >

Provides the interface to evaluate objective functions.

Provides the definition of the objective function interface.

ROL's objective function interface is designed for Fr$eacute;chet differentiable functionals \(f:\mathcal{X}\to\mathbb{R}\), where \(\mathcal{X}\) is a Banach space. The basic operator interace, to be implemented by the user, requires:

It is strongly recommended that the user additionally overload:

The user may also overload:

Definition at line 77 of file ROL_Objective.hpp.

Constructor & Destructor Documentation

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

Definition at line 80 of file ROL_Objective.hpp.

Member Function Documentation

template<class Real>
virtual void ROL::Objective< 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 in Objective_PoissonInversion< Real >, ROL::ProjectedObjective< Real >, ROL::Reduced_ParametrizedObjective_SimOpt< Real >, ROL::Reduced_Objective_SimOpt< Real >, ROL::MoreauYosidaPenalty< Real >, ROL::RiskAverseObjective< Real >, ROL::HMCRObjective< Real >, ROL::BPOEObjective< Real >, ROL::AugmentedLagrangian< Real >, ROL::InteriorPoint::PenalizedObjective< Real >, ROL::RiskNeutralObjective< Real >, and ROL::Objective_SimOpt< Real >.

Definition at line 89 of file ROL_Objective.hpp.

References ROL::Objective< Real >::dirDeriv(), ROL::Objective< Real >::gradient(), ROL::Objective< Real >::hessVec(), and ROL::Objective< Real >::value().

Referenced by ROL::CompositeStep< Real >::accept(), ROL::BundleStep< Real >::compute(), ROL::LineSearch< Real >::getInitialAlpha(), ROL::Step< Real >::initialize(), ROL::InteriorPointStep< Real >::initialize(), ROL::CompositeStep< Real >::initialize(), ROL::PrimalDualActiveSetStep< Real >::initialize(), ROL::TrustRegionStep< Real >::initialize(), ROL::IterationScaling< Real >::run(), ROL::CubicInterp< Real >::run(), ROL::BackTracking< Real >::run(), ROL::Bisection< Real >::run(), ROL::GoldenSection< Real >::run(), ROL::Brents< Real >::run(), ROL::PathBasedTargetLevel< Real >::run(), ROL::LineSearch< Real >::status(), ROL::CompositeStep< Real >::update(), ROL::PrimalDualActiveSetStep< Real >::update(), ROL::TrustRegionStep< Real >::update(), ROL::LineSearchStep< Real >::update(), and ROL::MoreauYosidaPenaltyStep< Real >::updateState().

template<class Real>
virtual Real ROL::Objective< Real >::value ( const Vector< Real > &  x,
Real &  tol 
)
pure virtual

Compute value.

This function returns the objective function value.

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

Implemented in Objective_GrossPitaevskii< Real >, ROL::ZOO::Objective_PoissonInversion< Real >, Objective_BurgersControl< Real >, Objective_PoissonInversion< Real >, ROL::ProjectedObjective< Real >, ROL::Reduced_ParametrizedObjective_SimOpt< Real >, ROL::RiskAverseObjective< Real >, ROL::Reduced_Objective_SimOpt< Real >, ROL::MoreauYosidaPenalty< Real >, ROL::HMCRObjective< Real >, ROL::BPOEObjective< Real >, ROL::CDFObjective< Real >, ROL::AugmentedLagrangian< Real >, ROL::ZOO::Objective_DiodeCircuit< Real >, ROL::RiskNeutralObjective< Real >, ROL::InteriorPoint::PenalizedObjective< Real >, ROL::MomentObjective< Real >, Objective_GrossPitaevskii< Real >, ROL::ZOO::Objective_PoissonControl< Real >, Zakharov_Sacado_Objective< Real >, ROL::PointwiseCDFObjective< Real >, ROL::ObjectiveFromBoundConstraint< Real >, ROL::ZOO::Objective_Zakharov< Real >, ROL::ZOO::Objective_HS45< Real >, ROL::ZOO::Objective_Rosenbrock< Real, XPrim, XDual >, ROL::ZOO::Objective_SimpleEqConstrained< Real, XPrim, XDual >, ROL::ZOO::Objective_HS2< Real >, ROL::ZOO::Objective_HS3< Real >, ROL::ZOO::Objective_HS38< Real >, ROL::ZOO::Objective_HS4< Real >, ROL::ZOO::Objective_HS5< Real >, ROL::ZOO::Objective_HS25< Real >, ROL::Objective_SimOpt< Real >, ROL::ZOO::Objective_HS29< Real >, ROL::ZOO::Objective_HS32< Real >, ROL::Minimax2< Real >, ROL::ZOO::Objective_Beale< Real >, ROL::Minimax1< Real >, ROL::Minimax3< Real >, ROL::ZOO::Objective_BVP< Real >, ROL::LinearObjective< Real >, ROL::ZOO::Objective_HS24< Real >, ROL::ZOO::Objective_HS1< Real >, ROL::ZOO::Objective_LeastSquares< Real >, ROL::ZOO::Objective_Powell< Real >, ROL::LinearCombinationObjective< Real >, ROL::ZOO::Objective_FreudensteinRoth< Real >, ROL::ZOO::Objective_SumOfSquares< Real >, and ROL::LogBarrierObjective< Real >.

Referenced by ROL::CompositeStep< Real >::accept(), ROL::BundleStep< Real >::compute(), ROL::CompositeStep< Real >::compute(), ROL::LineSearch< Real >::getInitialAlpha(), ROL::Step< Real >::initialize(), ROL::InteriorPointStep< Real >::initialize(), ROL::CompositeStep< Real >::initialize(), ROL::PrimalDualActiveSetStep< Real >::initialize(), ROL::TrustRegionStep< Real >::initialize(), ROL::IterationScaling< Real >::run(), ROL::CubicInterp< Real >::run(), ROL::BackTracking< Real >::run(), ROL::Bisection< Real >::run(), ROL::GoldenSection< Real >::run(), ROL::Brents< Real >::run(), ROL::PathBasedTargetLevel< Real >::run(), ROL::Objective< Real >::update(), ROL::CompositeStep< Real >::update(), ROL::PrimalDualActiveSetStep< Real >::update(), ROL::TrustRegionStep< Real >::update(), and ROL::LineSearchStep< Real >::update().

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

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 in Objective_GrossPitaevskii< Real >, ROL::ZOO::Objective_PoissonInversion< Real >, Objective_BurgersControl< Real >, Objective_PoissonInversion< Real >, ROL::ProjectedObjective< Real >, ROL::Reduced_ParametrizedObjective_SimOpt< Real >, ROL::HMCRObjective< Real >, ROL::MoreauYosidaPenalty< Real >, ROL::RiskAverseObjective< Real >, ROL::Reduced_Objective_SimOpt< Real >, ROL::BPOEObjective< Real >, ROL::AugmentedLagrangian< Real >, ROL::CDFObjective< Real >, ROL::InteriorPoint::PenalizedObjective< Real >, ROL::ZOO::Objective_DiodeCircuit< Real >, ROL::RiskNeutralObjective< Real >, ROL::ZOO::Objective_PoissonControl< Real >, Objective_GrossPitaevskii< Real >, ROL::MomentObjective< Real >, Zakharov_Sacado_Objective< Real >, ROL::PointwiseCDFObjective< Real >, ROL::Objective_SimOpt< Real >, ROL::ObjectiveFromBoundConstraint< Real >, ROL::ZOO::Objective_Zakharov< Real >, ROL::ZOO::Objective_SimpleEqConstrained< Real, XPrim, XDual >, ROL::ZOO::Objective_Rosenbrock< Real, XPrim, XDual >, ROL::ZOO::Objective_HS45< Real >, ROL::ZOO::Objective_HS38< Real >, ROL::ZOO::Objective_HS25< Real >, ROL::ZOO::Objective_HS2< Real >, ROL::ZOO::Objective_HS3< Real >, ROL::ZOO::Objective_HS4< Real >, ROL::ZOO::Objective_HS5< Real >, ROL::Minimax3< Real >, ROL::ZOO::Objective_LeastSquares< Real >, ROL::ZOO::Objective_BVP< Real >, ROL::ZOO::Objective_HS32< Real >, ROL::ZOO::Objective_HS29< Real >, ROL::Minimax2< Real >, ROL::ZOO::Objective_Beale< Real >, ROL::Minimax1< Real >, ROL::ZOO::Objective_HS24< Real >, ROL::ZOO::Objective_Powell< Real >, ROL::LinearObjective< Real >, ROL::ZOO::Objective_FreudensteinRoth< Real >, ROL::LinearCombinationObjective< Real >, ROL::ZOO::Objective_HS1< Real >, ROL::LogBarrierObjective< Real >, and ROL::ZOO::Objective_SumOfSquares< Real >.

Definition at line 64 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::axpy(), ROL::Vector< Real >::basis(), ROL::Vector< Real >::dimension(), ROL::Vector< Real >::dot(), ROL::ROL_EPSILON, and ROL::Vector< Real >::zero().

Referenced by ROL::CompositeStep< Real >::accept(), ROL::BundleStep< Real >::compute(), ROL::CompositeStep< Real >::compute(), ROL::PrimalDualActiveSetStep< Real >::computeCriticalityMeasure(), ROL::Step< Real >::initialize(), ROL::InteriorPointStep< Real >::initialize(), ROL::CompositeStep< Real >::initialize(), ROL::LineSearch< Real >::status(), ROL::Objective< Real >::update(), ROL::CompositeStep< Real >::update(), ROL::TrustRegionStep< Real >::update(), ROL::LineSearchStep< Real >::update(), and ROL::TrustRegionStep< Real >::updateGradient().

template<class Real >
Real ROL::Objective< Real >::dirDeriv ( const Vector< Real > &  x,
const Vector< Real > &  d,
Real &  tol 
)
virtual

Compute directional derivative.

This function returns the directional derivative of the objective function in the \(d\) direction.

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

Reimplemented in ROL::ProjectedObjective< Real >, ROL::ZOO::Objective_Zakharov< Real >, and ROL::LogBarrierObjective< Real >.

Definition at line 54 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::clone(), and ROL::ROL_EPSILON.

Referenced by ROL::Objective< Real >::update().

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

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 in Objective_GrossPitaevskii< Real >, Objective_BurgersControl< Real >, Objective_PoissonInversion< Real >, ROL::HMCRObjective< Real >, ROL::BPOEObjective< Real >, ROL::ZOO::Objective_DiodeCircuit< Real >, ROL::Reduced_ParametrizedObjective_SimOpt< Real >, ROL::ProjectedObjective< Real >, ROL::AugmentedLagrangian< Real >, ROL::InteriorPoint::PenalizedObjective< Real >, ROL::MoreauYosidaPenalty< Real >, ROL::CDFObjective< Real >, ROL::Reduced_Objective_SimOpt< Real >, ROL::RiskAverseObjective< Real >, ROL::Objective_SimOpt< Real >, ROL::MomentObjective< Real >, Objective_GrossPitaevskii< Real >, ROL::RiskNeutralObjective< Real >, Zakharov_Sacado_Objective< Real >, ROL::ObjectiveFromBoundConstraint< Real >, ROL::ZOO::Objective_SimpleEqConstrained< Real, XPrim, XDual >, ROL::ZOO::Objective_HS32< Real >, ROL::ZOO::Objective_HS29< Real >, ROL::LogBarrierObjective< Real >, ROL::ZOO::Objective_HS24< Real >, ROL::LinearCombinationObjective< Real >, and ROL::LinearObjective< Real >.

Definition at line 76 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::axpy(), ROL::Vector< Real >::clone(), ROL::Vector< Real >::norm(), ROL::ROL_EPSILON, ROL::Vector< Real >::scale(), and ROL::Vector< Real >::zero().

Referenced by ROL::CompositeStep< Real >::accept(), ROL::PrimalDualActiveSetStep< Real >::compute(), ROL::computeDenseHessian(), ROL::ZOO::Objective_Zakharov< Real >::dirDeriv(), ROL::ZOO::Objective_SumOfSquares< Real >::gradient(), ROL::ZOO::Objective_HS1< Real >::gradient(), ROL::ZOO::Objective_FreudensteinRoth< Real >::gradient(), ROL::ZOO::Objective_Powell< Real >::gradient(), ROL::ZOO::Objective_Beale< Real >::gradient(), ROL::ZOO::Objective_BVP< Real >::gradient(), ROL::ZOO::Objective_LeastSquares< Real >::gradient(), ROL::ZOO::Objective_HS5< Real >::gradient(), ROL::ZOO::Objective_HS2< Real >::gradient(), ROL::ZOO::Objective_HS4< Real >::gradient(), ROL::ZOO::Objective_HS3< Real >::gradient(), ROL::ZOO::Objective_HS25< Real >::gradient(), ROL::ZOO::Objective_HS38< Real >::gradient(), ROL::ZOO::Objective_HS45< Real >::gradient(), ROL::ZOO::Objective_Rosenbrock< Real, XPrim, XDual >::gradient(), ROL::ZOO::Objective_PoissonControl< Real >::gradient(), ROL::ZOO::Objective_PoissonInversion< Real >::gradient(), ROL::Reduced_Objective_SimOpt< Real >::hessVec(), ROL::Reduced_ParametrizedObjective_SimOpt< Real >::hessVec(), ROL::ZOO::Objective_DiodeCircuit< Real >::hessVec(), ROL::TrustRegionStep< Real >::initialize(), main(), ROL::CompositeStep< Real >::solveTangentialSubproblem(), and ROL::Objective< Real >::update().

template<class Real>
virtual void ROL::Objective< Real >::invHessVec ( Vector< Real > &  hv,
const Vector< Real > &  v,
const Vector< Real > &  x,
Real &  tol 
)
inlinevirtual

Apply inverse Hessian approximation to vector.

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

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

Reimplemented in ROL::ZOO::Objective_PoissonInversion< Real >, ROL::ProjectedObjective< Real >, ROL::ZOO::Objective_Zakharov< Real >, ROL::ZOO::Objective_Rosenbrock< Real, XPrim, XDual >, ROL::ZOO::Objective_Beale< Real >, ROL::ZOO::Objective_Powell< Real >, ROL::ZOO::Objective_FreudensteinRoth< Real >, ROL::ZOO::Objective_HS2< Real >, ROL::ZOO::Objective_HS5< Real >, ROL::ZOO::Objective_HS3< Real >, ROL::ZOO::Objective_HS1< Real >, and ROL::ZOO::Objective_SumOfSquares< Real >.

Definition at line 141 of file ROL_Objective.hpp.

Referenced by ROL::TrustRegionStep< Real >::initialize().

template<class Real>
virtual void ROL::Objective< 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 in ROL::HMCRObjective< Real >, ROL::BPOEObjective< Real >, ROL::Reduced_ParametrizedObjective_SimOpt< Real >, ROL::ProjectedObjective< Real >, ROL::Reduced_Objective_SimOpt< Real >, ROL::RiskAverseObjective< Real >, and ROL::RiskNeutralObjective< Real >.

Definition at line 155 of file ROL_Objective.hpp.

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

template<class Real>
virtual std::vector<std::vector<Real> > ROL::Objective< 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 
)
inlinevirtual

Finite-difference gradient check.

This function computes a sequence of one-sided finite-difference checks for the gradient. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left| \frac{f(x+td) - f(x)}{t} - \langle \nabla f(x),d\rangle_{\mathcal{X}^*,\mathcal{X}}\right|. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]dis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]numStepsis a parameter which dictates the number of finite difference steps.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 179 of file ROL_Objective.hpp.

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

Referenced by ROL::Objective< Real >::checkGradient(), and main().

template<class Real >
std::vector< std::vector< Real > > ROL::Objective< 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 
)
virtual

Finite-difference gradient check.

This function computes a sequence of one-sided finite-difference checks for the gradient. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left| \frac{f(x+td) - f(x)}{t} - \langle \nabla f(x),d\rangle_{\mathcal{X}^*,\mathcal{X}}\right|. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]gis used to create a temporary gradient vector.
[in]dis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]numStepsis a parameter which dictates the number of finite difference steps.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 110 of file ROL_ObjectiveDef.hpp.

template<class Real>
virtual std::vector<std::vector<Real> > ROL::Objective< 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 
)
inlinevirtual

Finite-difference gradient check with specified step sizes.

This function computes a sequence of one-sided finite-difference checks for the gradient. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left| \frac{f(x+td) - f(x)}{t} - \langle \nabla f(x),d\rangle_{\mathcal{X}^*,\mathcal{X}}\right|. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]dis a direction vector.
[in]stepsis vector of steps of user-specified size.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 241 of file ROL_Objective.hpp.

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

template<class Real >
std::vector< std::vector< Real > > ROL::Objective< 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 
)
virtual

Finite-difference gradient check with specified step sizes.

This function computes a sequence of one-sided finite-difference checks for the gradient. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left| \frac{f(x+td) - f(x)}{t} - \langle \nabla f(x),d\rangle_{\mathcal{X}^*,\mathcal{X}}\right|. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]gis used to create a temporary gradient vector.
[in]dis a direction vector.
[in]stepsis vector of steps of user-specified size.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 130 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::clone(), ROL::Vector< Real >::dot(), ROL::ROL_EPSILON, ROL::Finite_Difference_Arrays::shifts, and ROL::Finite_Difference_Arrays::weights.

template<class Real>
virtual std::vector<std::vector<Real> > ROL::Objective< 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 
)
inlinevirtual

Finite-difference Hessian-applied-to-vector check.

This function computes a sequence of one-sided finite-difference checks for the Hessian. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left\| \frac{\nabla f(x+td) - \nabla f(x)}{t} - \nabla^2 f(x)d\right\|_{\mathcal{X}^*}. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i \nabla f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]dis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]numStepsis a parameter which dictates the number of finite difference steps.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 303 of file ROL_Objective.hpp.

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

Referenced by ROL::Objective< Real >::checkHessVec(), and main().

template<class Real >
std::vector< std::vector< Real > > ROL::Objective< 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 
)
virtual

Finite-difference Hessian-applied-to-vector check.

This function computes a sequence of one-sided finite-difference checks for the Hessian. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left\| \frac{\nabla f(x+td) - \nabla f(x)}{t} - \nabla^2 f(x)d\right\|_{\mathcal{X}^*}. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i \nabla f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]hvis used to create temporary gradient and Hessian-times-vector vectors.
[in]dis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]numStepsis a parameter which dictates the number of finite difference steps.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 227 of file ROL_ObjectiveDef.hpp.

template<class Real>
virtual std::vector<std::vector<Real> > ROL::Objective< 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 
)
inlinevirtual

Finite-difference Hessian-applied-to-vector check with specified step sizes.

This function computes a sequence of one-sided finite-difference checks for the Hessian. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left\| \frac{\nabla f(x+td) - \nabla f(x)}{t} - \nabla^2 f(x)d\right\|_{\mathcal{X}^*}. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i \nabla f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]dis a direction vector.
[in]stepsis vector of steps of user-specified size.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 364 of file ROL_Objective.hpp.

References ROL::Objective< Real >::checkHessVec().

template<class Real >
std::vector< std::vector< Real > > ROL::Objective< 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 
)
virtual

Finite-difference Hessian-applied-to-vector check with specified step sizes.

This function computes a sequence of one-sided finite-difference checks for the Hessian. At each step of the sequence, the finite difference step size is decreased. The output compares the error

\[ \left\| \frac{\nabla f(x+td) - \nabla f(x)}{t} - \nabla^2 f(x)d\right\|_{\mathcal{X}^*}. \]

if the approximation is first order. More generally, difference approximation is

\[ \frac{1}{t} \sum\limits_{i=1}^m w_i \nabla f(x+t c_i d) \]

where m = order+1, \(w_i\) are the difference weights and \(c_i\) are the difference steps

Parameters
[in]xis an optimization variable.
[in]hvis used to create temporary gradient and Hessian-times-vector vectors.
[in]dis a direction vector.
[in]stepsis vector of steps of user-specified size.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.
[in]orderis the order of the finite difference approximation (1,2,3,4)

Definition at line 245 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::clone(), ROL::ROL_EPSILON, ROL::Finite_Difference_Arrays::shifts, and ROL::Finite_Difference_Arrays::weights.

template<class Real>
virtual std::vector<Real> ROL::Objective< Real >::checkHessSym ( const Vector< Real > &  x,
const Vector< Real > &  v,
const Vector< Real > &  w,
const bool  printToStream = true,
std::ostream &  outStream = std::cout 
)
inlinevirtual

Hessian symmetry check.

This function checks the symmetry of the Hessian by comparing

\[ \langle \nabla^2f(x)v,w\rangle_{\mathcal{X}^*,\mathcal{X}} \quad\text{and}\quad \langle \nabla^2f(x)w,v\rangle_{\mathcal{X}^*,\mathcal{X}}. \]

Parameters
[in]xis an optimization variable.
[in]vis a direction vector.
[in]wis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.

Definition at line 419 of file ROL_Objective.hpp.

Referenced by main().

template<class Real >
std::vector< Real > ROL::Objective< 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 
)
virtual

Hessian symmetry check.

This function checks the symmetry of the Hessian by comparing

\[ \langle \nabla^2f(x)v,w\rangle_{\mathcal{X}^*,\mathcal{X}} \quad\text{and}\quad \langle \nabla^2f(x)w,v\rangle_{\mathcal{X}^*,\mathcal{X}}. \]

Parameters
[in]xis an optimization variable.
[in]hvis used to create temporary Hessian-times-vector vectors.
[in]vis a direction vector.
[in]wis a direction vector.
[in]printToStreamis a flag that turns on/off output.
[out]outStreamis the output stream.

Definition at line 347 of file ROL_ObjectiveDef.hpp.

References ROL::Vector< Real >::clone(), ROL::Vector< Real >::dot(), and ROL::ROL_EPSILON.


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