Chapter 5 One Dimensional Search MEF
Chapter 5
Chapter 5
One Dimensional Search
1
Chapter 5
2
Unidimensional Search
Chapter 5
(1) If have a search direction, want to minimize in that
direction by numerical methods
(2) Search Methods in General
2.1. Non Sequential – Simultaneous evaluation of f at n
points – no good (unless on parallel computer).
2.2. Sequential – One evaluation follows the other.
3
Chapter 5
(3) Types of search that are better or best is often
problem dependent. Some of the types are:
a. Newton, Quasi-Newton, and Secant methods.
b. Region Elimination Methods (Fibonacci, Golden
Section, etc.).
c. Polynomial Approximation (Quadratic Interpolation,
etc.).
d. Random Search
(4) Most methods assume
(a) a unimodal function, (b) that the min is
bracketed at the start and (c) also you start in a
direction that reduces f.
4
Chapter 5
To Bracket the Minimum
1. Compute f ( x( 0) ) and f ( x0 x)
If f ( x( 0) x) f ( x( 0) ), let xNEW xOLD
If f ( x( 0) x) f ( x( 0) ), let xNEW 2xOLD
2. Compute f ( x(1) ) f ( x( 0) xNEW )
Continue doubling x until f ( x( 0) x( k ) ) f ( x( 0) x( k 51) )
3. Compute f ( x( k 1) x( k 2) )
Chapter 5
1
(2 )
2
You now have 4 equally spaced points x(3) , x , x( 2) , x(1) .
Discard the point that enables you to keep a bracket
on the point giving the minimum f(x) (using the
closest points)
6
Chapter 5
7
1. Newton’s Method
Newton’s method for an equation is
Chapter 5
f ( x) f ( x0 ) f ( x0 )( x x0 ) 0
f ( x0 )
( x x0 )
f ( x0 )
or
f ( x0 )
x x0
f ( x0 )
Application to Minimization
The necessary condition for f(x) to have a local minimum
is f (x) = 0. Apply Newton’s method.
x( k 1)
(k)
f (x )
(k)
x
(k)
f (x )
8
Examples
Minimize
f ( x) a 0 a1 x a 2 x2
Chapter 5
f ( x) a1 2a 2 x
f ( x) 2a 2
x
(1)
x
a 1 2 a 2 x( 0 )
a1
a1
(0)
(0)
x (
x )
2a 2
2a 2
2a 2
(0)
Minimize
f ( x) x4 x2 1
f ( x) 4 x3 2 x
f ( x) 12 x2 2
x
(1)
x
(0)
Start at x
3 x4 2 x
12 x2 2
(0)
Continue
3 2
1, x 1
0.100
12 2
(1)
9
Advantages of Newton’s Method
Chapter 5
(1) Locally quadratically convergent (as long as f (x) is
positive – for a minimum).
(2) For a quadratic function, get min in one step.
Disadvantages
(1) Need to calculate both f (x) and f (x)
(2) If f (x)→0, method converges slowly
(3) If function has multiple extrema, may not converge
to global optimum.
10
2. Finite-Difference Newton Method
Replace derivatives with finite differences
Chapter 5
x( k 1)
f ( x h) f ( x)
h
x( k )
f ( x h) 2 f ( x) f ( x h)
h2
Disadvantage
Now need additional function evals (3 here vs. 2 for Newton)
11
3. Secant(Quasi-Newton) Method
f ( x( k ) ) m( x x( k ) ) 0
Chapter 5
Analogous equation to (A) is
( B)
The secant approximates f (x) as a straight line
f ( x ( q ) ) f ( x ( p ) )
m
x(q ) x( p )
(k)
f
(
x
)
( k 1)
(k)
x
x
f ( x ( q ) ) f ( x ( p ) )
12
x(q ) x( p )
Start the Secant method by using 2 points spanning x at
which first derivatives are of opposite sign.
Chapter 5
For next stage, retain either x(q) or x(p) so that the pair of
derivatives still have opposite sign.
13
Order of Convergence
Can be expressed in various ways. Want to consider how
Chapter 5
x
(k)
x as k
*
Linea r
x
( k 1)
x
(k)
x
*
x
*
c
0 c 1
usually slow in practice
14
Order P
x
( k 1)
Chapter 5
x
(k)
x
*
x
* p
c
c0
p 1
Fastest in practice
If p = 2, quadratic convergence
p = 1.32 ?
Superlinear
x
( k 1)
lim
k
x
(k)
x
*
x
*
0
(r ck a nd ck 0 a s k )
Usually fast in practice
Some methods can show theoretically what
the order is.
15
Chapter 5
16
Chapter 5
17
Chapter 5
18
Chapter 5
19
Chapter 5
20
Chapter 5
Quadratic Interpolation
Approximate f(x) by a quadratic function.
Use 3 points
f ( x) a bx cx 2
Minimize : f ( x) 0 b 2cx so x*
b
2c
Evaluate f(x) at the 3 points f(x1 ), f ( x2 ), f ( x3 )
Solve 3 simultaneo us equations for a, b, c
f ( x1 ) a bx1 cx12
f ( x2 ) a bx2 cx22
f ( x3 ) a bx3 cx
2
3
21
Chapter 5
b
1
1
1
f ( x1 )
x12
f ( x2 )
x
f ( x3 )
2
2
2
3
x
1 x1
1 x2
1 x3
2
1
2
2
2
3
x
x
x
c
1 x1
1 x2
1 x3
1 x1
1 x2
1 x3
f ( x1 )
f ( x2 )
f ( x3 )
x12
x22
x32
(or use Gaussian elimination)
22
b 1 f ( x2 ) x32 f ( x3 ) x22 1 f ( x1 ) x32 f ( x3 ) x12
Chapter 5
1 f ( x1 ) x22 f ( x2 ) x12 :
Numerator
c f ( x1 ) x32 x22 f ( x2 ) x32 x12 f ( x3 ) ( x22 x12 )
f ( x1 )( x22 x32 ) f ( x2 )( x32 x12 ) f ( x3 )( x x22 ) :
Denominator
b
x*
2c
23
Chapter 5
24
Chapter 5
25
Chapter 5
26
Chapter 5
27
Chapter 5
28
Chapter 5
29
Chapter 5
30
Chapter 5
One Dimensional Search
1
Chapter 5
2
Unidimensional Search
Chapter 5
(1) If have a search direction, want to minimize in that
direction by numerical methods
(2) Search Methods in General
2.1. Non Sequential – Simultaneous evaluation of f at n
points – no good (unless on parallel computer).
2.2. Sequential – One evaluation follows the other.
3
Chapter 5
(3) Types of search that are better or best is often
problem dependent. Some of the types are:
a. Newton, Quasi-Newton, and Secant methods.
b. Region Elimination Methods (Fibonacci, Golden
Section, etc.).
c. Polynomial Approximation (Quadratic Interpolation,
etc.).
d. Random Search
(4) Most methods assume
(a) a unimodal function, (b) that the min is
bracketed at the start and (c) also you start in a
direction that reduces f.
4
Chapter 5
To Bracket the Minimum
1. Compute f ( x( 0) ) and f ( x0 x)
If f ( x( 0) x) f ( x( 0) ), let xNEW xOLD
If f ( x( 0) x) f ( x( 0) ), let xNEW 2xOLD
2. Compute f ( x(1) ) f ( x( 0) xNEW )
Continue doubling x until f ( x( 0) x( k ) ) f ( x( 0) x( k 51) )
3. Compute f ( x( k 1) x( k 2) )
Chapter 5
1
(2 )
2
You now have 4 equally spaced points x(3) , x , x( 2) , x(1) .
Discard the point that enables you to keep a bracket
on the point giving the minimum f(x) (using the
closest points)
6
Chapter 5
7
1. Newton’s Method
Newton’s method for an equation is
Chapter 5
f ( x) f ( x0 ) f ( x0 )( x x0 ) 0
f ( x0 )
( x x0 )
f ( x0 )
or
f ( x0 )
x x0
f ( x0 )
Application to Minimization
The necessary condition for f(x) to have a local minimum
is f (x) = 0. Apply Newton’s method.
x( k 1)
(k)
f (x )
(k)
x
(k)
f (x )
8
Examples
Minimize
f ( x) a 0 a1 x a 2 x2
Chapter 5
f ( x) a1 2a 2 x
f ( x) 2a 2
x
(1)
x
a 1 2 a 2 x( 0 )
a1
a1
(0)
(0)
x (
x )
2a 2
2a 2
2a 2
(0)
Minimize
f ( x) x4 x2 1
f ( x) 4 x3 2 x
f ( x) 12 x2 2
x
(1)
x
(0)
Start at x
3 x4 2 x
12 x2 2
(0)
Continue
3 2
1, x 1
0.100
12 2
(1)
9
Advantages of Newton’s Method
Chapter 5
(1) Locally quadratically convergent (as long as f (x) is
positive – for a minimum).
(2) For a quadratic function, get min in one step.
Disadvantages
(1) Need to calculate both f (x) and f (x)
(2) If f (x)→0, method converges slowly
(3) If function has multiple extrema, may not converge
to global optimum.
10
2. Finite-Difference Newton Method
Replace derivatives with finite differences
Chapter 5
x( k 1)
f ( x h) f ( x)
h
x( k )
f ( x h) 2 f ( x) f ( x h)
h2
Disadvantage
Now need additional function evals (3 here vs. 2 for Newton)
11
3. Secant(Quasi-Newton) Method
f ( x( k ) ) m( x x( k ) ) 0
Chapter 5
Analogous equation to (A) is
( B)
The secant approximates f (x) as a straight line
f ( x ( q ) ) f ( x ( p ) )
m
x(q ) x( p )
(k)
f
(
x
)
( k 1)
(k)
x
x
f ( x ( q ) ) f ( x ( p ) )
12
x(q ) x( p )
Start the Secant method by using 2 points spanning x at
which first derivatives are of opposite sign.
Chapter 5
For next stage, retain either x(q) or x(p) so that the pair of
derivatives still have opposite sign.
13
Order of Convergence
Can be expressed in various ways. Want to consider how
Chapter 5
x
(k)
x as k
*
Linea r
x
( k 1)
x
(k)
x
*
x
*
c
0 c 1
usually slow in practice
14
Order P
x
( k 1)
Chapter 5
x
(k)
x
*
x
* p
c
c0
p 1
Fastest in practice
If p = 2, quadratic convergence
p = 1.32 ?
Superlinear
x
( k 1)
lim
k
x
(k)
x
*
x
*
0
(r ck a nd ck 0 a s k )
Usually fast in practice
Some methods can show theoretically what
the order is.
15
Chapter 5
16
Chapter 5
17
Chapter 5
18
Chapter 5
19
Chapter 5
20
Chapter 5
Quadratic Interpolation
Approximate f(x) by a quadratic function.
Use 3 points
f ( x) a bx cx 2
Minimize : f ( x) 0 b 2cx so x*
b
2c
Evaluate f(x) at the 3 points f(x1 ), f ( x2 ), f ( x3 )
Solve 3 simultaneo us equations for a, b, c
f ( x1 ) a bx1 cx12
f ( x2 ) a bx2 cx22
f ( x3 ) a bx3 cx
2
3
21
Chapter 5
b
1
1
1
f ( x1 )
x12
f ( x2 )
x
f ( x3 )
2
2
2
3
x
1 x1
1 x2
1 x3
2
1
2
2
2
3
x
x
x
c
1 x1
1 x2
1 x3
1 x1
1 x2
1 x3
f ( x1 )
f ( x2 )
f ( x3 )
x12
x22
x32
(or use Gaussian elimination)
22
b 1 f ( x2 ) x32 f ( x3 ) x22 1 f ( x1 ) x32 f ( x3 ) x12
Chapter 5
1 f ( x1 ) x22 f ( x2 ) x12 :
Numerator
c f ( x1 ) x32 x22 f ( x2 ) x32 x12 f ( x3 ) ( x22 x12 )
f ( x1 )( x22 x32 ) f ( x2 )( x32 x12 ) f ( x3 )( x x22 ) :
Denominator
b
x*
2c
23
Chapter 5
24
Chapter 5
25
Chapter 5
26
Chapter 5
27
Chapter 5
28
Chapter 5
29
Chapter 5
30