class HCL_FunctionalGrad_d : public HCL_Functional_d

HCL_FunctionalGrad_d is the base class for all real-valued functions which can compute their gradients

Inheritance:


Public Methods

int CheckGrad ( const HCL_Vector_d & x, const HCL_Vector_d & y, ostream & str, int n=10, double hmin=0.1, double hmax=1.0 )
Check analytic gradient
virtual HCL_VectorSpace_d& Domain ()
Domain space access
virtual HCL_EvaluateFunctionalGrad_d* EvaluateGrad ( const HCL_Vector_d & x )
EvaluateGrad creates an "evaluation" object, which knows how to compute the function value and gradient at the given x
virtual void Gradient ( const HCL_Vector_d & x, HCL_Vector_d & g )
Gradient computes the gradient at x
virtual double Value ( const HCL_Vector_d & x )
Value evaluates the function at x
virtual ostream& Write ( ostream & str )
Debugging information

Inherited from HCL_Functional_d:

Public Methods

virtual double MaxStep( const HCL_Vector_d & x, const HCL_Vector_d &dir)
void Scan( const HCL_Vector_d & x, const HCL_Vector_d & dx, int N, double hmin, double hmax, char * fname = NULL )

Inherited from HCL_Base:

Public Methods

int Count()
void DecCount()
void IncCount()

Private Fields

int ReferenceCount

Documentation

HCL_FunctionalGrad_d is the base class for all real-valued functions which can compute their gradients. The primary purpose of this class is to represent objective functions in optimization problems. Since this class provides only first derivative information, an object of this type would typically be used in a gradient-based algorithm, for example, an algorithm of type HCL_UMinGrad_d.

The primary methods of this class are

In order to define a derived class, one must first define a corresponding HCL_EvaluateFunctionalGrad_d class. Defining objective functions is expected to be one of the main activities of users of HCL, since the objective function provides the point of contact between the application software and HCL's optimization code. Please see one of the test programs that comes in the HCLtest directory for examples.

int CheckGrad( const HCL_Vector_d & x, const HCL_Vector_d & y, ostream & str, int n=10, double hmin=0.1, double hmax=1.0 )
Check analytic gradient. This method computes the relative difference between the directional derivative as computed from the analytic gradient and the same estimated by a central difference formula. This is done at n equally-spaced points on the line segment [x+hmin*y,x+hmax*y]. The parameters hmin, hmax, and n are optional and default to 0.1, 1.0, and 10, respectively. If the analytic gradient is correctly implemented and the function is three times continously differentiable, then these errors will lie on a parabola when plotted against the step size. The results are sent to the output stream str.

virtual HCL_VectorSpace_d& Domain()
Domain space access. Returns a reference to the HCL_VectorSpace_d which forms the domain of the functional. Note that, in the current design, the domain of a functional must be an entire vector space, although many nonlinear functionals are only defined on an open subset of a vector space. This is a flaw in the design of HCL which may be corrected in some future version of the software. A partial work-around to this problem is provided by the MaxStep method.

virtual HCL_EvaluateFunctionalGrad_d* EvaluateGrad( const HCL_Vector_d & x )
EvaluateGrad creates an "evaluation" object, which knows how to compute the function value and gradient at the given x. The purpose of using EvaluateGrad rather than Value and Gradient is for efficiency; many functionals are such that the evaluation of the functional and its gradient require common intermediate calculations. The evaluation object mechanism gives the functional class implementor a place to store these intermediate results so that they do not have to be re-computed if the the gradient is requested at some point after the value. The implementor of an optimization algorithm should respect this by using EvaluateGrad to get a value and/or gradient rather than using Value and/or Gradient.

virtual double Value( const HCL_Vector_d & x )
Value evaluates the function at x. It does so by creating an evaluation object with the EvaluateGrad method, getting the value from it, deleting the evaluation object, and returning the value. Value is defined in this (the base) class, so it need not be redefined in a derived class.

virtual void Gradient( const HCL_Vector_d & x, HCL_Vector_d & g )
Gradient computes the gradient at x. It does so by creating an evaluation object with the EvaluateGrad method, getting the gradient from it, and deleting the evaluation object. Gradient is defined in this (the base) class, so it need not be redefined in a derived class.

virtual ostream& Write( ostream & str )
Debugging information. Write should be implemented to print a description of the object that will be useful for debugging. If a complete description is lengthy, an implementor should consider just printing out a useful subset. This method will likely be used to send information to the screen when a error condition is encountered.


Direct child classes:
HCL_LinCombFcnlGrad_d
HCL_LeastSquaresFcnlGrad_d
HCL_DiagFunctionalGrad_d
HCL_ALFcnlGrad_d
HCL_FunctionalHess_d
HCL_RestrictedFunctionalGrad_d
HCL_FunctionalProductDomainGrad_d

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de