class HCL_UMinNLCG_d : public HCL_UMinGrad_d

HCL_UMinNLCG_d implements the nonlinear conjugate gradient algorithm (Polak-Ribiere form) for unconstrained minimization

Inheritance:


Public Methods

HCL_UMinNLCG_d ( HCL_LineSearch_d * linesearch = NULL, char *fname = NULL )
Usual constructor
virtual HCL_EvaluateFunctionalGrad_d& LastEval ()
last evaluation object
int Minimize ( HCL_FunctionalGrad_d & f, HCL_Vector_d & x0)
Conjugate gradient minimizer
Table& Parameters ()
Access to parameter table
virtual void SetScaling ( HCL_LinearOpAdj_d * S, HCL_LinearSolver_d * lsolver )
SetScaling defines a new inner product in terms of a symmetric, positive definite operator S: <x,y> = (x,Sy)
virtual void SetScaling ( HCL_LinearOpAdjInv_d * S )
Alternate version of SetScaling.
virtual void UnSetScaling ()
UnSetScaling returns the inner product to the default.

Public

return codes (TermCode)

Private Methods

void Clean ()
Write output parameters out to parameter table and deallocate vectors.
void Initialize ( HCL_VectorSpace_d & dom )
Read parameters from parameter table and allocate temporary vectors.

Private

Input parameters
int MaxItn
(100) maximum number of iterations
double Typf
(1) Typical value of the functional near the solution
double TypxNorm
(1) Typical norm of the unknown vector x near the solution
double GradTol
(1e-2) Gradient tolerance
double MinStep
(1e-20) Minimum allowable step
double MaxStep
(1e+20) Maximum allowable step
int CscMaxLimit
(5) Maximum number of steps of length MaxStep allowed before the algorithm decides that the iterates are diverging
int DumpFlag
(0) Dump level
char DumpFile [81]
(HCL_UMin_lbfgs
int DispPrecision
(6) Display precision---the number of digits sent to the screen
int DumpPrecision
(6) Dump precision---the number of digits sent to the file
int TraceSteps
(0) If nonzero, the iterates are sent to a file using the Write method from the vector class
char StepFile [81]
(HCL_UMinNLCG
Output parameters
int TermCode
exit status (0 = ok, >0 = failure)

Inherited from HCL_UMinGrad_d:

Public Classes

enum
PossibleMinimizer
Possible local minimizer
PossibleConvergence
Possible convergence
LineSearchFailed
Line search failed
PossibleDivergence
Possible divergence
IterationLimit
Iteration limit reached
InaccurateGradient
Possible inaccurate gradient calculation

Public

enum
PossibleMinimizer
Possible local minimizer
PossibleConvergence
Possible convergence
LineSearchFailed
Line search failed
PossibleDivergence
Possible divergence
IterationLimit
Iteration limit reached
InaccurateGradient
Possible inaccurate gradient calculation

Inherited from HCL_Base:

Public Methods

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

Private Fields

int ReferenceCount

Documentation

HCL_UMinNLCG_d implements the nonlinear conjugate gradient algorithm (Polak-Ribiere form) for unconstrained minimization. For background on the algorithm, see, for example, "Practical Methods of Optimization" (2nd edition) by R. Fletcher, Wiley, 1987.

This algorithm depends on a fairly accurate line search. The line search is represented by an abstract base class, HCL_LineSearch_d; this allows the algorithm to be executed with different choices of the line search algorithm. The default is HCL_LineSearch_Fl_d, which implements Fletcher's line search (see the above reference).

The purpose of the algorithm is to take a functional with gradient and a starting guess in the domain of the functional, and to produce a local minimizer via a descent algorithm.

The primary methods of this class are:

Use of this minimizer typically involves the following steps:

Here's an example:

       MyFcnl f;  // MyFcnl must be derived from HCL\_FunctionalGrad_d
       MyVector x( "x0" ); // Assume MyVector has a constructor which
                           //reads from a file
       HCL_LineSearch_MT_d lsearch( "lsearch.dat" );  // More'-Thuente
                                                      // line search
       HCL_UMinNLCG_d umin( "umin.dat",&lsearch );    // Parameters read
                                                      // from "umin.dat"
       umin.Minimize( f,x );  // Search for local minimum
       cout << "Final value of f: " << umin.LastEval().ValueRef() << endl;
       cout << "Final gradient norm: "
            << umin.LastEval().GradientRef().Norm() << endl;
    
(If the display flag is turned on, the final function value and gradient norm will be displayed anyway, so the last two lines are not necessary. But they illustrate that the last function value and gradient are stored in case they are needed.)
Input parameters
In a parameter file, the names may be prepended by "UMinNLCG::" or simply "UMin::".

int MaxItn
(100) maximum number of iterations

double Typf
(1) Typical value of the functional near the solution. Setting this makes the gradient stopping tolerance more meaningful.

double TypxNorm
(1) Typical norm of the unknown vector x near the solution. Setting this makes the gradient stopping tolerance more meaningful.

double GradTol
(1e-2) Gradient tolerance. The algorithm attempts to locate a point where the relative gradient norm (i.e. the norm of the gradient scaled by the size of the vector x and by f(x)) is less than this value.

double MinStep
(1e-20) Minimum allowable step. If the algorithm takes a (relative) step less than this value in norm, it halts and reports "Possible convergence".

double MaxStep
(1e+20) Maximum allowable step. If the algorithm takes too many consecutive steps of length MaxStep, it assumes that the iterates are diverging and reports "Possible divergence".

int CscMaxLimit
(5) Maximum number of steps of length MaxStep allowed before the algorithm decides that the iterates are diverging

int DumpFlag
(0) Dump level. This determines how much information should be sent to the dump file during the execution of the algorithm. Possible values are: 0 - No output; 1 - Function value and gradient norm after final iteration; 2 - Function value and gradient norm after every iteration.

char DumpFile[81]
(HCL_UMin_lbfgs.DumpFile) Dump file name.

int DispPrecision
(6) Display precision---the number of digits sent to the screen

int DumpPrecision
(6) Dump precision---the number of digits sent to the file

int TraceSteps
(0) If nonzero, the iterates are sent to a file using the Write method from the vector class

char StepFile[81]
(HCL_UMinNLCG.StepFile) File name for recording iterates.

Output parameters

int TermCode
exit status (0 = ok, >0 = failure)

void Initialize( HCL_VectorSpace_d & dom )
Read parameters from parameter table and allocate temporary vectors.

void Clean()
Write output parameters out to parameter table and deallocate vectors.

return codes (TermCode)

HCL_UMinNLCG_d( HCL_LineSearch_d * linesearch = NULL, char *fname = NULL )
Usual constructor
Parameters:
linesearch - Linesearch class (optional). If no line search is specified, then Fletcher's line search (HCL_LineSearch_Fl_d) will be used.
fname - Parameter file name or NULL. If given, this file contains algorithmic parameters (such as stopping tolerances), a full list of which is given elsewhere in the documentation of this class. For example, to set the maximum number of iterations to 100, the file should contain a line of the form UMinNLCG::MaxItn = 100 or, alternately, UMin::MaxItn = 100. If the line seach is not provided, then this file will also be passed to the line search constructor, and so can contain entries such as LineSearch::DispFlag = 1.

Table& Parameters()
Access to parameter table

virtual HCL_EvaluateFunctionalGrad_d& LastEval()
last evaluation object

virtual void SetScaling( HCL_LinearOpAdj_d * S, HCL_LinearSolver_d * lsolver )
SetScaling defines a new inner product in terms of a symmetric, positive definite operator S: <x,y> = (x,Sy)

virtual void SetScaling( HCL_LinearOpAdjInv_d * S )
Alternate version of SetScaling.

virtual void UnSetScaling()
UnSetScaling returns the inner product to the default.

int Minimize( HCL_FunctionalGrad_d & f, HCL_Vector_d & x0)
Conjugate gradient minimizer. This algorithm uses the Polak and Ribiere formula to update the search direction. (See Fletcher (1987).
Parameters:
fptr - function
x0 - starting point, on successful completion, this will hold the computed minimum


This class has no child classes.

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