Golden section search
From Wikipedia, the free encyclopedia
The golden section search is a technique for finding the extremum (minimum or maximum) of a unimodal function by successively narrowing the range of values inside which the extremum is known to exist. The technique derives its name from the fact that the algorithm maintains the function values for triples of points whose distances form a golden ratio. The algorithm is closely related to a Fibonacci search (also described below) and to a binary search.
The diagram on the right illustrates a single step in the technique for finding a minimum. The functional values of f(x) are on the vertical axis, and the horizontal axis is the x parameter. The value of f(x) has already been evaluated at the three points: x1, x2, and x3. Since f2 is smaller than either f1 or f3, it is clear that a minimum lies inside the interval from x1 to x3.
The next step in the minimization process is to "probe" the function by evaluating it at a new value of x, namely x4. It is most efficient to choose x4 somewhere inside the largest interval, i.e. between x2 and x3. From the diagram, it is clear that if the function yields f4a then a minimum lies between x1 and x4 and the new triplet of points will be x1, x2, and x4. However if the function yields the value f4b then a minimum lies between x2 and x3, and the new triplet of points will be x2, x4, and x3. Thus, in either case, we can construct a new narrower search interval that is guaranteed to contain the function's minimum.
Contents |
[edit] Probe point selection
From the diagram above, it is seen that the new search interval will be either between x1 and x4 with a length of a+c , or between x2 and x3 with a length of b . The golden section search requires that these intervals be equal. If they are not, a run of "bad luck" could lead to the wider interval being used many times, thus slowing down the rate of convergence. To ensure that b = a+c, the algorithm should choose x4 = x1 − x2 + x3.
However there still remains the question of where x2 should be placed in relation to x1 and x3. The golden section search chooses the spacing between these points in such a way that these points have the same proportion of spacing as the subsequent triple x1,x2,x4 or x2,x4,x3. By maintaining the same proportion of spacing throughout the algorithm, we avoid a situation in which x2 is very close to x1 or x3, and guarantee that the interval width shrinks by the same constant proportion in each step.
Mathematically, to ensure that the spacing after evaluating f(x4) is proportional to the spacing prior to that evaluation, if f(x4) is f4a and our new triplet of points is x1, x2, and x4 then we want:
However, if f(x4) is f4b and our new triplet of points is x2, x4, and x3 then we want:
Eliminating c from these two simultaneous equations yields:
or
where φ is the golden ratio:
The appearance of the golden ratio in the proportional spacing of the evaluation points is how this search algorithm gets its name.
[edit] Termination condition
In addition to a routine for reducing the size of the bracketing of the solution, a complete algorithm must have a termination condition. The one provided in the book Numerical Recipes in C is based on testing the gaps among x0, x1, x2 and x3, terminating when within the relative accuracy bounds:
where τ is a tolerance parameter of the algorithm and |x| is the absolute value of x. The check is relative to the size of x2 and x3 because the fraction (non-exponent) part of a floating point number is of fixed precision.
[edit] Fibonacci search
A very similar algorithm can also be used to find the extremum (minimum or maximum) of a sequence of values that has a single local minimum or local maximum. In order to approximate the probe positions of golden section search while probing only integer sequence indices, the variant of the algorithm for this case typically maintains a bracketing of the solution in which the length of the bracketed interval is a Fibonacci number. For this reason, the sequence variant of golden section search is often called Fibonacci search.
[edit] References
- Press, W.H., Teukolsky, S.A., Vetterling, W. T., and Flannery, B.P. (1999). Numerical Recipes in C, The Art of Scientific Computing, second edition, Cambridge University Press, Cambridge. ISBN 0-521-43108-5.