AIML Lec-4-6
AIML Lec-4-6
Formulate problem:
⚫ states: various cities
⚫ actions: drive between cities
Find solution:
⚫ sequence of cities, e.g., Arad, Sibiu, Fagaras,
Bucharest
Travelling in Romania
Start State
Goal State
Problem Formulation
Basic idea:
State Space:
S = start, G = goal, other nodes = intermediate states, links = legal transitions
A B C
S G
D E F
BFS Search Tree
A B C
S G
S
D E F
Queue = {S}
Select S
Goal(S) = true?
If not, Expand(S)
BFS Search Tree
A B C
S G
S
D E F
A D
Queue = {A, D}
Select A
Goal(A) = true?
If not, Expand(A)
BFS Search Tree
A B C
S G
S
D E F
A D
B D Queue = {D, B, D}
Select D
Goal(D) = true?
If not, expand(D)
BFS Search Tree
A B C
S G
S
D E F
A D
B D A E Queue = {B, D, A, E}
Select B
etc.
BFS Search Tree
A B C
S G
S
D E F
A D
B D A E
C E S E S B B F
Level 3
Queue = {C, E, S, E, S, B, B, F}
BFS Search Tree
A B C
S G
S
D E F
A D
B D A E
C E S E S B B F
D F A B F D C E A C G
Level 4
Expand queue until G is at front
Select G
Goal(G) = true
Breadth-first search
Time Complexity
Space Complexity
Time Complexity
Space Complexity
Limit = 1
While no solution, do
⚫ DFS from initial state ‘S’ with cutoff Limit
⚫ If found goal,
• stop and return solution
⚫ else
• increment cutoff
Iterative-Deepening Example
Iterative-Deepening Example
Iterative-Deepening Example
Iterative-Deepening Example
Bi-directional Search
Idea
Complexity