1 / 35

Your chance to review

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.

meris
Télécharger la présentation

Your chance to review

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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. • Suppose the goal state is 11. List the order in which nodes will be visited for breadth-first and depth-first searches.

  2. Solution • Breadth First • 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11 • Depth First • Trick Question • 1, 2, 4, 8, 16, 32, ….

  3. Properties of Depth-first Search • Complete??

  4. 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

  5. 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??

  6. 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.

  7. 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??

  8. 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

  9. 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??

  10. 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!

  11. Properties of Breadth-First Search • Complete??

  12. Properties of Breadth-First Search • Complete?? Yes (if b is finite)

  13. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • Optimal??

  14. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • Optimal?? Yes (if cost = 1 per step); not optimal in general

  15. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • Optimal?? Yes (if cost = 1 per step); not optimal in general • Time??

  16. Properties of Breadth-First 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

  17. Properties of Breadth-First 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??

  18. Properties of Breadth-First 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)

  19. Properties of Breadth-First 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.

  20. 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

  21. Questions?

  22. Uninformed Search Strategies • Uninformed strategies use only information available in the problem definition • Breadth-first search • Uniform-cost search • Depth-first search • Depth-limited search • Iterative deepening search

  23. Properties of Breadth-First 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.

  24. Properties of Breadth-First 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.

  25. Problem Solving Agents

  26. Uniform-cost Search • Expand least-cost unexpanded node • Implementation: • fringe = queue ordered by path cost • Equivalent to breadth-first if step costs all equal

  27. Problem Solving Agents

  28. 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??

  29. 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 

  30. 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??

  31. 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)

  32. 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??

  33. 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

  34. 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??

  35. 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*/)

More Related