You are on page 1of 16

3/22/2021

Computational Science:
Computational Methods in Engineering

Golden Section Search

Outline

• Description of the Method
• Method Summary
• Derivation of the Golden Ratio 𝑅

1
3/22/2021

Description of the 
Method
3

Define Starting Interval

Choose a lower bound 
𝑥 and an upper 
bound 𝑥 that span a 
single maximum.

𝑥 𝑥 𝑥
𝑥 𝑥

2
3/22/2021

Evaluate the Function at the Bounds

𝑓 𝑓 𝑥

𝑓 𝑓 𝑥 𝑓
𝑥 𝑥 𝑥 𝑓
𝑥 𝑥

Calculate Two Very Special Intermediate Points
Calculate the Golden ratio 𝑅.
5 1
R  0.6180...
2

Calculate distance 𝑑.
d  R  xU  xL 
𝑓 𝑑
𝑑
𝑓
𝑥 𝑥

3
3/22/2021

Calculate Two Very Special Intermediate Points
Calculate the Golden ratio 𝑅.
5 1
R  0.6180...
2

Calculate distance 𝑑.
d  R  xU  xL 
𝑓 𝑑
𝑑
Calculate special intermediate  𝑓
points 𝑥 and 𝑥 . 𝑥 𝑥 𝑥 𝑥
x1  xU  d
x2  xL  d

Evaluate the Function at the Intermediate Points

𝑓 𝑓 𝑥

𝑓 𝑓 𝑥 𝑓

𝑓
𝑥 𝑥 𝑥 𝑥

4
3/22/2021

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓

𝑓
Is 𝑓 𝑓 ?   Max to Right

𝑓
𝑥 𝑥 𝑥 𝑥

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓

𝑓
Is 𝑓 𝑓 ?   Max to Right

𝑓
𝑥 𝑥 𝑥 𝑥

10

5
3/22/2021

Adjust Points to Close in on Maximum

Old intermediate point 𝑥
𝑓
becomes new lower bound 𝑥 .
𝑓
xL  x1 f L  f1

Old intermediate point 𝑥
becomes new intermediate 
point 𝑥 . 𝑥 ?
𝑓
x1  x2 f1  f 2
𝑥 𝑥 𝑥

Upper bound 𝑥 remains the 
same.

11

Calculate New Intermediate Point

Calculate distance 𝑑. 𝑓
d  R  xU  xL  𝑓

Calculate new 
intermediate point 𝑥 .
x2  xL  d 𝑑
𝑓
𝑥 𝑥 𝑥 𝑥

12

6
3/22/2021

Evaluate Function at New Intermediate Point

𝑓 𝑓
𝑓 𝑓 𝑥
𝑓

Observe that the entire 
iteration only involved 
𝑓
calculating one new point 
and one new evaluation  𝑥 𝑥 𝑥 𝑥
of the function.

13

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓 𝑓


𝑓
Is 𝑓 𝑓 ?   Max to Right

𝑓
𝑥 𝑥 𝑥 𝑥

14

7
3/22/2021

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓 𝑓


𝑓
Is 𝑓 𝑓 ?   Max to Right

𝑓
𝑥 𝑥 𝑥 𝑥

15

Adjust Points to Close in on Maximum

Old intermediate point 𝑥
𝑓 𝑓
becomes new upper bound 𝑥 .
𝑓
xU  x2 fU  f2

Old intermediate point 𝑥
becomes new intermediate  𝑥 ?
point 𝑥 .
x2  x1 f 2  f1
𝑥 𝑥 𝑥

Lower bound 𝑥 remains the 
same.

16

8
3/22/2021

Calculate New Intermediate Point

Calculate distance 𝑑. 𝑓 𝑓
d  R  xU  xL  𝑓

Calculate new 
intermediate point 𝑥 .
x1  xU  d 𝑑

𝑥 𝑥 𝑥 𝑥

17

Evaluate Function at New Intermediate Point

𝑓 𝑓 𝑓
𝑓 𝑓 𝑥
𝑓

Observe that the entire 
iteration only involved 
calculating one new point 
and one new evaluation  𝑥 𝑥 𝑥 𝑥
of the function.

18

9
3/22/2021

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓 𝑓 𝑓


𝑓
Is 𝑓 𝑓 ?   Max to Right

𝑥 𝑥 𝑥 𝑥

19

Determine Position of the Maximum

Is 𝑓 𝑓 ?   Max to Left 𝑓 𝑓 𝑓


𝑓
Is 𝑓 𝑓 ?   Max to Right

…and so on.
𝑥 𝑥 𝑥 𝑥

20

10
3/22/2021

Repeat Until Convergence

Converged if:
xU  xL
2  tolerance
xU  xL

21

