Informed Search (2) Introduction to Artificial Intelligence H di M - - PDF document

informed search 2
SMART_READER_LITE
LIVE PREVIEW

Informed Search (2) Introduction to Artificial Intelligence H di M - - PDF document

Informed Search (2) Introduction to Artificial Intelligence H di M Hadi Moradi di 1 Last time: search strategies I I nformed: Use heuristics to guide the search f d U h i i id h h Best first: Greedy search: A* search: 2


slide-1
SLIDE 1

1

Informed Search (2)

Introduction to Artificial Intelligence H di M di

1

Hadi Moradi

Last time: search strategies

I f d U

h i i id h h

I nformed: Use heuristics to guide the search

Best first: Greedy search:

2

A* search:

slide-2
SLIDE 2

2

Another Search Problem

Job scheduling

j b 1 hi

3

m jobs 1 machine m jobs n machines (job-shop scheduling) Example: 5 Job problem N job problem:

This time

Iterative improvement

Iterative improvement Hill climbing Simulated annealing

4

slide-3
SLIDE 3

3

Iterative improvement

In many optimization problems,

y p p ,

path is irrelevant; the goal state itself is the solution.

In such cases, can use iterative improvement

algorithms:

  • 5

Iterative improvement example: vacuum world

Simplified world: 2 locations, each may or not contain dirt, h t t i i t each may or not contain vacuuming agent. Goal of agent: clean up the dirt. If path does not matter, do not need to keep track of it.

6

slide-4
SLIDE 4

4

Iterative improvement example: n-queens

7

Hill climbing (or gradient ascent/descent)

Iteratively maximize/minmize “value” of current

t t b l i it b t t th t h state, by replacing it by successor state that has highest value, as long as possible.

8

slide-5
SLIDE 5

5

Hill climbing

Note: minimizing a “value” function v(n) is

Note: minimizing a value function v(n) is

equivalent to maximizing –v(n),

9

Hill climbing

Problem: depending on initial state, may get

stuck in local maxima stuck in local maxima.

Any suggestion?

Does it matter if you start from left or from right?

10

slide-6
SLIDE 6

6

Minimizing energy

Basin of 11

B C A

Attraction for C

D E

Local Minima Problem

Question: How do you avoid this local

Question: How do you avoid this local

minima?

starting point descend barrier to local search

12

descend direction local minima global minima

slide-7
SLIDE 7

7

Consequences of the Occasional Ascents

desired effect

Help escaping the local optima.

13

Might pass global optima after reaching it

adverse effect

Boltzmann machines

A

Attraction for C

h

B C D E

The Boltzmann Machine of

14

Hinton, Sejnowski, and Ackley (1984) uses simulated annealing to escape local minima. Example: Arranging sugar cubes in its box.

slide-8
SLIDE 8

8

Simulated annealing: basic idea

From current state pick a random successor From current state, pick a random successor

state:

15

Simulated annealing: Sword

.

16

slide-9
SLIDE 9

9

Simulated annealing in practice

  • set T
  • optimize for

given T

  • lower T

t

17

  • repeat

MDSA: Molecular Dynamics Simulated Annealing

Simulated annealing in practice

  • set T
  • ptimize for given T
  • lower T

(see Geman & Geman, 1984)

  • repeat

Geman & Geman (1984): if T is lowered

18

( ) sufficiently slowly (with respect to the number

  • f iterations used to optimize at a given T),

simulated annealing is guaranteed to find the global minimum.

slide-10
SLIDE 10

10

Simulated annealing in practice

set T

  • set T
  • ptimize for given T
  • lower T

(see Geman & Geman, 1984)

  • repeat

Caveat:

19

Caveat:

Simulated annealing algorithm

Idea: Escape local extrema by allowing “bad moves,”

b t d ll d th i i d f but gradually decrease their size and frequency.

20

Note: goal here is to maximize E.

slide-11
SLIDE 11

11

Note on simulated annealing: limit cases

Boltzmann distribution: accept “bad move” with ΔE< 0 (goal

p (g is to maximize E) with probability P(ΔE) = exp(ΔE/T)

If T is large:

ΔE < 0 ΔE/T < 0 and very small

exp(ΔE/T) close to 1 accept bad move with high probability

21

If T is near 0:

ΔE < 0 ΔE/T < 0 and very large

exp(ΔE/T) close to 0 accept bad move with low probability

To accept or not to accept - SA?

Change Temp exp(-ΔE/T) Change Temp exp(-ΔE/T) 0.2 0.95 0.810157735 0.2 0.1 0.135335283 0.4 0.95 0.656355555 0.4 0.1 0.018315639 0.6 0.95 0.53175153 0.6 0.1 0.002478752 0.8 0.95 0.430802615 0.8 0.1 0.000335463

22

slide-12
SLIDE 12

12

Monte Carlo Number Parent solution = new solution

Simulated Annealing Flowchart

23

Flowchart

Local Beam Search

Keep track of k states

Keep track of k states

24

slide-13
SLIDE 13

13

Online Search in Continues Space

For instance f(x1 y1 x2 y2 x3 y3) to be

For instance f(x1,y1,x2,y2,x3,y3) to be

minimized

25

Solving TSP using SA

Visit all the cities (do not skip any city) Visit all the cities (do not skip any city) Do not visit a city twice Shortest path Convert it to:

Moving the elements of a fixed sized list

Li t th th th t h ld b t k (li t f iti i

26

List = the path that should be taken (list of cities in

  • rder)

http://www.hermetic.ch/misc/ts3/ts3demo.htm

slide-14
SLIDE 14

14

Summary

Best-first search: Best first search: Greedy search:

27

Summary

A* search = best-first with measure = A search

best first with measure path cost so far + estimated path cost to goal.

28

slide-15
SLIDE 15

15

Summary

Time complexity of heuristic algorithms Time complexity of heuristic algorithms

depend on quality of heuristic function.

Good heuristics can sometimes be

constructed by examining the problem definition or by generalizing from

29

experience with the problem class.

Summary

Iterative improvement algorithms keep Iterative improvement algorithms keep

  • nly a single state in memory.

Can get stuck in local extrema;

simulated annealing provides a way to escape local extrema, and is complete

30

and optimal given a slow enough cooling schedule.