montecarlo optimization (simulated annealing) mathematical biology lecture 6 james a. glazier

11
MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Upload: collin-maxwell

Post on 30-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

MonteCarlo Optimization(Simulated Annealing)

Mathematical Biology Lecture 6

James A. Glazier

Page 2: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Optimization• Other Major Application of Monte Carlo Methods is to Find

the Optimal (or a nearly Optimal) Solution of an Algorithmically Hard Problem.

• Given want to find that minimizes f.• Definition: then is a Local Minimum of f. • Definition:

then is the Global Minimum of f. • Definition:

then f has Multiple Degenerate Global Minima,

xf

, 0 , If minmin xfxfxxx

, , If minmin xfxfxx

, and , If min,2 min,1minmin min,2 min,1 xfxfxfxfxxxx

minx

minx

., min,2min,1 xx

minx

Page 3: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Energy Surfaces• The Number and Shape of Local Minima of

f Determine the Texture of the ‘Energy Surface,’ also called the Energy Landscape, Penalty Landscape or Optimization Landscape.

• Definition: The Basin of Attraction of a Local Minimum, is:

• The Depth of the Basin of Attraction is:

• The Radius or Size of the Basin of Attraction is:

• If no local minima except global minimum, then optimization is easy and energy surface is Smooth.

. , minmin xfyfyyxxyx

minx

.max min of Attraction ofBasin minxfxfxx

.max min of Attraction ofBasin minxxxx

Page 4: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Energy Surfaces• If multiple local minima with large basins

of attraction, need to pick an

In each basin, find the corresponding and pick the best. Corresponds to enumerating all states if is a finite set, e.g. TSP.

• If many local minima or minima have small basins of attraction, then the energy surface is Rough and Optimization is Difficult.

• In these cases cannot find global minimum. However, often, only need a ‘pretty good’ solution.

0x

minx

minx

Page 5: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Monte Carlo Optimization• Deterministic Methods, e.g. Newton-

Rabson

( ) Only Move Towards Better Solutions and Trap in Basins of Attraction. Need to Move the Wrong Way Sometimes to Escape Basins of Attraction (also Called Traps).

• Algorithm:– Choose a – Start at Propose a Move to – If – If

Where,

.0.ix

.0 itt xxx

.let , 1 tiit xxxfxf

,y probabilit with let , 1 ittiit xfxfgxxxfxf

.0 and 10 , ofFunction Decreasing a is , ggxxg

iii xfxx

1

Page 6: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Monte Carlo Optimization—Issues• Given an infinite time, the pseudo-

random walk Will explore all of Phase Space.• However, you never know when you

have reached the global minimum! So don’t know when to Stop.

• Can also take a very long time to escape from Deep Local Basins of Attraction.

• Optimal Choice of g(x) and will depend on the particular

• If g(x)1 for x<x0, then will algorithm will not see minima with depths less than x0 .

• A standard Choice is the Boltzmann Distribution,

g(x)=e-x/T,Where T is the Fluctuation Temperature.

The Boltzmann Distribution has right equilibrium thermodynamics, but is NOT an essential choice in this application).

ix

.xf

Page 7: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Temperature and • Bigger T results in more frequent

unfavorable moves.• In general, the time spent in a Basin of

Attraction is ~ exp(Depth of Basin/ T).• An algorithm with these Kinetics is

Called an Activated Process.• Bigger T are Good for Moving rapidly

Between Large and Deep Basins of Attraction but Ignore Subtle (less than T) Changes in

• Similarly, large move faster, but can miss deep minima with small diameter basins of attraction.

• A strategy for picking T is called an “Annealing Schedule.”

.xf

Page 8: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Annealing Schedules• Ideally, want time in all local minimum

basins to be small and time in global minimum basin to be nearly infinite.

• A fixed value of T Works if depth of the basin of attraction of global minimum>>depth of the basin of attraction of all local minima and radius of the basin of attraction of global minimum~radius of the largest basin of attraction among all local minima.

• If so, pick T between these two depths.

• If multiple local minima almost degenerate with global minimum, then can’t distinguish, but answer is almost optimal.

• If have a deep global minimum with very small basin of attraction (golf-course energy). Then no method helps!

Page 9: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Annealing Schedules• If Energy Landscape is Hierarchical or

Fractal, then start with large T and gradually reduce t.

• Selects first among large, deep basins, then successively smaller and shallower ones until it freezes in one.

• Called “Simulated Annealing.”• No optimal choice of Ts.• Generally Good Strategy:

• Start with T~ f/2, if you know typical values of f for a fixed stepsize , or T~ typical f, if you do not.

• Run until typical f <<T. Then set T=T/2. Repeat.

• Repeat for many initial conditions.

• Take best solution.

Page 10: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Example—The Traveling Salesman Problem

• Simulated Annealing Method Works for Algorithmically Hard (NP Complete) problems like the Traveling Salesman problem.

• Put down N points in some space: • Define an Itinerary: • The Penalty Function or Energy or

Hamiltonian is the Total Path Length

for a Given Itinerary:

N

iix 1

. and ,,1 ,...,, 21 kjjN iikjNiiiiI

.1

mod 1

N

jii Njj

xxH

Page 11: MonteCarlo Optimization (Simulated Annealing) Mathematical Biology Lecture 6 James A. Glazier

Example—The TSP (Contd.)• Pick any Initial Itinerary.• At each Monte Carlo Step, pick:• If the initial Itinerary is: • Then the Trial Itinerary is the Permutation:

• Then • Apply the Metropolis Algorithm.• A Good Initial Choice of T is:

• This Algorithm Works Well, Giving a Permutation with H within a Percent or Better if the Global Optimum in a Reasonable Amount of Time.

. ,,1, kjNkj .,...,,...,,...,1 NkjInitial iiiiI

.InitialTrial IHIHH

.,...,,...,,...,1 NjkTrial iiiiI

.1

1 12

N

i

N

ijji xx

NT