Artificial Intelligence (CS 370D) Princess Noura bint Abdulrahman University College of Computer and Information Sciences Artificial Intelligence (CS 370D) Informed Search Algorithms ( examples) L. Maram ALShablan
Examples Greedy Algorithm A* Algorithm L. Maram ALShablan
Example 1: Implement the greedy algorithm on the following figure, then write the its solution path. Solution path: Start ACGOAL Path cost : 8 L. Maram ALShablan
Example 1: Implement A* algorithm on the following figure, then write the its solution path. Start A F(A)=2+3=5 B C F(B)=3+2=5 F(C)=6+1=7 F(C)=4+1=5 C Goal F(Goal)=6+0=6 Solution path: Start ABCGOAL L. Maram ALShablan Path cost : 6
Example 2: Implement the greedy algorithm on the following figure, then write the its solution path. Solution path: A C D E G 1 3 2 1 Path cost : 7 Greedy is not suitable Not optimal L. Maram ALShablan
Example 2: Implement the A Example 2: Implement the A* algorithm on the following figure, then write the its solution path. A F(A)=0+2=2 C B F(B)=2+4=6 F(C)=1+2=3 D F(D)=3+1=4 D F(D)=4+1=5 Solution path: ABDEG F E F(E)=6+1=7 F(F)=5+1=6 F E F(E)=5+1=6 F(F)=4+1=5 Path cost : 6 G F(G)=7+0=7 G F(G)=8+0=8 G F(G)=6+0=6 G F(G)=7+0=7 L. Maram ALShablan