today uninformed search strategies
play

Today Uninformed search strategies Uninformed strategies use only - PowerPoint PPT Presentation

1 2 Today Uninformed search strategies Uninformed strategies use only the information available in the problem Uninformed search definition. We look at some such strategies: Several search strategies Breadth-first search


  1. 1 2 Today Uninformed search strategies Uninformed strategies use only the information available in the problem • Uninformed search definition. We look at some such strategies: • Several search strategies • Breadth-first search • Properties of the strategies • Uniform-cost search See Russell and Norvig, Chapter 3. • Depth-first search • Depth-limited search • Iterative deepening search Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 3 4 Breadth-first search Properties of breadth-first search Expand shallowest unexpanded node Recall: Strategies are evaluated along the following dimensions: completeness—does it always find a solution if one exists? Implementation: time complexity—number of nodes generated/expanded fringe is a FIFO queue (First In First Out), space complexity—maximum number of nodes in memory i.e., new successors go at end optimality—does it always find a least-cost solution? Time and space complexity are measured in terms of b —maximum branching factor of the search tree A A A A d —depth of the least-cost solution B C B C B C B C m —maximum depth of the state space (may be infinite) E F G E F G E F G E F G D D D D Complete?? Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  2. 5 6 Properties of breadth-first search Properties of breadth-first search Complete?? Yes (if b is finite) Complete?? Yes (if b is finite) Time?? 1 + b + b 2 + b 3 + . . . + b d + b ( b d − 1) = O ( b d +1 ) , i.e., exp. in d Time?? Space?? Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 7 8 Properties of breadth-first search Uniform-cost search Complete?? Yes (if b is finite) Expand least-cost unexpanded node Time?? 1 + b + b 2 + b 3 + . . . + b d + b ( b d − 1) = O ( b d +1 ) , i.e., exp. in d Implementation: fringe = queue ordered by path cost Space?? O ( b d +1 ) (keeps every node in memory) Equivalent to breadth-first if step costs all equal Optimal?? Yes (if cost = 1 per step); not optimal in general Complete?? Yes, if step cost ≥ ǫ for ǫ > 0 Space is the big problem; can easily generate nodes at 10MB/sec – Time?? # of nodes with g ≤ cost of optimal solution, O ( b ⌈ C ∗ /ǫ ⌉ ) so 24hrs = 860GB. where C ∗ is the cost of the optimal solution Space?? # of nodes with g ≤ cost of optimal solution, O ( b ⌈ C ∗ /ǫ ⌉ ) Optimal?? Yes—nodes expanded in increasing order of g ( n ) Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  3. 9 Depth-first search 10 A A A Depth-first search B C B C B C D E F G D E F G D E F G Expand deepest unexpanded node H I J K L M N O H I J K L M N O H I J K L M N O Implementation: A A A B C B C B C fringe = LIFO queue (Last In First Out), D E F G D E F G D E F G H N O N O N O I J K L M H I J K L M H I J K L M i.e., put successors at front A A A B C B C B C D E F G D E F G D E F G H I J K L M N O H I J K L M N O H I J K L M N O A A A B C B C B C D E F G D E F G D E F G H I J K L M N O H I J K L M N O H I J K L M N O Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 11 12 Properties of depth-first search Properties of depth-first search Complete?? No: fails in infinite-depth spaces, spaces with loops Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path Modify to avoid repeated states along path ⇒ complete in finite spaces ⇒ complete in finite spaces Time?? O ( b m ) : terrible if m is much larger than d Time?? but if solutions are dense, may be much faster than breadth-first Space?? Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  4. 13 14 Properties of depth-first search Properties of depth-first search Complete?? No: fails in infinite-depth spaces, spaces with loops Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path Modify to avoid repeated states along path ⇒ complete in finite spaces ⇒ complete in finite spaces Time?? O ( b m ) : terrible if m is much larger than d Time?? O ( b m ) : terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first but if solutions are dense, may be much faster than breadth-first Space?? O ( bm ) , i.e., linear space! Space?? O ( bm ) , i.e., linear space! Optimal?? Optimal?? No Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 15 16 Depth-limited search Iterative deepening search = depth-first search with depth limit l , i.e., do not look at nodes at depth > l function Iterative-Deepening-Search ( problem ) returns a solution inputs : problem , a problem function Depth-Limited-Search ( problem , limit ) returns soln/fail/cutoff for depth ← 0 to ∞ do Recursive-DLS ( Make-Node ( Initial-State [ problem ]), problem , limit ) result ← Depth-Limited-Search ( problem, depth ) function Recursive-DLS ( node , problem , limit ) returns soln/fail/cutoff if result � = cutoff then return result cutoff-occurred? ← false end if Goal-Test [ problem ]( State [ node ]) then return node else if Depth [ node ] = limit then return cutoff else for each successor in Expand ( node , problem ) do result ← Recursive-DLS ( successor , problem , limit ) if result = cutoff then cutoff-occurred? ← true else if result � = failure then return result if cutoff-occurred? then return cutoff else return failure Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  5. Iterative deepening search l = 0 17 18 Properties of iterative deepening search Limit = 0 A A Complete?? Limit = 1 A A A A B C B C B C B C Limit = 2 A A A A B C B C B C B C D E F G D E F G D E F G D E F G A A A A B C B C B C B C D E F G D E F G D E F G D E F G Limit = 3 A A A A B C B C B C B C D E F G D E F G D E F G D E F G H I J K L M N O H I J K L M N O H I J K L M N O H I J K L M N O A A A A B C B C B C B C D E F G D E F G D E F G D E F G H I J K L M O H I J K L M O H I J K L M O H I J K L M O N N N N A A A A B C B C B C B C D E F G D E F G D E F G D E F G H I J K L M N O H I J K L M N O H I J K L M N O H I J K L M N O Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 19 20 Properties of iterative deepening search Properties of iterative deepening search Complete?? Yes Complete?? Yes Time?? ( d + 1) b 0 + db 1 + ( d − 1) b 2 + . . . + b d = O ( b d ) Time?? Space?? Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  6. 21 22 Properties of iterative deepening search Properties of iterative deepening search Complete?? Yes Complete?? Yes Time?? ( d + 1) b 0 + db 1 + ( d − 1) b 2 + . . . + b d = O ( b d ) Time?? ( d + 1) b 0 + db 1 + ( d − 1) b 2 + . . . + b d = O ( b d ) Space?? O ( bd ) Space?? O ( bd ) Optimal?? Optimal?? Yes, if step cost = 1 Numerical comparison for b = 10 and d = 5 , solution at far right of tree: N ( IDS ) = 50 + 400 + 3 , 000 + 20 , 000 + 100 , 000 = 123 , 450 N ( BFS ) = 10 + 100 + 1 , 000 + 10 , 000 + 100 , 000 + 999 , 990 = 1 , 111 , 100 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 23 24 Summary of algorithms Repeated states Failure to detect repeated states can turn a linear problem into an exponential Criterion Breadth- Uniform- Depth- Depth- Iterative one! First Cost First Limited Deepening Yes ∗ Yes ∗ A Complete? No Yes, if l ≥ d Yes A b ⌈ C ∗ /ǫ ⌉ b d +1 b m b l b d Time b ⌈ C ∗ /ǫ ⌉ B B B b d +1 Space bm bl bd A Yes ∗ Yes ∗ Optimal? No No Yes C C C C C Here ∗ indicates conditions stated earlier. D (a) (b) (c) Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

  7. 25 26 Graph search Summary The state space with actions leading from state to state corresponds naturally to • Problem formulation usually requires abstracting away real-world details to a graph rather than a tree ; the state appears only once in the graph. define a state space that can feasibly be explored There are data structures corresponding to graphs, and graph search algorithms that avoid repetition of states already seen. • Variety of uninformed search strategies The idea is to keep track of nodes that have already been expanded; if search arrives back at such a node, it is ignored in future search. • Iterative deepening search uses only linear space and not much more time than other uninformed algorithms See Russell and Norvig for details. Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

Recommend


More recommend