Iterative Deepening Search
Ashis Kumar Chanda
Department of Computer Science and Engineering
University of Dhaka
Topics
• Introduction
• Searching Methods
• Iterative Deepening Search
• Properties
• Analysis
• Summary
CSE, DU
Introduction
• Search an item in Graph
CSE, DU
Air flight system
• Each city represents a vertex
• Each direct flight represents an edge
Graph
• A well recognized tool in modeling problems
• Consist of:
– Vertices can be considered locations.
– Edges represent connections connections.
CSE, DU
D
E
A
C
F
B
Vertex
Edge
Graph Representation
• How will we represent a graph in computer?
1. Adjacency Matrix
2. Use a 2D matrix to represent the
graph
3. Adjacency List
4. Use a 1D array of linked lists
5CSE, DU
Adjacency Matrix
A[i][j] = 1 if there is an edge connecting vertices i,j
A[i][j] = 0 otherwise
6CSE, DU
Adjacency List
The adjacency list is an array A[0..n-1] of lists,
where n is the number of vertices in the graph
7CSE, DU
Searching Methods
• Most common methods
– Breadth First Search (BFS)
– Depth First Search (DFS)
CSE, DU
Breadth-first search
• Span search area in each level
• FIFO structure (queue)
9CSE, DU
Depth-first search
• Move at depth, start search and then return at back
• LIFO structure (Stack)
10CSE, DU
Any New Idea?
• What's wrong with DFS?
CSE, DU
Iterative Deepening Search
DFS can move into an infinite loop
DFS is neither complete nor optimal
Iterative Deepening Search
• IDS is similar to DFS
• Depth is not known
• increasing the depth limit with each iteration
until it reaches d, the depth of the goal state
CSE, DU
Iterative deepening search l =0
13CSE, DU
Iterative deepening search l =1
14CSE, DU
Iterative deepening search l =2
15CSE, DU
Iterative deepening search l =3
Pseudo-code
CSE, DU
Input: Graph root, goal
Output: solution or failure
IDS(root, goal)
{
for(i=0 to infinite)
{
DLS(root, goal, depth=i)
}
}
depth-limited DFS (called DLS);
Properties
where b is the branching factor and d is the depth of goal
CSE, DU
Criteria Properties of IDF
Complete search Yes
Required Time O(bd )
Memory Space O(bd)
Optimal Solution Yes
Analysis
• Applicable when there is a large search space
and depth is not known
• The main advantage of IDS in game tree
searching
• IDS combines depth first search’s space
efficiency and breadth first search’s complete
-ness
CSE, DU
Practice Problem
• Show each steps to find node F from the
source node Y using BFS, DFS, IDS
CSE, DU
Summary
• Representation of Graph model
• Searching model BFS, DFS
• Iterative Deepening Search Model is
combination of BFS, DFS
• Better than DFS and needs less space than BFS
CSE, DU
About Me
• Research Topics:
- Flexible Periodic Pattern Mining
- Closed Frequent Pattern Mining
• ML course of Stanford University
• Won several Software Contests
• Solve Hundreds ACM problem
CSE, DU
Story writing Code Rage Badge
www.chandacse.blogspot.com
References
CSE, DU
- Artificial Intelligence a Modern Approach
by Russell and Norvig
- Introduction to Algorithm by Cormen
- Fundamentals of Computer Algorithms by
Ellis; Sahni, Sartaj Horowitz
- http://en.wikipedia.org/wiki/Iterative_deepening_depth-
- http://artint.info/html/ArtInt_62.html
- http://will.thimbleby.net/algorithms/doku.php?id=iterati

Iterative deepening search

  • 1.
    Iterative Deepening Search AshisKumar Chanda Department of Computer Science and Engineering University of Dhaka
  • 2.
    Topics • Introduction • SearchingMethods • Iterative Deepening Search • Properties • Analysis • Summary CSE, DU
  • 3.
    Introduction • Search anitem in Graph CSE, DU Air flight system • Each city represents a vertex • Each direct flight represents an edge
  • 4.
    Graph • A wellrecognized tool in modeling problems • Consist of: – Vertices can be considered locations. – Edges represent connections connections. CSE, DU D E A C F B Vertex Edge
  • 5.
    Graph Representation • Howwill we represent a graph in computer? 1. Adjacency Matrix 2. Use a 2D matrix to represent the graph 3. Adjacency List 4. Use a 1D array of linked lists 5CSE, DU
  • 6.
    Adjacency Matrix A[i][j] =1 if there is an edge connecting vertices i,j A[i][j] = 0 otherwise 6CSE, DU
  • 7.
    Adjacency List The adjacencylist is an array A[0..n-1] of lists, where n is the number of vertices in the graph 7CSE, DU
  • 8.
    Searching Methods • Mostcommon methods – Breadth First Search (BFS) – Depth First Search (DFS) CSE, DU
  • 9.
    Breadth-first search • Spansearch area in each level • FIFO structure (queue) 9CSE, DU
  • 10.
    Depth-first search • Moveat depth, start search and then return at back • LIFO structure (Stack) 10CSE, DU
  • 11.
    Any New Idea? •What's wrong with DFS? CSE, DU Iterative Deepening Search DFS can move into an infinite loop DFS is neither complete nor optimal
  • 12.
    Iterative Deepening Search •IDS is similar to DFS • Depth is not known • increasing the depth limit with each iteration until it reaches d, the depth of the goal state CSE, DU
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
    Pseudo-code CSE, DU Input: Graphroot, goal Output: solution or failure IDS(root, goal) { for(i=0 to infinite) { DLS(root, goal, depth=i) } } depth-limited DFS (called DLS);
  • 18.
    Properties where b isthe branching factor and d is the depth of goal CSE, DU Criteria Properties of IDF Complete search Yes Required Time O(bd ) Memory Space O(bd) Optimal Solution Yes
  • 19.
    Analysis • Applicable whenthere is a large search space and depth is not known • The main advantage of IDS in game tree searching • IDS combines depth first search’s space efficiency and breadth first search’s complete -ness CSE, DU
  • 20.
    Practice Problem • Showeach steps to find node F from the source node Y using BFS, DFS, IDS CSE, DU
  • 21.
    Summary • Representation ofGraph model • Searching model BFS, DFS • Iterative Deepening Search Model is combination of BFS, DFS • Better than DFS and needs less space than BFS CSE, DU
  • 22.
    About Me • ResearchTopics: - Flexible Periodic Pattern Mining - Closed Frequent Pattern Mining • ML course of Stanford University • Won several Software Contests • Solve Hundreds ACM problem CSE, DU Story writing Code Rage Badge www.chandacse.blogspot.com
  • 23.
    References CSE, DU - ArtificialIntelligence a Modern Approach by Russell and Norvig - Introduction to Algorithm by Cormen - Fundamentals of Computer Algorithms by Ellis; Sahni, Sartaj Horowitz - http://en.wikipedia.org/wiki/Iterative_deepening_depth- - http://artint.info/html/ArtInt_62.html - http://will.thimbleby.net/algorithms/doku.php?id=iterati

Editor's Notes

  • #2 <number>
  • #6 <number>
  • #7 <number>
  • #8 <number>
  • #12 More traverse, infinite loop, if two solution then may can’t find optimal <number>
  • #18 <number>
  • #20 Suppose, in chess game we need to know what will be next step of opponent <number>