multimin.texi
字号:
new starting point.@end deftypefun@node Multimin Stopping Criteria@section Stopping CriteriaA minimization procedure should stop when one of the followingconditions is true:@itemize @bullet@itemA minimum has been found to within the user-specified precision.@itemA user-specified maximum number of iterations has been reached.@itemAn error has occurred.@end itemize@noindentThe handling of these conditions is under user control. The functionsbelow allow the user to test the precision of the current result.@deftypefun int gsl_multimin_test_gradient (const gsl_vector * @var{g}, double @var{epsabs})This function tests the norm of the gradient @var{g} against theabsolute tolerance @var{epsabs}. The gradient of a multidimensionalfunction goes to zero at a minimum. The test returns @code{GSL_SUCCESS}if the following condition is achieved,@tex\beforedisplay$$|g| < \hbox{\it epsabs}$$\afterdisplay@end tex@ifinfo@example|g| < epsabs@end example@end ifinfo@noindentand returns @code{GSL_CONTINUE} otherwise. A suitable choice of@var{epsabs} can be made from the desired accuracy in the function forsmall variations in @math{x}. The relationship between these quantitiesis given by @c{$\delta{f} = g\,\delta{x}$}@math{\delta f = g \delta x}.@end deftypefun@deftypefun int gsl_multimin_test_size (const double @var{size}, double @var{epsabs})This function tests the minimizer specific characteristicsize (if applicable to the used minimizer) against absolute tolerance @var{epsabs}. The test returns @code{GSL_SUCCESS} if the size is smaller than tolerance,otherwise @code{GSL_CONTINUE} is returned.@end deftypefun@node Multimin Algorithms with Derivatives@section Algorithms with DerivativesThere are several minimization methods available. The best choice ofalgorithm depends on the problem. The algorithms described in thissection use the value of the function and its gradient at eachevaluation point.@deffn {Minimizer} gsl_multimin_fdfminimizer_conjugate_fr@cindex Fletcher-Reeves conjugate gradient algorithm, minimization@cindex Conjugate gradient algorithm, minimization@cindex minimization, conjugate gradient algorithmThis is the Fletcher-Reeves conjugate gradient algorithm. The conjugategradient algorithm proceeds as a succession of line minimizations. Thesequence of search directions is used to build up an approximation to thecurvature of the function in the neighborhood of the minimum. An initial search direction @var{p} is chosen using the gradient, and lineminimization is carried out in that direction. The accuracy of the lineminimization is specified by the parameter @var{tol}. The minimumalong this line occurs when the function gradient @var{g} and the search direction@var{p} are orthogonal. The line minimization terminates when@c{$p\cdot g < tol |p| |g|$} @math{dot(p,g) < tol |p| |g|}. Thesearch direction is updated using the Fletcher-Reeves formula@math{p' = g' - \beta g} where @math{\beta=-|g'|^2/|g|^2}, andthe line minimization is then repeated for the new searchdirection.@end deffn@deffn {Minimizer} gsl_multimin_fdfminimizer_conjugate_pr@cindex Polak-Ribiere algorithm, minimization@cindex minimization, Polak-Ribiere algorithmThis is the Polak-Ribiere conjugate gradient algorithm. It is similarto the Fletcher-Reeves method, differing only in the choice of thecoefficient @math{\beta}. Both methods work well when the evaluationpoint is close enough to the minimum of the objective function that itis well approximated by a quadratic hypersurface.@end deffn@deffn {Minimizer} gsl_multimin_fdfminimizer_vector_bfgs2@deffnx {Minimizer} gsl_multimin_fdfminimizer_vector_bfgs@cindex BFGS algorithm, minimization@cindex minimization, BFGS algorithmThese methods use the vector Broyden-Fletcher-Goldfarb-Shanno (BFGS)algorithm. This is a quasi-Newton method which builds up an approximationto the second derivatives of the function @math{f} using the differencebetween successive gradient vectors. By combining the first and secondderivatives the algorithm is able to take Newton-type steps towards thefunction minimum, assuming quadratic behavior in that region.The @code{bfgs2} version of this minimizer is the most efficientversion available, and is a faithful implementation of the lineminimization scheme described in Fletcher's @cite{Practical Methods ofOptimization}, Algorithms 2.6.2 and 2.6.4. It supercedes the original@code{bfgs} routine and requires substantially fewer function andgradient evaluations. The user-supplied tolerance @var{tol}corresponds to the parameter @math{\sigma} used by Fletcher. A valueof 0.1 is recommended for typical use (larger values correspond toless accurate line searches).@end deffn@deffn {Minimizer} gsl_multimin_fdfminimizer_steepest_descent@cindex steepest descent algorithm, minimization@cindex minimization, steepest descent algorithmThe steepest descent algorithm follows the downhill gradient of thefunction at each step. When a downhill step is successful the step-sizeis increased by a factor of two. If the downhill step leads to a higherfunction value then the algorithm backtracks and the step size isdecreased using the parameter @var{tol}. A suitable value of @var{tol}for most applications is 0.1. The steepest descent method isinefficient and is included only for demonstration purposes.@end deffn@node Multimin Algorithms without Derivatives@section Algorithms without DerivativesThe algorithms described in this section use only the value of the functionat each evaluation point.@deffn {Minimizer} gsl_multimin_fminimizer_nmsimplex2@deffnx {Minimizer} gsl_multimin_fminimizer_nmsimplex@cindex Nelder-Mead simplex algorithm for minimization@cindex simplex algorithm, minimization@cindex minimization, simplex algorithmThese methods use the Simplex algorithm of Nelder and Mead. They construct@math{n} vectors @math{p_i} from thestarting vector @var{x} and the vector @var{step_size} as follows:@tex\beforedisplay$$\eqalign{p_0 & = (x_0, x_1, \cdots , x_n) \crp_1 & = (x_0 + step\_size_0, x_1, \cdots , x_n) \crp_2 & = (x_0, x_1 + step\_size_1, \cdots , x_n) \cr\dots &= \dots \crp_n & = (x_0, x_1, \cdots , x_n+step\_size_n) \cr}$$\afterdisplay@end tex@ifinfo@examplep_0 = (x_0, x_1, ... , x_n) p_1 = (x_0 + step_size_0, x_1, ... , x_n) p_2 = (x_0, x_1 + step_size_1, ... , x_n) ... = ...p_n = (x_0, x_1, ... , x_n+step_size_n)@end example@end ifinfo@noindentThese vectors form the @math{n+1} vertices of a simplex in @math{n}dimensions. On each iteration the algorithm tries to improvethe parameter vector @math{p_i} corresponding to the highestfunction value by simple geometrical transformations. Theseare reflection, reflection followed by expansion, contraction and multiplecontraction. Using these transformations the simplex moves through the parameter space towards the minimum, where it contracts itself. After each iteration, the best vertex is returned. Note, that due tothe nature of the algorithm not every step improves the currentbest parameter vector. Usually several iterations are required.The minimizer-specific characteristic size is calculated as theaverage distance from the geometrical center of the simplex to all itsvertices. This size can be used as a stopping criteria, as thesimplex contracts itself near the minimum. The size is returned by thefunction @code{gsl_multimin_fminimizer_size}.The @code{nmsimplex2} version of this minimiser is a new @math{O(N)}implementation of the earlier @math{O(N^2)} @code{nmsimplex}minimiser. It calculates the size of simplex as the @sc{rms} distanceof each vertex from the center rather than the mean distance, whichhas the advantage of allowing a linear update.@end deffn@node Multimin Examples@section ExamplesThis example program finds the minimum of the paraboloid functiondefined earlier. The location of the minimum is offset from the originin @math{x} and @math{y}, and the function value at the minimum isnon-zero. The main program is given below, it requires the examplefunction given earlier in this chapter.@smallexample@verbatiminclude examples/multimin.c@end smallexample @noindentThe initial step-size is chosen as 0.01, a conservative estimate in thiscase, and the line minimization parameter is set at 0.0001. The programterminates when the norm of the gradient has been reduced below0.001. The output of the program is shown below,@example@verbatiminclude examples/multimin.out@end example@noindentNote that the algorithm gradually increases the step size as itsuccessfully moves downhill, as can be seen by plotting the successivepoints.@iftex@sp 1@center @image{multimin,3.4in}@end iftex@noindentThe conjugate gradient algorithm finds the minimum on its seconddirection because the function is purely quadratic. Additionaliterations would be needed for a more complicated function.Here is another example using the Nelder-Mead Simplex algorithm tominimize the same example object function, as above.@smallexample@verbatiminclude examples/nmsimplex.c@end smallexample@noindentThe minimum search stops when the Simplex size drops to 0.01. The output isshown below.@example@verbatiminclude examples/nmsimplex.out@end example@noindentThe simplex size first increases, while the simplex moves towards theminimum. After a while the size begins to decrease as the simplexcontracts around the minimum.@node Multimin References and Further Reading@section References and Further ReadingThe conjugate gradient and BFGS methods are described in detail in thefollowing book,@itemize @asis@item R. Fletcher,@cite{Practical Methods of Optimization (Second Edition)} Wiley(1987), ISBN 0471915475.@end itemizeA brief description of multidimensional minimization algorithms andmore recent references can be found in,@itemize @asis@item C.W. Ueberhuber,@cite{Numerical Computation (Volume 2)}, Chapter 14, Section 4.4``Minimization Methods'', p.@: 325--335, Springer (1997), ISBN3-540-62057-5.@end itemize@noindentThe simplex algorithm is described in the following paper, @itemize @asis@item J.A. Nelder and R. Mead,@cite{A simplex method for function minimization}, Computer Journalvol.@: 7 (1965), 308--315.@end itemize@noindent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -