Simulated Annealing

Preview:

DESCRIPTION

A basic overview of the simulated annealing algorithm

Citation preview

Simulated AnnealingKatrina Ellison Geltman

Hacker School February 20, 2014

What is simulated annealing?

It’s an algorithm for finding a good solution to an optimization problem

What’s an optimization problem?

It’s the problem of finding the best solution from all feasible solutions. (Wikipedia)

Canonical Example: Traveling Salesman

Canonical Example: Traveling Salesman

• The salesman needs to minimize the number of miles he travels. An itinerary is better if it is shorter.

• There are many feasible itineraries to choose from. We are looking for the best one.

Simulated annealing solves this type of problem.

Why ‘annealing’?

• Simulated annealing is inspired by a metalworking process called annealing.

• It uses the equation that describes changes in a metal’s embodied energy during the annealing process

How does it work?

The Process

!

!

!

The Process• Generate a random solution!

• Assess its cost!

!

!

!

The Process• Generate a random solution!

• Assess its cost!

• Find a neighboring solution!

• Assess its cost!

!

The Process• Generate a random solution!

• Assess its cost!

• Find a neighboring solution!

• Assess its cost!

!• If cnew < cold: move!!

• If cnew > cold: maybe move

The Process• Generate a random solution!

• Assess its cost!

• Find a neighboring solution!

• Assess its cost!

!• If cnew < cold: move!!

• If cnew > cold: maybe move

Why??

… To escape local maxima

… To escape local maxima

… To escape local maxima

… To escape local maxima

… To escape local maxima

The probability of accepting a worse solution depends on:

> How much worse it is

> Which iteration you’re on

The probability of accepting a worse solution depends on:

! ! > How much worse it is!

> Which iteration you’re on

The probability of accepting a worse solution depends on:

! ! > How much worse it is!

> Which iteration you’re on

Typically calculated using

Metropolis-Hastings algorithm

The probability of accepting a worse solution depends on:

> How much worse it is

! ! > Which iteration you’re on

The probability of accepting a worse solution depends on:

> How much worse it is

! ! > Which iteration you’re on(later iteration = less likely)

The probability of accepting a worse solution depends on:

> How much worse it is

! ! > Which iteration you’re on

Analogous to temperature in the

physical annealing equation(later iteration = less likely)

Big jumps to worse states happen early.

!

After many iterations, the algorithm hones in on a local optimum.

!

So a good-enough solution is usually found.

The algorithm’s parameters must be tuned correctly, which requires some guesswork.

But overall, simulated annealing is generally considered a good choice for solving optimization problems.

The End!

Recommended