CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6...
Transcript of CSE 473 Chapter 3 Problem Solving using Search · 2006. 10. 4. · 3 5 Example: N Queens 4 Queens 6...
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
2
3
Example: Route PlanningExample: Route Planning
start
end
4
Example: N QueensExample: N Queens
4 Queens
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
4
7
Tree Representation of 8-Puzzle Problem SpaceTree Representation of 8-Puzzle Problem Space
8
5
9
10
6
11
12
7
13
14
8
15
16
9
17
18
10
19
20
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
12
23
24
13
25
26
14
27
28
15
29
30
16
31
32
17
33
34
18
35
36
19
37
38
20
39
40
21
41
42
22
43
44
23
45
46
24
47
48
25
49
50
26
51
Increasing path-cost limits instead of depth limits
This is called Iterative lengthening search (exercise 3.11)
52
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
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
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)