4

Click here to load reader

Golden Section Search - Wikipedia

Embed Size (px)

Citation preview

Page 1: Golden Section Search - Wikipedia

2/29/12 Golden section search - Wikipedia, the free encyclopedia

1/4en.wikipedia.org/wiki/Golden_section_search

Diagram of a golden section search

Golden section searchFrom Wikipedia, the free encyclopedia

The golden section search is a technique for findingthe extremum (minimum or maximum) of a unimodalfunction by successively narrowing the range ofvalues inside which the extremum is known to exist.The technique derives its name from the fact that thealgorithm maintains the function values for triples ofpoints whose distances form a golden ratio. Thealgorithm is closely related to a Fibonacci search(also described below) and to a binary search.Fibonacci search and Golden section search wereintroduced by Kiefer (1953). (see also Avriel andWilde (1966)).

Contents

1 Basic idea2 Probe point selection3 Termination condition4 Recursive algorithm5 Fibonacci search6 See also7 References

Basic idea

The diagram above illustrates a single step in the technique for finding a minimum. The functional values off(x) are on the vertical axis, and the horizontal axis is the x parameter. The value of f(x) has already beenevaluated at the three points: x1, x2, and x3. Since f2 is smaller than either f1 or f3, it is clear that a minimumlies inside the interval from x1 to x3 (since f is unimodal).

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 thenew triplet of points will be x1, x2, and x4. However if the function yields the value f4b then a minimum liesbetween x2 and x3, and the new triplet of points will be x2, x4, and x3. Thus, in either case, we can constructa new narrower search interval that is guaranteed to contain the function's minimum.

Page 2: Golden Section Search - Wikipedia

2/29/12 Golden section search - Wikipedia, the free encyclopedia

2/4en.wikipedia.org/wiki/Golden_section_search

Probe point selection

From the diagram above, it is seen that the new search interval will be either between x1 and x4 with a lengthof a+c , or between x2 and x3 with a length of b . The golden section search requires that these intervals beequal. If they are not, a run of "bad luck" could lead to the wider interval being used many times, thusslowing down the rate of convergence. To ensure that b = a+c, the algorithm should choosex4 = x1 + (x3 − x2).

However there still remains the question of where x2 should be placed in relation to x1 and x3. The goldensection search chooses the spacing between these points in such a way that these points have the sameproportion of spacing as the subsequent triple x1,x2,x4 or x2,x4,x3. By maintaining the same proportion ofspacing throughout the algorithm, we avoid a situation in which x2 is very close to x1 or x3, and guaranteethat 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 thatevaluation, 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 searchalgorithm gets its name.

Termination condition

Page 3: Golden Section Search - Wikipedia

2/29/12 Golden section search - Wikipedia, the free encyclopedia

3/4en.wikipedia.org/wiki/Golden_section_search

In addition to a routine for reducing the size of the bracketing of the solution, a complete algorithm must havea termination condition. The one provided in the book Numerical Recipes in C is based on testing the gapsamong x1, x2, x3 and x4, 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 based onthe bracket size relative to its central value, because that relative error in x is approximately proportional to thesquared absolute error in f(x) in typical cases. For that same reason, the Numerical Recipes text recommendsthat where is the required absolute precision of f(x).

Recursive algorithm

double phi = (1 + Math.sqrt(5)) / 2;double resphi = 2 ­ phi; // a and c are the current bounds; the minimum is between them.// b is a center point// f(x) is some mathematical function elsewhere defined// a corresponds to x1; b corresponds to x2; c corresponds to x3// x corresponds to x4 public double goldenSectionSearch(double a, double b, double c, double double x; if (c ­ b > b ­ a) x = b + resphi * (c ­ b); else x = b ­ resphi * (b ­ a); if (Math.abs(c ­ a) < tau * (Math.abs(b) + Math.abs(x))) return (c + a) / 2; if (f(x) < f(b)) if (c ­ b > b ­ a) return goldenSectionSearch(b, x, c, tau); else return goldenSectionSearch(a, x, b, tau); else if (c ­ b > b ­ a) return goldenSectionSearch(a, b, x, tau); else return goldenSectionSearch(x, b, c, tau);

To realise the advantage of golden section search, the function f(x) would be implemented with caching, sothat in all invocations of goldenSectionSearch(..) above, except the first, f(x2) would have already been

Page 4: Golden Section Search - Wikipedia

2/29/12 Golden section search - Wikipedia, the free encyclopedia

4/4en.wikipedia.org/wiki/Golden_section_search

evaluated previously — the result of the calculation will be re­used, bypassing the (perhaps expensive)explicit evaluation of the function. Together with a slightly smaller number of recursions, this 50% saving inthe number of calls to f(x) is the main algorithmic advantage over Ternary search.

Fibonacci search

A very similar algorithm can also be used to find the extremum (minimum or maximum) of a sequence ofvalues that has a single local minimum or local maximum. In order to approximate the probe positions ofgolden section search while probing only integer sequence indices, the variant of the algorithm for this casetypically maintains a bracketing of the solution in which the length of the bracketed interval is a Fibonaccinumber. For this reason, the sequence variant of golden section search is often called Fibonacci search.

See also

Fibonacci search techniqueBrent's method

References

Kiefer, J. (1953), "Sequential minimax search for a maximum", Proceedings of the AmericanMathematical Society 4 (3): 502–506, doi:10.2307/2032161(http://dx.doi.org/10.2307%2F2032161) , JSTOR 2032161 (http://www.jstor.org/stable/2032161) ,MR0055639 (http://www.ams.org/mathscinet­getitem?mr=0055639)Avriel, Mordecai; Wilde, Douglass J. (1966), "Optimality proof for the symmetric Fibonacci searchtechnique", Fibonacci Quarterly 4: 265–269, MR0208812 (http://www.ams.org/mathscinet­getitem?mr=0208812)

Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), "Section 10.2. Golden SectionSearch in One Dimension" (http://apps.nrbook.com/empanel/index.html#pg=492) , NumericalRecipes: The Art of Scientific Computing (3rd ed.), New York: Cambridge University Press,ISBN 978­0­521­88068­8, http://apps.nrbook.com/empanel/index.html#pg=492

Retrieved from "http://en.wikipedia.org/w/index.php?title=Golden_section_search&oldid=471142146"Categories: Golden ratio Fibonacci numbers Optimization algorithms and methods

This page was last modified on 13 January 2012 at 13:59.Text is available under the Creative Commons Attribution­ShareAlike License; additional terms mayapply. See Terms of use for details.Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non­profit organization.