18-660: Numerical Methods for Engineering Design and Optimization

24
Slide 1 18-660: Numerical Methods for Engineering Design and Optimization Xin Li Department of ECE Carnegie Mellon University Pittsburgh, PA 15213

Transcript of 18-660: Numerical Methods for Engineering Design and Optimization

Page 1: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 1

18-660: Numerical Methods for Engineering Design and Optimization

Xin Li Department of ECE

Carnegie Mellon University Pittsburgh, PA 15213

Page 2: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 2

Overview

Unconstrained Optimization Golden section search Downhill simplex method

Page 3: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 3

Unconstrained Optimization

Linear regression with regularization

Unconstrained optimization: minimizing a cost function without any constraint Golden section search Downhill simplex method Gradient method Newton method

BA =α 1

2

2min αλαα

⋅+− BA

Non-derivative method (this lecture)

Rely on derivatives

Page 4: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 4

Golden Section Search

Problem definition: find the optimum x that minimizes a one-dimensional cost function f(x)

Key idea Assume that the optimum x is within an interval [a, b] Iteratively shrink [a, b] to find the solution x

( )xfx

min

x

f(x)

Similar (but not identical) to binary search

Page 5: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 5

Golden Section Search

It is not trivial to determine the interval that contains optimal solution x

x

f(x)

x

f(x)

Binary search: f(x) = 0 Golden section search: minimize f(x)

a

b c a b

c

Page 6: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 6

Golden Section Search

Require a triplet (a, b, c) to decide the appropriate interval Start from (a, b, c): f(c) < f(a) and f(c) < f(b) Add one extra point d

x

f(x)

a b

c d

Page 7: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 7

Golden Section Search

If f(c) has the smallest value, optimal solution is within [a, d]

x

f(x)

a b

c d

a

c b

Page 8: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 8

Golden Section Search

If f(d) has the smallest value, optimal solution is within [c, b]

x

f(x)

a b

c d

Continue iteration until (local) convergence is reached

a c

b

Page 9: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 9

Golden Section Search

Open question: how to decide the location of c and d?

Criterion: each iteration identically shrinks the interval We will explain its meaning soon

a b c d

w z 1−w−z

1

Page 10: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 10

Golden Section Search

Criterion: each iteration identically shrinks the interval Starting from [a, b], the next interval can be [a, d] or [c, b] The length of these two intervals should be identical

a b c d

w z 1−w−z = w

bcda −=−

1

( )zwzzw −−+=+ 1

zww −−=1

Page 11: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 11

Golden Section Search

Criterion: each iteration identically shrinks the interval Starting from [a, b], the next interval can be [a, d] or [c, b] The ratio of these two intervals is identical

a b c d

w z

1

w

wz

bddc

cadc

=−−

=−−

Page 12: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 12

Golden Section Search

Criterion: each iteration identically shrinks the interval Starting from [a, b], the next interval can be [a, d] or [c, b] The ratio of these three intervals should be identical

a b c d

w z

1

w

wz

bddc

cadc

=−−

=−−

wz

wzw

=+

wzw

bcca

+=

−−

Page 13: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 13

Golden Section Search

Criterion: each iteration identically shrinks the interval

a b c d

w z

1

w

wz

wzw

=+

12 =+ zw

382.0=w

Page 14: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 14

A Simple Example

Iteration #1

( ) [ ]1,12 −∈= xwherexxf

( )( )( )( ) 056.0236.0236.0

056.0236.0236.0111

111

==⋅−−==−−=⋅−+=

===−−=

fwbabdfwbaacfbfa

a (a)

b c (c)

d (b)

w⋅|a-b| z⋅|a-b| w⋅|a-b|

236.0236.01

−==

−=

cb

a

Page 15: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 15

A Simple Example

Iteration #2 ( )

( )( )( ) 279.0528.0528.0

056.0236.0236.0056.0236.0236.0

111

=−−=⋅−+==−−=

===−−=

fwbaadfcfbfa

a b (b)

d (a)

c (c)

236.0236.0528.0

−==−=

cb

a

( ) [ ]1,12 −∈= xwherexxf

w⋅|a-b| z⋅|a-b| w⋅|a-b|

Page 16: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 16

A Simple Example

Iteration #3 ( )

( )( )( ) 003.0056.0056.0

056.0236.0236.0056.0236.0236.0

279.0528.0528.0

=−−=⋅−−==−−=

===−−=

fwbabdfcfbfa

a b (b)

c (a)

d (c)

056.0236.0236.0

−==−=

cb

a

( ) [ ]1,12 −∈= xwherexxf

w⋅|a-b| z⋅|a-b| w⋅|a-b|

Page 17: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 17

Downhill Simplex Method

Golden section search is easy to implement However, it is typically used for one-dimensional problem only

Multi-dimensional optimization can also be solved by non-

derivative method

E.g., downhill simplex method

Key idea

Find the optimum X by a sequence of reflection, expansion and contraction of a simplex

( ) N

XRXwhereXf ∈min

Page 18: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 18

Downhill Simplex Method

In N-dimensional space, a simplex is defined by N+1 non-degenerate points

x1

x2

Three non-degenerate points define a simplex in 2-D space

x1

x2

Three degenerate points does NOT define a simplex in 2-D space

Page 19: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 19

Downhill Simplex Method

Construct initial simplex Start from an initial guess X0 ∈ RN

Apply perturbation in N orthogonal directions

{X0, X1, ..., XN} define a simplex

=

01

0

iE

ii EXX ⋅∆+= 0

Small perturbation

Unit vector

x1

x2

X0

X0+∆⋅E2

X0+∆⋅E1

i-th element

Page 20: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 20

Downhill Simplex Method

Apply reflection, expansion and contraction

x1

x2 Gradient

x1

x2 Gradient

Reflect away from large cost function value

Page 21: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 21

Downhill Simplex Method

Apply reflection, expansion and contraction

Expand towards small cost function value

x1

x2 Gradient

x1

x2 Gradient

Page 22: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 22

Downhill Simplex Method

Apply reflection, expansion and contraction

Contract towards small cost function value

x1

x2 Gradient

x1

x2 Gradient

Page 23: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 23

Downhill Simplex Method

Converge to a local minimum, if a sequence of reflection, expansion and contraction are appropriately applied Slow convergence (especially in high-dimensional cases) I.e., a large number of iteration steps

If cost function is smooth, its derivative information can be

used to search optimal solution More details in future lectures

However, downhill simplex method is still required if derivatives

are not available or too difficult to calculate Cost function is not smooth Cost function contains sharp changes

Page 24: 18-660: Numerical Methods for Engineering Design and Optimization

Slide 24

Summary

Unconstrained Optimization Golden section search Downhill simplex method