cse 473 chapter 3 problem solving using search · 2006. 10. 4. · 3 5 example: n queens 4 queens 6...

29
1 Chapter 3 Problem Solving using Search Chapter 3 Problem Solving using Search CSE 473 © CSE AI Faculty “First, they do an on-line search” 2 Example: The 8-puzzle Example: The 8-puzzle 1 2 3 6 7 5 8 4 1 2 3 8 7 5 4 6

Upload: others

Post on 19-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

1

Chapter 3

Problem Solving using Search

Chapter 3

Problem Solving using Search

CSE 473

© CSE AI Faculty

“First, they do an on-line search”

2

Example: The 8-puzzleExample: The 8-puzzle

1 2 3

67 5

8 4

1 2 3

87

54 6

Page 2: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

2

3

Example: Route PlanningExample: Route Planning

start

end

4

Example: N QueensExample: N Queens

4 Queens

Page 3: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

3

5

Example: N QueensExample: N Queens

4 Queens

6

State-Space Search ProblemsState-Space Search Problems

General problem:

Given a start state, find a path to a goal state

• Can test if a state is a goal

• Given a state, can generate its successor states

Variants:

• Find any path vs. a least-cost path

• Goal is completely specified, task is just to find the path

– Route planning

• Path doesn’t matter, only finding the goal state

– 8 puzzle

Page 4: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

4

7

Tree Representation of 8-Puzzle Problem SpaceTree Representation of 8-Puzzle Problem Space

8

Page 5: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

5

9

10

Page 6: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

6

11

12

Page 7: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

7

13

14

Page 8: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

8

15

16

Page 9: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

9

17

18

Page 10: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

10

19

20

Page 11: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

11

21

22

Space is the big problem for BFS.

Example: b = 10, 10,000 nodes/sec, 1KB/node

d = 2 ŁŁŁŁ 1100 nodes, 0.11 secs, 1MB

d = 4 ŁŁŁŁ 111,100 nodes, 11 secs, 106 MB

d = 8 ŁŁŁŁ 109 nodes, 31 hours, 1 TB

Page 12: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

12

23

24

Page 13: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

13

25

26

Page 14: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

14

27

28

Page 15: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

15

29

30

Page 16: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

16

31

32

Page 17: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

17

33

34

Page 18: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

18

35

36

Page 19: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

19

37

38

Page 20: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

20

39

40

Page 21: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

21

41

42

Page 22: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

22

43

44

Page 23: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

23

45

46

Page 24: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

24

47

48

Page 25: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

25

49

50

Page 26: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

26

51

Increasing path-cost limits instead of depth limits

This is called Iterative lengthening search (exercise 3.11)

52

Page 27: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

27

53

Forwards vs. BackwardsForwards vs. Backwardsstart

end

Problem: Find the shortest route

54

Bidirectional SearchBidirectional Search

Motivation: bd/2 + bd/2 << bd

Can use breadth-first search or uniform-cost search

Hard for implicit goals e.g., goal = “checkmate” in chess

Page 28: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

28

55

Repeated StatesRepeated States

Failure to detect repeated states can turn a linear problem into an exponential one! (e.g., repeated states in 8 puzzle)

Graph search algorithm: Store expanded nodes in a set called closed and only add new nodes to the fringe

56

Graph SearchGraph Search

Page 29: CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6 State-Space Search Problems General problem: Given a start state, find a path to

29

57

Can we do better?Can we do better?

All these methods are slow (blind)

Solution àààà use problem-specific knowledge to guide search (“heuristic function”)

àààà “informed search” (next lecture)