Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;

Similar presentations


Presentation on theme: "1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;"— Presentation transcript:

1 1 Solving problems by searching Chapter 3

2 Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root; then the left child of this node, etc. until a leaf is found. At a leaf, backtrack to the lowest right child and repeat. Does not have to keep all nodes on the open list, only retains the children of a single state May get stuck in a deep search space Implementation : Fringe = LIFO queue, i.e., put successors at front 2

3 Depth-first Search Algorithm 3

4 4 Depth-first search

5 5

6 6

7 7

8 8

9 9

10 10 Depth-first search

11 Depth-first Search 11 Complete? No: fails in infinite-depth spaces, spaces with loops  complete in finite spaces Time? O(b m ): terrible if m is much larger than d where m is maximum depth of any node, d is depth of the least-cost solution but if solutions are dense, may be much faster than breadth-first Space? O(bm), i.e., linear space! where b is maximum branching factor of the search tree Optimal? No

12 12 Depth-first search of 8-puzzle with a depth bound of 5

13 Depth Limited Search 13 Depth-limit for search is set at depth (level) l. Nodes at depth (level) l have no successors in the search tree. It is not optimal. It is complete if d < l. It has time complexity of O(b l ). But space complexity is only O(bl).

14 Depth Limited Search 14

15 15 Iterative Deepening Search Combines the benefits of depth-first and breadth-first search. It is complete and optimal. It has time complexity of O(b d ). But space complexity is only O(bd).

16 16 Iterative deepening search l =0

17 17 Iterative deepening search l =1

18 18 Iterative deepening search l =2

19 19 Iterative deepening search l =3

20 20 Iterative Deepening: Efficiency Iterative deepening looks inefficient because so many states are expanded multiple times. In practice this is not that bad, because by far most of the nodes are at the bottom level. For a branching factor b of 2, this might double the search time. For a branching factor b of 10, this might add 10% to the search time.

21 21 Properties of iterative deepening search Complete? Yes Time? (d+1)b 0 + d b 1 + (d-1)b 2 + … + b d = O(b d ) Space? O(bd) Optimal? Yes

22 Summary of algorithms Example : http://www.cs.rochester.edu/u/kautz/Mazes/ search/applet.html 22


Download ppt "1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;"

Similar presentations


Ads by Google