HCL_UMinNLCG_d implements the nonlinear conjugate gradient algorithm (Polak-Ribiere form) for unconstrained minimization
HCL_UMinNLCG_d ( HCL_LineSearch_d * linesearch = NULL, char *fname = NULL ) Usual constructor | |
Table& | Parameters () const Access to parameter table |
virtual HCL_EvaluateFunctional_d& | LastEval () const Returns a reference to the last evaluation object. |
virtual void | SetScaling ( HCL_LinearOp_d * S, HCL_LinearSolver_d * lsolver=NULL ) SetScaling defines a new inner product in terms of a symmetric, positive definite operator S: <x,y> = (x,Sy) |
virtual void | UnSetScaling () UnSetScaling returns the inner product to the default. |
int | Minimize ( HCL_Functional_d & f, HCL_Vector_d & x0) Conjugate gradient minimizer |
virtual ostream& | Write ( ostream & str ) const Prints description of the object |
return codes (TermCode) |
enum Return values for the method Minimize.
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:
- Minimize, which performs the minimization;
- Parameters,which provides a means of accessing or changing algorithmic parameters which control the iteration. These parameters are typically set initially by passing a file name to the constructor; this file contains parameter values. Any parameters not specified for the constructor are assigned default values. See the documentation of the parameters for more information.
- LastEval, which provides access to the "evaluation" object at the final point.
Use of this minimizer typically involves the following steps:
- Construct functional with gradient, i.e. an object of a class derived from HCL_Functional_d;
- Construct a starting vector in the domain of the functional;
- Construct a line search object, i.e. an object of a class derived from HCL_LineSearch_d (this step is optional, since there is a default line search);
- Construct the minimizer by passing the constructor the line search object and a parameter file;
- Call the Minimize method;
- Manipulate the value and/or gradient at the approximate minimizer through the LastEval method.
Here's an example:
MyFcnl f; // MyFcnl must be derived from HCL\_Functional\_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.)
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.
x0 - starting point, on successful completion, this will hold
the computed minimum
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