Playa::ObjectiveBase Class Reference

Base class for differentiable objective functions. More...

Inheritance diagram for Playa::ObjectiveBase:

Playa::ObjectWithVerbosity Sundance::PDEConstrainedObjBase Sundance::LinearPDEConstrainedObj Sundance::NonlinearPDEConstrainedObj

List of all members.

Public Member Functions

 ObjectiveBase (int verb=0)
virtual ~ObjectiveBase ()
 virtual dtor
virtual void evalGrad (const Vector< double > &x, double &f, Vector< double > &grad) const =0
 evaluate objective function and gradient
virtual void eval (const Vector< double > &x, double &f) const =0
 evaluate objective function without gradient.
virtual Vector< double > getInit () const =0
 return an initial guess for the design vector
virtual double getInvHScale () const
 return an initial approximation to the scale for the inverse of the Hessian
virtual void iterationCallback (const Vector< double > &x, int iter) const
 User-overrideable hook for any callbacks to be done at the end of each iteration.
virtual void finalCallback (const Vector< double > &x) const
 User-overrideable hook for any callbacks to be done at the end of an optimization loop.
void setContextString (const string &str) const
 Set a string describing the context in which the function is being called.
const string & contextString () const
 Set a string describing the context in which the function is being called.
virtual int numFuncEvals () const
 Return the number of evaluations.
virtual string description () const
bool fdCheck (const Vector< double > &x, double tol, int verbosity=0) const
 Debugging utility to check the gradient by comparing to a finite difference gradient calculation.

Protected Member Functions

virtual double fdStep () const

Private Attributes

string contextString_


Detailed Description

Base class for differentiable objective functions.

Author:
Paul Boggs and Kevin Long

Definition at line 25 of file PlayaObjectiveBase.hpp.


Constructor & Destructor Documentation

Playa::ObjectiveBase::ObjectiveBase ( int  verb = 0  )  [inline]

Definition at line 30 of file PlayaObjectiveBase.hpp.

virtual Playa::ObjectiveBase::~ObjectiveBase (  )  [inline, virtual]

virtual dtor

Definition at line 33 of file PlayaObjectiveBase.hpp.


Member Function Documentation

const string& Playa::ObjectiveBase::contextString (  )  const [inline]

Set a string describing the context in which the function is being called.

This is intended to aid in reading diagnostic output.

Definition at line 67 of file PlayaObjectiveBase.hpp.

References contextString_.

virtual string Playa::ObjectiveBase::description (  )  const [inline, virtual]

Definition at line 77 of file PlayaObjectiveBase.hpp.

virtual void Playa::ObjectiveBase::eval ( const Vector< double > &  x,
double &  f 
) const [pure virtual]

evaluate objective function without gradient.

Implemented in Sundance::PDEConstrainedObjBase.

Referenced by fdCheck().

virtual void Playa::ObjectiveBase::evalGrad ( const Vector< double > &  x,
double &  f,
Vector< double > &  grad 
) const [pure virtual]

evaluate objective function and gradient

Implemented in Sundance::PDEConstrainedObjBase.

Referenced by fdCheck().

bool Playa::ObjectiveBase::fdCheck ( const Vector< double > &  x,
double  tol,
int  verbosity = 0 
) const

Debugging utility to check the gradient by comparing to a finite difference gradient calculation.

This is will be expensive.

eval at xPlus

Definition at line 15 of file PlayaObjectiveBase.cpp.

References Playa::VectorSpace< Scalar >::baseGlobalNaturalIndex(), Playa::Vector< Scalar >::copy(), Playa::VectorSpace< Scalar >::dim(), eval(), evalGrad(), fdStep(), Playa::VectorSpace< Scalar >::numLocalElements(), PLAYA_MSG1, PLAYA_MSG2, PLAYA_MSG3, and Playa::Vector< Scalar >::space().

virtual double Playa::ObjectiveBase::fdStep (  )  const [inline, protected, virtual]

Definition at line 86 of file PlayaObjectiveBase.hpp.

Referenced by fdCheck().

virtual void Playa::ObjectiveBase::finalCallback ( const Vector< double > &  x  )  const [inline, virtual]

User-overrideable hook for any callbacks to be done at the end of an optimization loop.

Default is a no-op.

Definition at line 55 of file PlayaObjectiveBase.hpp.

virtual Vector<double> Playa::ObjectiveBase::getInit (  )  const [pure virtual]

return an initial guess for the design vector

Implemented in Sundance::PDEConstrainedObjBase.

virtual double Playa::ObjectiveBase::getInvHScale (  )  const [inline, virtual]

return an initial approximation to the scale for the inverse of the Hessian

Reimplemented in Sundance::PDEConstrainedObjBase.

Definition at line 47 of file PlayaObjectiveBase.hpp.

virtual void Playa::ObjectiveBase::iterationCallback ( const Vector< double > &  x,
int  iter 
) const [inline, virtual]

User-overrideable hook for any callbacks to be done at the end of each iteration.

Default is a no-op.

Reimplemented in Sundance::PDEConstrainedObjBase.

Definition at line 51 of file PlayaObjectiveBase.hpp.

virtual int Playa::ObjectiveBase::numFuncEvals (  )  const [inline, virtual]

Return the number of evaluations.

Reimplemented in Sundance::PDEConstrainedObjBase.

Definition at line 72 of file PlayaObjectiveBase.hpp.

void Playa::ObjectiveBase::setContextString ( const string &  str  )  const [inline]

Set a string describing the context in which the function is being called.

This is intended to aid in reading diagnostic output.

Definition at line 61 of file PlayaObjectiveBase.hpp.

References contextString_.


Member Data Documentation

string Playa::ObjectiveBase::contextString_ [mutable, private]

Definition at line 90 of file PlayaObjectiveBase.hpp.

Referenced by contextString(), and setContextString().

Site Contact