You are on page 1of 5

S EC . 8.

1 M INIMIZATION OF A F UNCTION OF O NE VARIABLE 409

The Golden Ratio Search

Bracketing Search Methods


Another approach for finding the minimum of f (x) in a given interval is to evaluate
the function many times and search for a local minimum. To reduce the number of
function evaluations it is important to have a good strategy for determining where f (x)
is to be evaluated. Two efficient bracketing methods are the golden ratio and fibonacci
searches. To use either bracketing method for finding the minimum of f (x), a special
condition must be met to ensure that there is a proper minimum in the given interval.

Definition 8.3. The function f (x) is unimodal on I = [a, b], if there exists a unique
number p ∈ I such that
(1) f (x) is decreasing on [a, p]
(2) f (x) is increasing on [ p, b] 

Golden Ratio Search


If f (x) is known to be unimodal on [a, b], then it is possible to replace the interval
with a subinterval on which f (x) takes on its minimum value. One approach is to
select two interior points c < d. This results in a < c < d < b. The condition
410 C HAP. 8 N UMERICAL O PTIMIZATION

y = f (x) y = f(x)

p p

a c d b a c d b
, ,
. .
Figure 8.2 The decision process for the golden ratio search.

0 1−r r 1 0 1−r r 1

r2 1 − r2

0 1−r r 1−r r 1

Squeeze from the right and Squeeze from the left and
the new interval is [0, r]. the new interval is [1 − r, 1].

Figure 8.3 The intervals involved in the golden ratio search.

that f (x) is unimodal guarantees that the function values f (c) and f (d) are less than
max{ f (a), f (b)}. We have two cases to consider (see Figure 8.2).
If f (c) ≤ f (d), the minimum must occur in the subinterval [a, d], and we replace
b with d and continue the search in the new subinterval [a, d]. If f (d) < f (c), the
minimum must occur in [c, b], and we replace a with c and continue the search in [c, b]
The interior points c and d are selected so that the resulting intervals [a, c] and
[d, b] are symmetrical; that is, b − d = c − a, where

(3) c = a + (1 − r )(b − a) = ra + (1 − r )b,


(4) d = b − (1 − r )(b − a) = (1 − r )a + r b,

and 1/2 < r < 1 (to preserve the ordering c < d).
We want the value of r to remain constant on each subinterval. Additionally, one of
the old interior points will be used as an interior point of the new subinterval, while the
other interior point will become an endpoint of the new subinterval (see Figure 8.3).
Thus, on each iteration only one new point will have to be found and only one new
function evaluation will have to be made. If f (c) ≤ f (d) and only one new function
S EC . 8.1 M INIMIZATION OF A F UNCTION OF O NE VARIABLE 411

evaluation is to be made, then we must have


d −a c−a
=
b−a d −a
r (b − a) (1 − r )(b − a)
=
b−a r (b − a)
r 1−r
=
1 r
r2 + r − 1 = 0

−1 ± 5
r= .
2

Thus r √= (−1 + 5)/2 (the golden ratio). Similarly, if f (d) < f (c), then r =
(−1 + 5)/2.
The next example compares the root-finding method with the golden search method.

Example 8.2. Find the minimum of the unimodal function f (x) = x 2 − sin(x) on the
interval [0, 1].
Solution by solving f  (x) = 0. A root-finding method can be used to determine
where the derivative f  (x) = 2x − cos(x) is zero. Since f  (0) = −1 < 0 and f  (1) =
1.4596977 > 0, then by the intermediate value theorem a root of f  (x) lies in the interval
[0, 1]. The results of using the secant method with the initial values p0 = 0 and p1 = 1 are
given in Table 8.1.
The conclusion from applying the secant method is that f  (0.4501836) = 0. The sec-
ond derivative is f  (x) = 2 + sin(x) and we compute f  (0.4501836) = 2.435131 >
0. Hence, by Theorem 8.4 (second derivative test), the minimum is f (0.4501836) =
−0.2324656.
Solution using the golden search. Let a0 = 0 and b0 = 1. Formulas (3) and (4) yield
√ √
−1 + 5 3− 5
c0 = 0 + 1 − (1 − 0) = ≈ 0.38919660,
2 2
√ √
−1 + 5 −1 + 5
d0 = 1 − 1 − (1 − 0) = ≈ 0.6180340.
2 2

We calculate f (c0 ) = −0.22684748 and f (d0 ) = −0.19746793. Since f (c0 ) < f (d0 ),
the new subinterval is [a0 , d0 ] = [0.00000000, 0.6180340]. We let a1 = a0 , b1 = d0 ,
d1 = c0 and use formula (3) to find c1 :

c1 = a1 + (1 − r )(b1 − a1 )

−1 + 5
=0+ 1− (0.6180340 − 0)
2
≈ 0.2360680.
412 C HAP. 8 N UMERICAL O PTIMIZATION

Table 8.1 Secant Method for


Solving f  (x) = 2x − cos(x) = 0

k pk 2 pk − cos( pk )
0 0.0000000 −1.00000000
1 1.0000000 1.45969769
2 0.4065540 −0.10538092
3 0.4465123 −0.00893398
4 0.4502137 0.00007329
5 0.4501836 −0.00000005

Table 8.2 Golden Search for the Minimum of f (x) = x 2 − sin(x)

k ak ck dk bk f (ck ) f (dk )
0 0.0000000 0.3819660 0.6180340 1 −0.22684748 −0.19746793
1 0.0000000 0.2360680 0.3819660 0.6180340 −0.17815339 −0.22684748
2 0.2360680 0.3819660 0.4721360 0.6180340 −0.22684748 −0.23187724
3 0.3819660 0.4721360 0.5278640 0.6180340 −0.23187724 −0.22504882
4 0.3819660 0.4376941 0.4721360 0.5278640 −0.23227594 −0.23187724
5 0.3819660 0.4164079 0.4376941 0.4721360 −0.23108238 −0.23227594
6 0.4164079 0.4376941 0.4508497 0.4721360 −0.23227594 −0.23246503
.. .. .. .. .. .. ..
. . . . . . .
21 0.4501574 0.4501730 0.4501827 0.4501983 −0.23246558 −0.23246558
22 0.4501730 0.4501827 0.4501886 0.4501983 −0.23246558 −0.23246558
23 0.4501827 0.4501886 0.4501923 0.4501983 −0.23246558 −0.23246558

Now compute and compare f (c1 ) and f (d1 ) to determine the new subinterval and continue
the iteration process. Some of the computations are shown in Table 8.2.
At the twenty-third iteration the interval has been narrowed down to [a23 , b23 ] =
[0.4501827, 0.4501983]. This interval has width 0.0000156. However, the computed func-
tion values at the endpoints agree to eight decimal places (i.e., f (a23 ) ≈ −0.23246558 ≈
f (b23 ); hence the algorithm is terminated. A problem in using search methods is that the
function may be flat near the minimum, and this limits the accuracy that can be obtained.
The secant method was able to find the more accurate answer p5 = 0.4501836.
Although the golden ratio search is slower in this example, it has the desirable feature
that it can be applied in cases where f (x) is not differentiable. 
Numerical Methods Using Matlab, 4th Edition, 2004
John H. Mathews and Kurtis K. Fink
ISBN: 0-13-065248-2

Prentice-Hall Inc.
Upper Saddle River, New Jersey, USA
http://vig.prenhall.com/

You might also like