HCL_Functional is the base class for all real-valued functions
|virtual HCL_VectorSpace_d&||Domain () const |
Domain space access
|virtual double||MaxStep ( const HCL_Vector_d & x, const HCL_Vector_d & dir) const |
MaxStep computes the largest value of a such that x+a*dir lies in the domain of definition of the functional
|virtual HCL_EvaluateFunctional_d*||Evaluate ( const HCL_Vector_d & x ) const |
Evaluate creates an "evaluation" object, which knows how to compute the function value, gradient,and Hessian at the given x
|virtual double||Value ( const HCL_Vector_d & x ) const |
Value evaluates the function at x
|virtual void||Gradient ( const HCL_Vector_d & x, HCL_Vector_d & g ) const |
Gradient computes the gradient at x
|virtual HCL_LinearOp_d*||Hessian ( const HCL_Vector_d & x ) const |
Hessian computes the gradient at x
|void||Scan ( const HCL_Vector_d & x, const HCL_Vector_d & dx, int N, double hmin, double hmax, char * fname = NULL )|
Scan computes the value of the function at N points
|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
|int||CheckHess ( const HCL_Vector_d &, const HCL_Vector_d &, ostream & str, int n=10, double hmin=0.1, double hmax=1.0 )|
Check analytic Hessian
|virtual double||Value1 ( const HCL_Vector_d & x ) const |
Value1 computes the value of the functional at x
|virtual void||Gradient1 ( const HCL_Vector_d & x, HCL_Vector_d & y ) const |
Gradient1 computes the gradient of the functional at x and stores it in y
|virtual void||HessianImage ( const HCL_Vector_d & x, const HCL_Vector_d & dx, HCL_Vector_d & dy ) const |
HessianImage computes the action of the Hessian of the functional (at x) on the input dx, giving dy
|virtual void||HessianInvImage ( const HCL_Vector_d & x, const HCL_Vector_d & dy, HCL_Vector_d & dx ) const |
HessianInvImage computes the action of the inverse Hessian of the functional (at x) on the input dy, giving dx
|virtual HCL_LinearOp_d*||Hessian1 ( const HCL_Vector_d & x ) const |
Hessian1 creates an instance of HCL_LinearOp to represent the Hessian of the functional at x, and returns a pointer to it
HCL_Functional is the base class for all real-valued functions. The purpose of this class is to represent objective functions in optimization problems.
The primary methods of this class are
- Domain Returns a reference to the domain of the functional, which is a vector space. This is used primarily for error-checking; for example:if( x.Space() != f.Domain() ) // Error condition
- Value Returns the value of the functional at a point. Example:double fx = f.Value( x );
- Gradient Computes the gradient of the functional at a point. Example:HCL_Vector_d * g = f.Domain().Member(); // Get a vector to hold the gradient f.Gradient( x,*g ); // Fill *g with the gradient of f at x
- Hessian Computes the Hessian of the functional at a point. Example:HCL_LinearOp_d * L = f.Hessian( x ); // Get the Hessian operator at x.
- Evaluate Returns an "evaluation object", that is, an object of class HCL_EvaluateFunctional_d, which knows the value, gradient, and Hessian of the functional at given point. Typically, this method should be used to compute the value, gradient, and/or Hessian of the functional, rather than Value, Gradient, and/or Hessian. For example, implementors of optimization algorithms should use Evaluate unless it is known that only one of the value, gradient, Hessian will be used at a given point. Otherwise, the optimization algorithm is failing to take advantage of possible efficiencies that may be built into a given functional class.
There are several ways to implements functionals; the various options are described in detail, with examples, in the Technical Report referenced at the end of this documentation. In brief, the basic issue is that a functional class must have a corresponding evaluation class (derived from HCL_EvaluateFunctional). The two basic options are:
- Define a single class, derived from HCL_Functional, and use the default evaluation class HCL_FunctionalDefaultEval. This is done automatically if the virtual function Evaluate is not overridden in the derived functional class. However, the implementor of the derived class must then override the protected methods Value1, Gradient1, and HessianImage (and HessianInvImage, if desired) or Hessian1. This is the method of choice if there is no efficiency to be gained by sharing intermediate computations among the value, gradient, and Hessian.
- Define a class derived from HCL_Functional and another class derived from HCL_EvaluateFunctional. Override the virtual function Evaluate in HCL_Evaluate to create an instance of the evaluation class. This is the method of choice if there is significant gain in sharing intermediate computations among the value, gradient, and Hessian. The user-defined evaluation class provides a place to store these intermediate calculations.
For more information about functional and evaluation classes, see "Implementing functionals in HCL", Technical Report 99-24, Department of Computational and Applied Mathematics, Rice University, PO Box 1892, Houston, TX 77251-1892. This report is available on the HCL home page.
alphabetic index hierarchy of classes
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling