1 / 35

# Your chance to review - PowerPoint PPT Presentation

Your chance to review. Consider a state space where the start state is number 1 and the successor function for state n returns two states, numbers 2n and 2n+1. Draw the portion of the state space for states 1 to 15.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
• Consider a state space where the start state is number 1 and the successor function for state n returns two states, numbers 2n and 2n+1.
• Draw the portion of the state space for states 1 to 15.
• Suppose the goal state is 11. List the order in which nodes will be visited for breadth-first and depth-first searches.
Solution
• 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11
• Depth First
• Trick Question
• 1, 2, 4, 8, 16, 32, ….
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
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
• Optimal??
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
• Optimal?? No.
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
• Optimal?? No.
• Time??
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
• Optimal?? No.
• Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first
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
• Optimal?? No.
• Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first
• Space??
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
• Optimal?? No.
• Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first
• Space?? O(bm), I.e., linear space!
• Complete?? Yes (if b is finite)
• Complete?? Yes (if b is finite)
• Optimal??
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time??
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Space??
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Space?? O( bd+1 ) (keep every node in memory)
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Space?? O( bd+1 ) (keep every node in memory)
• Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.
Comparing bfs and dfs
• bfs is preferred if
• The branching factor is not too large (hence memory costs)
• A solution appears at a relatively shallow level
• No path is excessively deep
• dfs is preferred if
• The Tree is deep
• The branching factor is not excessive
• Solutions occur deeply in the tree
Uninformed Search Strategies
• Uninformed strategies use only information available in the problem definition
• Uniform-cost search
• Depth-first search
• Depth-limited search
• Iterative deepening search
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Space?? O( bd+1 ) (keep every node in memory)
• Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.
• Complete?? Yes (if b is finite)
• Optimal?? Yes (if cost = 1 per step); not optimal in general
• Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d
• Space?? O( bd+1 ) (keep every node in memory)
• Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.
Uniform-cost Search
• Expand least-cost unexpanded node
• Implementation:
• fringe = queue ordered by path cost
• Equivalent to breadth-first if step costs all equal
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??
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 
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 
• Optimal??
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 
• Optimal?? Yes – nodes expanded in increasing order of g(n)
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 
• Optimal?? Yes – nodes expanded in increasing order of g(n)
• Time??
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 
• Optimal?? Yes – nodes expanded in increasing order of g(n)
• Time?? # of nodes with g  cost of optimal solution, O(b C*/) where C* is cost of optimal solution
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 
• Optimal?? Yes – nodes expanded in increasing order of g(n)
• Time?? # of nodes with g  cost of optimal solution, O(b C*/) where C* is cost of optimal solution
• Space??
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 
• Optimal?? Yes – nodes expanded in increasing order of g(n)
• Time?? # of nodes with g  cost of optimal solution, O(b C*/) where C* is cost of optimal solution
• Space?? # of nodes with g  cost of optimal solution, O(b C*/)