SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem...

27
SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited Iterative deepening Informed: Use heuristics to guide the search Best first: Greedy search – queue first nodes that maximize heuristic “desirability” based on estimated path cost from current node to goal; A* search – queue first nodes that maximize sum of path cost so far and estimated path cost to goal.

Transcript of SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem...

Page 1: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 1

Last time: search strategies

Uninformed: Use only information available in the problem formulation• Breadth-first• Uniform-cost• Depth-first• Depth-limited• Iterative deepening

Informed: Use heuristics to guide the search• Best first:• Greedy search – queue first nodes that maximize heuristic “desirability”

based on estimated path cost from current node to goal;• A* search – queue first nodes that maximize sum of path cost so far and

estimated path cost to goal.

Page 2: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 2

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 3: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 3

Depth-first search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 4: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 4

Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

2 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 5: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 5

Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 6: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 6

Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 7: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 7

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 8: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 8

Breadth-first search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 9: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 9

Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 1

Page 10: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 10

Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2

Page 11: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 11

Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2

Page 12: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 12

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 13: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 13

Uniform-cost search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 14: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 14

Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 14 C 1 19 1

Page 15: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 15

Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1

Page 16: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 16

Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1

Page 17: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 17

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 18: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 18

Greedy search

Node queue: initialization

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --

Page 19: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 19

Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1

Sort key

Page 20: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 20

Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1

Page 21: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 21

Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1

Page 22: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 22

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 23: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 23

A* search

Node queue: initialization

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --

Page 24: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 24

A* search

Node queue: Add successors to queue, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1

Sort key

Page 25: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 25

A* search

Node queue: Add successors to queue front, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1

Page 26: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 26

A* search

Node queue: Add successors to queue front, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1

Page 27: SE 420 1 Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.

SE 420 27

Exercise: Search Algorithms

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14