informed search and exploration part iii

10
Informed Search and Exploration Part III Instructor: Dr Wei Ding Part III Instructor: Dr . Wei Ding Fall 2008 CS 470/670 Artificial Intelligence 1 Hill li bi Hill climbing Sometime called greedy local search because Sometime called greedy local search because it grabs a good neighbor state without thinking h d b h ahead about where to go next. Often makes very rapid prog ress towards a solution, because it is usually quite easy to improve a bad state improve a bad state . Unfortunately, hill climbing often gets stuck for the following reasons… CS 470/670 Artificial Intelligence 2

Upload: others

Post on 20-Jan-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Informed Search and Exploration Part III

Informed Search and ExplorationPart III

Instructor: Dr Wei Ding

Part III

Instructor: Dr. Wei Ding

Fall 2008

CS 470/670 Artificial Intelligence 1

Hill li biHill climbingSometime called greedy local search because Sometime called greedy local search because it grabs a good neighbor state without thinking h d b hahead about where to go next.

Often makes very rapid progress towards a y p p gsolution, because it is usually quite easy to improve a bad stateimprove a bad state.

Unfortunately, hill climbing often gets stuck for the following reasons…

CS 470/670 Artificial Intelligence 2

Page 2: Informed Search and Exploration Part III

Problems of hill climbing

Local maxima: a peak that is high than each of its i hb i b l h h l b l neighboring states, but lower than the global

maximum.

Shoulder: a flat local maximum, from which no uphill exist exists uphill exist exists.

I h th l ith h i t t hi h i b i dIn each case, the algorithm reaches a point at which no progress is being made.

CS 470/670 Artificial Intelligence 3

Hill climbing for the 8-queen problem

Starting from a randomly generated 8 queen stateStarting from a randomly generated 8-queen state

hill climbing gets stuck 86% of the time, solving only 14% of problem instances.

Take just 4 steps on average when it is succeeds Take just 4 steps on average when it is succeeds and 3 when it gets stuck

N b d f h 88 17 ll Not bad for a state space with 88 ≈17 million states.

CS 470/670 Artificial Intelligence 4

Page 3: Informed Search and Exploration Part III

V i t f hill li biVariants of hill-climbingFirst choice hill climbing: generating successors First-choice hill climbing: generating successors randomly until one is generated that is better h hthan the current state.

Random-restart hill: conducts a series of hill-climbing searches from randomly generated initial states stopping when a goal is found initial states, stopping when a goal is found.

CS 470/670 Artificial Intelligence 5

L l Mi i P blLocal Minima ProblemQuestion: How do you avoid this local minimum?Question: How do you avoid this local minimum?

barrier to local search

startingpoint

descenddirection

local minimum

global minimum

6

global minimum

CS 470/670 Artificial Intelligence

Page 4: Informed Search and Exploration Part III

Consequences of the Occasional A tAscents

desired effect

Help escaping the local optima.

adverse effect

Might pass global optimaafter reaching it

adverse effect

(easy to avoid bykeeping track of

7

gbest-ever state)

CS 470/670 Artificial Intelligence

B lt hiBoltzmann machines

B

AAttraction for C

D

h

C

EThe Boltzmann Machine of Hinton, Sejnowski, and Ackley (1984)uses simulated annealing to escape local minima.

To motivate their solution, consider how one might get a ball-bearing traveling along the curve to "probably end up" in the deepest minimum The idea is to shake the box "about h hard"deepest minimum. The idea is to shake the box about h hard — then the ball is more likely to go from D to C than from C to D. So, on average, the ball should end up in C's valley.

8CS 470/670 Artificial Intelligence

Page 5: Informed Search and Exploration Part III

Si l t d li b i idSimulated annealing: basic ideaFrom current state pick a random successor state;From current state, pick a random successor state;

If it has better value than current state, then “accept the t iti ” th t i t t t t ttransition,” that is, use successor state as current state;

Otherwise, do not give up, but instead flip a coin and accept the transition with a given probability (that is lower as the successor is worse).

So we accept to sometimes “un-optimize” the value function a little with a non-zero probability.

9CS 470/670 Artificial Intelligence

Si l t d liSimulated annealingKirkpatrick et al 1983:Kirkpatrick et al. 1983:

Simulated annealing is a general method for making likely the escape from local minima by allowing jumps to higher energy states.y g j p g gy

The analogy here is with the process of annealing used by a craftsman in forging a sword from an alloy.g g y

He heats the metal, then slowly cools it as he hammers the blade into shape.

If he cools the blade too quickly the metal will form patches of different composition;

If the metal is cooled slowly while it is shaped the constituent metals will form a If the metal is cooled slowly while it is shaped, the constituent metals will form a uniform alloy.

10

