Presentation is loading. Please wait.

Presentation is loading. Please wait.

Iterative Deepening Search Introduction to AI. Iterative deepening search The problem with depth-limited search is deciding on a suitable depth parameter.

Similar presentations


Presentation on theme: "Iterative Deepening Search Introduction to AI. Iterative deepening search The problem with depth-limited search is deciding on a suitable depth parameter."— Presentation transcript:

1 Iterative Deepening Search Introduction to AI

2 Iterative deepening search The problem with depth-limited search is deciding on a suitable depth parameter. To avoid this problem there is another search called iterative deepening search (IDS). This search method tries all possible depth limits; first 0, then 1, then 2 etc., until a solution is found. IDS may seem wasteful as it is expanding nodes multiple times. But the overhead is small in comparison to the growth of an exponential search tree For large search spaces where is the depth of the solution is not known IDS is normally the preferred search method. The following slide illustrates an iterative deepening search of 26 nodes (states) with an initial state of node A and a goal state of node L. Press space to see the example node set.

3 A CDEFB GHIJKLMNOP QRSTUVWXYZ The example node set Initial state Goal state A L Press space to see a IDS of the example node set

4 AA We begin with our initial state: the node labeled A. This node is added to the queue. Press space to continue Size of Queue: 0 Nodes expanded: 0Current Action: ExpandingCurrent level: n/a Queue: EmptyQueue: ASize of Queue: 1 Current level: 0Nodes expanded: 1 Queue: EmptySize of Queue: 0 Press space to begin the search As this is the 0 th iteration of the search, we cannot search past any level greater than zero. This iteration now ends, and we begin the 1 st iteration. ITERATIVE DEEPENING SEARCH PATTERN (0 th ITERATION) Node A is then expanded and removed from the queue. Press space.

5 A CDEFB A BCD We again begin with our initial state: the node labeled A. Note that the 1 st iteration carries on from the 0 th, and therefore the ‘nodes expanded’ value is already set to 1. Press space to continue Node A is expanded, then removed from the queue, and the revealed nodes are added to the front. Press space. The search now moves to level one of the node set. Press space to continue Node B is expanded and removed from the queue. Press space. Size of Queue: 0 Nodes expanded: 1Current Action:Current level: n/a Queue: EmptyQueue: ASize of Queue: 1 Nodes expanded: 2 Queue: B, C, D, E, F Press space to begin the search Size of Queue: 5 Current level: 0Current Action: Expanding Queue: C, D, E, FSize of Queue: 4 Nodes expanded: 3Current level: 1Current Action: BacktrackingCurrent level: 0Current level: 1 Queue: D, E, FSize of Queue: 3 Nodes expanded: 4Current Action: ExpandingCurrent Action: BacktrackingCurrent level: 0Current level: 1 Queue: E, FSize of Queue: 2 Nodes expanded: 5Current Action: ExpandingCurrent Action: BacktrackingCurrent level: 0Current level: 1Current Action: Expanding Queue: F E Current Action: BacktrackingCurrent level: 0Current Action: ExpandingCurrent level: 1 Queue: Empty F Current level: 0Current level: 1 Press space to continue the search ITERATIVE DEEPENING SEARCH PATTERN (1 st ITERATION) Size of Queue: 1Size of Queue: 0 As this is the 1 st iteration of the search, we cannot search past any level greater than level one. This iteration now ends, and we begin a 2 nd iteration. Nodes expanded: 6Nodes expanded: 7 We now back track to expand node C, and the process continues. Press space.

6 A CDEFB GHIJKL A B G We again begin with our initial state: the node labeled A. Note that the 2 nd iteration carries on from the 1 st, and therefore the ‘nodes expanded’ value is already set to 7 (1+6). Press space to continue the search Again, we expand node A to reveal the level one nodes. Press space. Node A is removed from the queue and each revealed node is added to the front of the queue. Press space. The search then moves to level one of the node set. Press space to continue Node B is expanded and the revealed nodes added to the front of the queue. Press space to continue. Size of Queue: 0 Nodes expanded: 7Current Action:Current level: n/a Queue: EmptyQueue: ASize of Queue: 1 Current level: 0Nodes expanded: 8 Queue: B, C, D, E, F Current level: 1 Queue: G, H, C, D, E, F Nodes expanded: 9Current level: 2 ITERATIVE DEEPENING SEARCH PATTERN (2 nd ITERATION) Size of Queue: 5 Current Action: Expanding We now move to level two of the node set. Press space to continue. After expanding node G we backtrack to expand node H. The process then continues until goal state. Press space Queue: H, C, D, E, F Nodes expanded: 10Current Action: BacktrackingCurrent Action: Expanding Queue: C, D, E, FSize of Queue: 6 Nodes expanded: 11 H Press space to continue the search Size of Queue: 5Size of Queue: 4 Current Action: BacktrackingCurrent Action: Expanding Queue: I, J, D, E, FSize of Queue: 5 Nodes expanded: 12 Press space to continue the search C Current level: 1Current level: 2Current level: 1Current level: 0Current level: 1Current level: 2 Queue: J, D, E, FSize of Queue: 4 Nodes expanded: 13 I Press space to continue the search Current Action: BacktrackingCurrent level: 1Current level: 2 Queue: D, E, F Current Action: Expanding Size of Queue: 3 Nodes expanded: 14 J Press space to continue the search Current Action: BacktrackingCurrent level: 1Current level: 0Current level: 1Current Action: Expanding Queue: K, L, E, FSize of Queue: 4 Nodes expanded: 15 D Press space to continue the search Current level: 2 Queue: L, E, FSize of Queue: 3 Nodes expanded: 16 K Press space to continue the search Current Action: ExpandingCurrent level: 1Current level: 2 LLLLL Current Action: Backtracking Queue: EmptySize of Queue: 0 Node L is located on the second level and the search returns a solution on its second iteration. Press space to end. SEARCH FINISHED


Download ppt "Iterative Deepening Search Introduction to AI. Iterative deepening search The problem with depth-limited search is deciding on a suitable depth parameter."

Similar presentations


Ads by Google