Romania Map Uninformed Search CIS*3700 (Winter 2007) Example: Map Problem Problem: drive from Arad to Bucharest Formulate a oal: be in Bucharest Current in Arad Formulate the problem: States: various cities on the map Actions: drive between two cities Search for a solution: Sequence of cities, e, Arad Sibiu Faaras Bucharest State Space Representation A set of states which contain all the possible confiurations of the objects relevant to a problem A set of initial states A set of oal states A set of actions (or operators) which allow us to move from one state to another Solvin a problem is to find a path that oes from an initial state to a oal state Water Jus Problem There are two water jus: one is 4-allon, and the other, 3-allon Neither has any measurin markers on it There is a pump that can be used to fill the jus with water You can pour water from one ju to another or onto the round How do you et exactly 2 allons of water into the 3-allon ju? Water Jus Problem The set of states: {(x, y) 0 x 4, 0 y 3} The set of initial states: {(0, 0)} The set of oal states: {(x, 2) 0 x 4} How about the water pump and the round?
Water Jus Problem The set of actions: (x,y) and x < 4 (4,y) -- fill 4-allon ju (x,y) and y < 3 (x, 3) (x,y) and x > 0 (0,y) -- empty 4-allon ju (x,y) and y > 0 (x,0) (x,y) and x+y 4 and y > 0 (4, y-(4-x)) (x,y) and x+y 3 and x > 0 (x-(3-y), 3) (x,y) and x+y 4 and y > 0 (x+y, 0) (x,y) and x+y 3 and x > 0 (0, x+y) Water Jus Problem One possible solution: (,3) (,0) (4,0) (0,0) (4,3) (0,3) (0,2) (2,0) (2,3) (0,) (4,) 8-Puzzle Problem What is a suitable state space representation? 7 2 4 2 Search Problems Toy problems: Concise and exact descriptions are possible Performance of alorithms can be compared E, Vacuum world, 8-queens, and checker 5 6 8 3 Initial State 3 4 5 6 7 8 Goal State Real-world problems: People care about the solutions No sinle areed-upon descriptions E, route findin (network routin and airline travel plannin), VLSI desin, and robot naviation Problem-Solvin Aent Problem Types Deterministic, fully observable sinle-state problem Aent knows exactly which state it will be in; solution is a sequence Non-observable sensorless/conformant problem Aent may have no idea where it is; solution is a sequence Nondeterministic and/or partially observable continency problem percepts provide new information about current state often interleave search and execution Unknown state space exploration problem 2
Sinle-State Problem Problem formation: usin the state space representation Ideas for Tree Search Offline, simulated exploration of state space by eneratin successors of alreadyexplored states Performance measure (additive) Does it find a solution at all? Is it a ood solution (with the lowest path cost)? What is the search cost in terms of time and space? Tree Search Example Tree Search Alorithm Start node Arad Sibiu Timisoara Zerind Arad Faaras Oradea Rimnicu Vilcea Search frontier or frine Data Structures for Tree Search A tree node includes state, parent node, action, path cost (x), depth A frine is a queue of ordered nodes Measures of Search Strateies Completeness: uarantee to find a solution if one exists Optimality: uarantee to find the optimal solution Time complexity: time taken to find a solution Measured by max # of nodes enerated Space complexity: memory needed to perform the search Measured by max # of nods stored 3
Uniformed Search Strateies Uninformed search strateies use only the information available in the problem definition Breadth-First Search Maintain frine as a queue by puttin successors at the end Different Strateies: Breadth-first search (BFS) Uniform-cost search Depth-first search (DFS) Depth-limited search Iterative deepenin search 2 3 4 5 6 7 8 9 0 2 3 4 5 Properties of BFS Complete? Yes (if b is finite) Time? +b+b 2 +b 3 + +b d + b(b d -) = O(b d+ ) Space? O(b d+ ) (keeps every node in memory) Optimal? Yes (if cost = per step) Uniform-Cost Search Maintain frine as queue ordered by path cost Equivalent to breadth-first if step costs are all equal Complete? Yes, if step cost = e Time? # of nodes with = cost of optimal solution, O(b ceilin(c*/ e) ) where C * is the cost of the optimal solution Space? # of nodes with = cost of optimal solution, O(b ceilin(c*/ e) ) Optimal? Yes nodes expanded in increasin order of (n) Depth-First Search Maintain frine as a stack by puttin successors at the front 5 6 2 9 5 3 8 0 3 6 7 4 2 4 8 7 Properties of DFS Complete? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states alon path complete in finite spaces Time? O(b m ): terrible if m is much larer than d but if solutions are dense, may be much faster than breadth-first Space? O(bm), ie, linear space! Optimal? No 4
Depth-Limited Search Iterative Deepenin Depth-first search with depth limit l: no successors beyond this level Iterative Deepenin,2,6,6 3,7,7 4,0,2 5,3,27 8,8 9,20,22 2,25 4,28 5,29 9 23 24 26 30 Iterative Deepenin Number of nodes enerated in a depth-limited search to depth d with branchin factor b: N DLS = b 0 + b + b 2 + + b d-2 + b d- + b d Number of nodes enerated in an iterative deepenin search to depth d with branchin factor b: N IDS = (d+)b 0 + d b^ + (d-)b^2 + + 3b d-2 +2b d- + b d For b = 0, d = 5, N DLS = + 0 + 00 +,000 + 0,000 + 00,000 =, N IDS = 6 + 50 + 400 + 3,000 + 20,000 + 00,000 = 23,456 Overhead = (23,456 -,)/, = % Properties of Iterative Deepenin Summary Complete? Yes Time? (d+)b 0 + d b + (d-)b 2 + + b d = O(b d ) Space? O(bd) Optimal? Yes, if step cost = 5