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

today uninformed search strategies
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

1

Today

  • Uninformed search
  • Several search strategies
  • Properties of the strategies

See Russell and Norvig, Chapter 3.

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 2

Uninformed search strategies

Uninformed strategies use only the information available in the problem definition. We look at some such strategies:

  • Breadth-first search
  • Uniform-cost search
  • Depth-first search
  • Depth-limited search
  • Iterative deepening search

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 3

Breadth-first search

Expand shallowest unexpanded node Implementation: fringe is a FIFO queue (First In First Out), i.e., new successors go at end

A B C E F G D A B D E F G C A C D E F G B B C D E F G A Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 4

Properties of breadth-first search

Recall: Strategies are evaluated along the following dimensions: completeness—does it always find a solution if one exists? time complexity—number of nodes generated/expanded space complexity—maximum number of nodes in memory

  • ptimality—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 d—depth of the least-cost solution m—maximum depth of the state space (may be infinite) Complete??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

slide-2
SLIDE 2

5

Properties of breadth-first search

Complete?? Yes (if b is finite) Time??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 6

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? 1 + b + b2 + b3 + . . . + bd + b(bd − 1) = O(bd+1), i.e., exp. in d Space??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 7

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? 1 + b + b2 + b3 + . . . + bd + b(bd − 1) = O(bd+1), i.e., exp. in d Space?? O(bd+1) (keeps every node in memory) Optimal?? Yes (if cost = 1 per step); not optimal in general Space is the big problem; can easily generate nodes at 10MB/sec – so 24hrs = 860GB.

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 8

Uniform-cost search

Expand least-cost unexpanded node Implementation: fringe = queue ordered by path cost Equivalent to breadth-first if step costs all equal Complete?? Yes, if step cost ≥ ǫ for ǫ > 0 Time?? # of nodes with g ≤ cost of optimal solution, O(b⌈C∗/ǫ⌉) 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

slide-3
SLIDE 3

9

Depth-first search

Expand deepest unexpanded node Implementation: fringe = LIFO queue (Last In First Out), i.e., put successors at front

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 Depth-first search 10

A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 11

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 12

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

slide-4
SLIDE 4

13

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space?? O(bm), i.e., linear space! Optimal??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 14

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space?? O(bm), i.e., linear space! Optimal?? No

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 15

Depth-limited search

= depth-first search with depth limit l, i.e., do not look at nodes at depth > l

function Depth-Limited-Search( problem, limit) returns soln/fail/cutoff Recursive-DLS(Make-Node(Initial-State[problem]), problem, limit) function Recursive-DLS(node, problem, limit) returns soln/fail/cutoff cutoff-occurred? ← false 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 16

Iterative deepening search

function Iterative-Deepening-Search( problem) returns a solution inputs: problem, a problem for depth ← 0 to ∞ do result ← Depth-Limited-Search( problem, depth) if result = cutoff then return result end

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

slide-5
SLIDE 5

Iterative deepening search l = 0 17

Limit = 3 Limit = 2 Limit = 1 Limit = 0

A A A B C A B C A B C A B C A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H I J K L M N O A B C D E F G H J K L M N O I A B C D E F G H I J K L M N O

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 18

Properties of iterative deepening search

Complete??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 19

Properties of iterative deepening search

Complete?? Yes Time??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 20

Properties of iterative deepening search

Complete?? Yes Time?? (d + 1)b0 + db1 + (d − 1)b2 + . . . + bd = O(bd) Space??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

slide-6
SLIDE 6

21

Properties of iterative deepening search

Complete?? Yes Time?? (d + 1)b0 + db1 + (d − 1)b2 + . . . + bd = O(bd) Space?? O(bd) Optimal??

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 22

Properties of iterative deepening search

Complete?? Yes Time?? (d + 1)b0 + db1 + (d − 1)b2 + . . . + bd = O(bd) Space?? O(bd) 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 23

Summary of algorithms

Criterion Breadth- Uniform- Depth- Depth- Iterative First Cost First Limited Deepening Complete? Yes∗ Yes∗ No Yes, if l ≥ d Yes Time bd+1 b⌈C∗/ǫ⌉ bm bl bd Space bd+1 b⌈C∗/ǫ⌉ bm bl bd Optimal? Yes∗ Yes∗ No No Yes Here ∗ indicates conditions stated earlier.

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 24

Repeated states

Failure to detect repeated states can turn a linear problem into an exponential

  • ne!

A B C D A B B C C C C A (c) (b) (a)

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008

slide-7
SLIDE 7

25

Graph search

The state space with actions leading from state to state corresponds naturally to a graph rather than a tree; the state appears only once in the graph. There are data structures corresponding to graphs, and graph search algorithms that avoid repetition of states already seen. 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. See Russell and Norvig for details.

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008 26

Summary

  • Problem formulation usually requires abstracting away real-world details to

define a state space that can feasibly be explored

  • Variety of uninformed search strategies
  • Iterative deepening search uses only linear space

and not much more time than other uninformed algorithms

Alan Smaill Fundamentals of Artificial Intelligence Oct 9, 2008