1 / 24

Implementation: General Tree Search

Implementation: General Tree Search. Single-State Problem Formulation. A problem is defined by four items: initial state successor function (which actually defines all reachable states) goal test path cost (additive). Your chance to review. initial state Si = 1 successor function

Download Presentation

Implementation: General Tree Search

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. Implementation: General Tree Search

  2. Single-State Problem Formulation • A problem is defined by four items: • initial state • successor function (which actually defines all reachable states) • goal test • path cost (additive)

  3. Your chance to review • initial state • Si = 1 • successor function • f(s) = 2s , f(s) = 2s+1 • goal test • Sg = 11 • path cost • Each transition costs one unit

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

  5. Solution • Breadth First • 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11

  6. Search Strategies • A strategy is defined by picking the order of node expansion • 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 optimality – does it always find a least-cost solution

  7. Search Strategies • Time and space complexity are measured in terms of b – maximum branching factor of the search treed – depth of the least-cost solutionm – maximum depth of the state space (may be infinite)

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

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

  10. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • Time?? 1 + b + b2 + b3 + … + bd + b(bd – 1)= O( bd+1 ), ie, exp. in d • Space??

  11. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • 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) • Optimal??

  12. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • 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) • Optimal?? Yes (if cost = 1 per step); not optimal in general • Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.

  13. 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 depth-first search.

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

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

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

  17. 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 dbut if solutions are dense, may be much faster than breadth-first • Space??

  18. 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 dbut if solutions are dense, may be much faster than breadth-first • Space?? O(bm), i.e., linear space! • Optimal??

  19. 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 dbut if solutions are dense, may be much faster than breadth-first • Space?? O(bm), I.e., linear space! • Optimal?? No.

  20. Implementation: General Tree Search

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

  22. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • 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) • Optimal?? Yes (if cost = 1 per step); not optimal in general • Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.

  23. Properties of Breadth-First Search • Complete?? Yes (if b is finite) • 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) • Optimal?? Yes (if cost = 1 per step); not optimal in general • Space is the big problem: can easily generate nodes at 10MB/sec, so 24hours = 860GB.

  24. Problem Solving Agents

More Related