CSE 473 Chapter 3 Problem Solving Using Search

4m ago
2.74 MB
30 Pages
Last View : 3d ago
Last Download : n/a
Upload by : Bennett Almond

CSE 473Chapter 3Problem Solving using Search“First, they do an on-line search” CSE AI FacultyExample: The 8-puzzleStartGoal1 2 3481 2 34 5 67 87 6 521

Example: Route Planning3Example: N Queens4 Queens problem(Place queens such that no queen attacks any other)42

Example: N Queens4 Queens5State-Space Search ProblemsGeneral problem:Find a path from a start state to a goal state given: A goal test: Tests if a given state is a goal state A successor function (transition model): Given a state,generates its successor statesVariants: 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, N queens, Rubik’s cube63

Example: Simplified Pac-ManInput: State space Successor function“N”, 1.0“E”, 1.0 Start state Goal testSearch Trees“N”, 1.0“E”, 1.0A search tree: Root Start state Children successor states Edges actions and costs Path from Start to a node is a “plan” to get to that state For most problems, we can never actually build thewhole tree (why?)4

State Space Graph versus Search TreesState Space Graph(graph of states with arrows pointing to successors)GacbedSfhprqState Space Graph versus Search TreesGacbedSfhprqSedSearch Treeebcaa hp qqphrrp qffqc GacqGa5

Search Tree for 8-Puzzle11126

Searching with Search TreesSearch: Expand out possible nodes Maintain a fringe of as yet unexpanded nodes Try to expand as few tree nodes as possible147

15Handling Repeated StatesFailure to detect repeated states (e.g., in 8 puzzle) can causeinfinite loops in searchSTARTaGOALexpandexpandbGraph Search algorithm: Augment Tree-Search to storeexpanded nodes in a set called explored set (or closed set)and only add new nodes not in the explored set to the fringe168





b b2 b3 bd O(bd ) i.e. exp in d25b b2 b3 bd O(bd ) i.e. exp in dO (b d )2613

b b2 b3 bd O(bd ) i.e. exp in dO ( bd )Yes if all step costs are equal. Not optimal in general.Space and time are big problems for BFS.Example: b 10, 1000,000 nodes/sec, 1000 Bytes/noded 2 110 nodes, 0.11 millisecs, 107KBd 4 11,110 nodes, 11 millisecs, 10.6 MBd 8 108 nodes, 2 minutes, 103 GBd 16 1016 nodes, 350 years, 10 EB (1 billion GB)27What if the step costs are notequal?Can we modify BFS to handle any stepcost function?2814

g (n ) (Use priority queue)O(b C*O(b C )/ 1* )/ 1293015







(using “explored” set)43(using “explored” set)4422

(using “explored” set)45(using “explored” set)Space cost is a big advantage of DFS over BFS.Example: b 10, 1000 Bytes/noded 16 156 KB instead of 10 EB (1 billion GB)4623

(can handle infinite state spaces)47 DFS with increasing depth limit Finds the best depth limit Combines the benefits of DFS and BFS4824





Yes if all step costs are equal. Not optimal in general.Increasing path-cost limits instead of depth limitsThis is called Iterative lengthening search (exercise 3.17)57Forwards vs. BackwardsProblem: Find the shortest route5829

Bidirectional SearchMotivation: bd/2 bd/2 bd(E.g., 108 108 2 108 1016)Can use breadth-first search or uniform-cost searchHard for implicit goals e.g., goal “checkmate” in chess59Can we do better?All these methods are slow (because they are “blind”)Solution use problem-specific knowledge toguide search (“heuristic function”) “informed search” (next lecture)To Do Start Project #1 Read Chapter 36030

Problem Solving using Search ... c e h a f r State Space Graph (graph of states with arrows pointing to successors) S a b e d p a c h e p f r q q c a q p h f r q q c G a S G d b p q c e h a f r Search Tree State Space Graph versus Search Trees G . 6 11 Search Tree for 8-Puzzle 12 . 7