Calculate Final Answer
Estimate the final maximum to be at the midpoint of the last interval.

xU  xL
xe  f e  f  xe 
2

22

11
3/22/2021

Method Summary

23

Block Diagram of Golden Section Search to Find a 
Maximum
Define Starting Bounds
yes Calculate
𝑥 𝑥 𝑥 xU  xL
2  tolerance ? Final Answer
xU  xL
xU  xL
Evaluate Function at Bounds xe 
no 2
𝑓 𝑓 𝑥 and   𝑓 𝑓 𝑥 Adjust Points for Max on Left f e  f  xe 
xU  x2 fU  f2
yes
f1  f 2 ?
x2  x1 f 2  f1
Calculate Two Intermediate Points
x1  xU  R  xU  xL  f1  f  x1  no
x1  xU  d d  R  xU  xL 
x2  xL  d R  5 1 2 Adjust Points for Max on Right
yes
Calculate
xL  x1 f L  f1 Final Answer
f1  f 2 ?
x1  x2 f1  f 2 x1  x2
Evaluate Function at Intermediate Points x2  xL  R  xU  xL  f 2  f  x2  no
xe 
2
𝑓 𝑓 𝑥 and   𝑓 𝑓 𝑥 no yes f1  f 2
f1  f 2 ? fe 
2
unusual 24

12
3/22/2021

Block Diagram of Golden Section Search to Find a 
Minimum
Define Starting Bounds
yes Calculate
𝑥 𝑥 𝑥 xU  xL
2  tolerance ? Final Answer
xU  xL
xU  xL
Evaluate Function at Bounds xe 
no 2
𝑓 𝑓 𝑥 and   𝑓 𝑓 𝑥 Adjust Points for Min on Left f e  f  xe 
xU  x2 fU  f2
yes
f1  f 2 ?
x2  x1 f 2  f1
Calculate Two Intermediate Points
x1  xU  R  xU  xL  f1  f  x1  no
x1  xU  d d  R  xU  xL 
x2  xL  d R  5 1 2 Adjust Points for Min on Right
yes
Calculate
xL  x1 f L  f1 Final Answer
f1  f 2 ?
x1  x2 f1  f 2 x1  x2
Evaluate Function at Intermediate Points x2  xL  R  xU  xL  f 2  f  x2  no
xe 
2
𝑓 𝑓 𝑥 and   𝑓 𝑓 𝑥 no yes f1  f 2
f1  f 2 ? fe 
2
unusual 25

Animation of the Method

26

13
3/22/2021

The Magic of the Golden‐Section Search

Iteration 𝑖

Three of the four points line up from 
one iteration to the next.  This means 
the function only has to be evaluated at 
one new point each iteration.

Iteration 𝑖 1
The interval is reduced 
by 38.2% each iteration.
27

Derivation of the 
Golden Ratio 

28

14
3/22/2021

Derivation of Golden Ratio (1 of 3)
From this picture, define three length parameters ℓ , ℓ and ℓ as
 0  xU  xL
xL x1 x2 xU 1  x2  xL
1 2
 2  xU  x2
0

Recognizing that the points of the next iteration should lie on top of 
points from the previous iteration, define two conditions to ensure this.
 0  1   2 Condition 1 – ensures ℓ ℓ covers entire span.
xL x1 x2 xU
1 2
1  2
 Condition 2 – ensures the next iteration has the 
same proportional spacing as the current iteration. 0
 0 1 29

Derivation of Golden Ratio (2 of 3)
 0  1   2 Condition 1 – ensures ℓ ℓ covers entire span.

1  2 Condition 2 – ensures the next iteration has the 
 same proportional spacing as the current iteration.
 0 1
xL x1 x2 xU
Substitute Condition 1 into Condition 2 to eliminate ℓ .
1 2
1 
 2
0 1   2 1
0

Define the Golden ratio as 𝑅 ℓ ⁄ℓ .

1  1   2 1  2 1 1
 2    1   1 R   R2  R 1  0
1   2 1 1 2 1  2 R
invert equation expand left side Substitute 𝑅 ℓ ⁄ℓ Simplify
30

15
3/22/2021

Derivation of Golden Ratio (3 of 3)
 0  1   2 Condition 1 – ensures ℓ ℓ covers entire span.

1  2 Condition 2 – ensures the next iteration has the 
 same proportional spacing as the current iteration.
 0 1
xL x1 x2 xU
Recall the quadratic formula.
1 2
b  b 2  4ac
0
ax 2  bx  c  0  x
0 2a

Solve for 𝑅 using the quadratic formula.

1  12  4 1 1 1  5
R  R 1  0
2
 R 
2 1 2

5 1
Pick the positive root to keep R positive. R  0.618033988749895...
2
31

16

You might also like