0% found this document useful (0 votes)
36 views9 pages

AI Lec 6

Uploaded by

jaxala3388
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views9 pages

AI Lec 6

Uploaded by

jaxala3388
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

Searching in AI

Lecture no:06
Sobia Shafiq
A* Search
• Informed search algorithm

• f(n)= g(n) + h(n)


• f(n) = total cost
• g(n)= Actual cost from start node to n
• h(n)= estimation of cost from n to goal node

• A* always provide optimal solution


A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 0, expanded: 0 h=8
expnd. Frontier
node 1 5 8
{S:0+8} A B C
h=8 h=4 h=3

3 7 9 4 5
D E G
h=∞ h=∞ h=0
A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 1, expanded: 1 h=8
expnd. Frontier
node 1 5 8
{S:8} A B C
S not goal {A:1+8,B:5+4,C:8+3} h=8 h=4 h=3

3 7 9 4 5
D E G
h=∞ h=∞ h=0
A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 2, expanded: 2 h=8
expnd. Frontier
node 1 5 8
{S:8} A B C
S {A:9,B:9,C:11} h=8 h=4 h=3
A not goal {B:9,G:1+9+0,C:11,
3 7 9 4 5
D:1+3+∞,E:1+7+∞}
D E G
h=∞ h=∞ h=0
A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 3, expanded: 3 h=8
expnd. Frontier
node 1 5 8
{S:8} A B C
S {A:9,B:9,C:11} h=8 h=4 h=3
A {B:9,G:10,C:11,D:∞,E:∞} 3 7 9 4 5
B not goal {G:5+4+0,G:10,C:11,
D E G
D:∞,E:∞} replace h=∞ h=∞ h=0
A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 4, expanded: 3 h=8
expnd. Frontier
node 1 5 8
{S:8} A B C
S {A:9,B:9,C:11} h=8 h=4 h=3
A {B:9,G:10,C:11,D:∞,E:∞} 3 7 9 4 5
B {G:9,C:11,D:∞,E:∞} D E G
G goal {C:11,D:∞,E:∞} h=∞ h=∞ h=0
not expanded
A* Search

f(n) = g(n) + h(n)


S
# of nodes tested: 4, expanded: 3 h=8
expnd. Frontier
node 1 5 8
{S:8} A B C
S {A:9,B:9,C:11} h=8 h=4 h=3
A {B:9,G:10,C:11,D:∞,E:∞} 3 7 9 4 5
B {G:9,C:11,D:∞,E:∞} D E G
G {C:11,D:∞,E:∞} h=∞ h=∞ h=0

 Pretty fast and optimal path: S,B,G


cost: 9
Visualizing Search Methods
 http://qiao.github.io/PathFinding.js/visual/

You might also like