Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementation: General Tree Search

Similar presentations


Presentation on theme: "Implementation: General Tree Search"— 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 successor function goal test
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 tree d – depth of the least-cost solution m – 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 Depth First 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11
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 d but 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 d but 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 d but 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


Download ppt "Implementation: General Tree Search"

Similar presentations


Ads by Google