Professional Documents
Culture Documents
Uninformed Search: Dr. Humera Farooq
Uninformed Search: Dr. Humera Farooq
Uninformed Search
Dr. Humera Farooq
A B C
9 4 6 2
6 G 1
D E goal F
9 4 6 2
6 G 1
D E goal F
A B C
9 4 6 2
6 G 1
D E goal F
9 4 6 2
6 G 1
D E goal F
Remember:
b = branching factor
m = max depth of search tree
© Tariq 2017 Department of Computer Science | Bahria University 26
Uniform-Cost Search (UCS)
27
© Tariq 2017 Department of Computer Science | Bahria University 27
Uniform-Cost Search (UCS)
generalSearch(problem, priorityQueue)
S
# of nodes tested: 0, expanded: 0 start
expnd. node Frontier list
{S} 5 2 4
A B C
9 4 6 2
6 G 1
D E goal F
9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 1, # of nodes expanded: 0, tested: 0 start
expnd. node Frontier
{S} 5 2 4
A B C
9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 1, # of nodes tested: 1, expanded: 1 start
expnd. node Frontier
{S} 5 2 4
S not goal {A,B,C}
A B C
9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 1, # of nodes tested: 2, expanded: 1 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A not goal {B,C} no expand A B C
9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 1, # of nodes tested: 3, expanded: 1 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B not goal {C} no expand
9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 1, # of nodes tested: 4, expanded: 1 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C not goal { } no expand-FAIL 9 4 6 2
6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 2, # of nodes tested: 4(1), expanded: 2 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C {} 9 4 6 2
S no test {A,B,C} 6 G 1
D E goal F
deepeningSearch(problem)
S
depth: 2, # of nodes tested: 4(2), expanded: 3 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C {} 9 4 6 2
S {A,B,C} 6 G 1
D E goal F
A no test {D,E,B,C}
7
deepeningSearch(problem)
S
depth: 2, # of nodes tested: 5(2), expanded: 3 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C {} 9 4 6 2
S {A,B,C} 6 G 1
D E goal F
A {D,E,B,C}
D not goal {E,B,C} no expand 7
deepeningSearch(problem)
S
depth: 2, # of nodes tested: 6(2), expanded: 3 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C {} 9 4 6 2
S {A,B,C} 6 G 1
D E goal F
A {D,E,B,C}
D {E,B,C} 7
E not goal {B,C} no expand
H
deepeningSearch(problem)
S
depth: 2, # of nodes tested: 6(3), expanded: 4 start
expnd. node Frontier
{S} 5 2 4
S {A,B,C}
A {B,C} A B C
B {C}
C {} 9 4 6 2
S {A,B,C} 6 G 1
D E goal F
A {D,E,B,C}
D {E,B,C} 7
E {B,C}
B no test {G,C} H
Limit = 0 A
Limit = 1 B C D E
Limit = 2 F G H I J
K L M N
B C D E
Limit = 2
B C D E
Limit = 2 F G
B C D E
Limit = 2 F G
B C D E
Limit = 2 F G
B C D E
Limit = 2 F G H
B C D E
Limit = 2 F G H
B C D E
Limit = 2 F G H I J
B C D E
Limit = 2 F G H I J
Limit = 2 F G H I J
Limit = 2 F G H I J
Limit = 2 F G H I J
B C D E
Limit = 2 F G H I J
K L M N
Start Goal
d/2
• Optimality: Yes