Page 6: Informed Search and Exploration Part III

Real annealing: Sword He heats the metal then He heats the metal, then slowly cools it as he hammers the blade into shape. p

If he cools the blade too quickly the metal will form patches of different composition;If th t l i l d l l If the metal is cooled slowly while it is shaped, the constituent metals will constituent metals will form a uniform alloy.

CS 470/670 Artificial Intelligence 11

Si l t d li i tiSimulated annealing in practiceGeman & Geman (1984): if temperature T is ( ) plowered sufficiently slowly (with respect to the number of iterations used to optimize at a given T) number of iterations used to optimize at a given T), simulated annealing is guaranteed to find the global

i iminimum.

Caveat: this algorithm has no end (Geman & g (Geman’s T decrease schedule is in the 1/log of the number of iterations so T will never reach zero) so number of iterations, so, T will never reach zero), so it may take an infinite amount of time for it to find th l b l i i

12

the global minimum.

Page 7: Informed Search and Exploration Part III

Si l t d li l ithSimulated annealing algorithmIdea: Escape local extreme by allowing “bad moves ” but gradually Idea: Escape local extreme by allowing bad moves, but gradually decrease their size and frequency.

Note: goal here is tomaximize E.

CS 561, Session 7 13-exp(ΔE/T)ΔE<0 If the goal is to minimize E.

B lt di t ib tiBoltzmann distributionAt thermal equilibrium at temperature T the At thermal equilibrium at temperature T, the Boltzmann distribution gives the relative probability that the system will occupy state A vs probability that the system will occupy state A vs. state B as:

)/)(exp()()(exp

)( TBEBEAEAP=⎟

⎞⎜⎛ −−=

)/)(exp(exp

)( TAETBP⎟⎠

⎜⎝

where E(A) and E(B) are the energies associated with states A and B.

14

Page 8: Informed Search and Exploration Part III

Note on simulated annealing: limit cases

Boltzmann distribution: accept “bad move” with ΔE<0 (goal is to Boltzmann distribution: accept bad move with ΔE<0 (goal is to maximize E) with probability P(ΔE) = exp(ΔE/T)

If T is large: ΔE < 0If T is large: ΔE 0

ΔE/T < 0 and very small

exp(ΔE/T) close to 1 Random walkexp(ΔE/T) close to 1

accept bad move with high probability

If T is near 0: ΔE < 0If T is near 0: ΔE < 0

ΔE/T < 0 and very large

exp(ΔE/T) close to 0Deterministicdown-hillexp(ΔE/T) close to 0

accept bad move with low probability

CS 561, Session 7 15

Si l t d liSimulated annealingDifferent from hill climbing simulated annealing picks a random Different from hill climbing, simulated annealing picks a random move.

If the move improves the situation, it is always accepted. p , y pOtherwise, the algorithm accepts the move with some probability less than 1.

The probability decreases exponentially with the “badness” of the move – the amount ΔE by which the evaluation is worsened.

“bad” moved are more likely to be allowed at the start when temperature is high, and they become more unlikely as T d decreases.

Simulated annealing is used extensively to solve VLSI layout problems factory scheduling problems, factory scheduling.

CS 470/670 Artificial Intelligence 16

Page 9: Informed Search and Exploration Part III

L l b hLocal beam searchKeep track of k states rather than just oneKeep track of k states rather than just oneStart with k randomly generated statesAt each iteration all the successors of all k states are generatedAt each iteration, all the successors of all k states are generatedIf any one is a goal state, stop; else select the k best successors from the complete list and repeatfrom the complete list and repeat.In a local beam search, useful information is passed among the k ll l h th dk parallel search threads.

The algorithm quickly abandons unfruitful searches and h h b moves its resources to where the most progress is being

made.

CS 470/670 Artificial Intelligence 17

SSummaryBest-first search = general search, where the minimum-cost nodes g ,(according to some measure) are expanded first.

Greedy search = best-first with the estimated cost to reach the goal as y ga heuristic measure.

- Generally faster than uninformed search

- not optimal

- not complete.

A* search = best-first with measure = path cost so far + estimated path cost to goal.

- combines advantages of uniform-cost and greedy searches

- complete, optimal and optimally efficient

18- space complexity still exponential

Page 10: Informed Search and Exploration Part III

SSummaryTime complexity of heuristic algorithms depend on quality Time complexity of heuristic algorithms depend on quality of heuristic function. Good heuristics can sometimes be constructed by examining the problem definition or by constructed by examining the problem definition or by generalizing from experience with the problem class.

L l h th d t t k i l l t Local search methods can get stuck in local extreme; simulated annealing provides a way to escape local extreme,

d i l t d ti l i l h li and is complete and optimal given a slow enough cooling schedule.

CS 561, Session 7 19