Docsity

Answer for Assignment 1 on Artificial Intelligence | COSC 6368, Assignments of Computer Science

Toggle sidebar
bg1
COSC 6368 Artificial Intelligence Fall 2004
Answer for Assignment1
Problem 2 ----Using Various Search Techniques
Adjacent List of above graph:
S: A, B
A: C, D
B: E, G2
C: D, S
D: B, G1
E: G2
G1: C, D
G2: B
Breadth-First Search
a) Goal State: G2
b) States expanded: S, A, B, C, D, E
c) Open and close list during breadth search
Step 0 1 2 3
Open List {s} {A, B} {B, C, D} {C, D, E, G2}
Close List Empty {S} {S, A} {S, A, B}
Step 4 5 6 7
Open List {D, E, G2} {E, G2, G1} {G2, G1} {G1}
Close List {S, A, B, C} {S, A, B, C, D} {S, A, B, C, D,
E}
{S, A, B, C, D,
E}
1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Answer for Assignment 1 on Artificial Intelligence | COSC 6368 and more Assignments Computer Science in PDF only on Docsity!

COSC 6368 Artificial Intelligence Fall 2004

Answer for Assignment

Problem 2 ----Using Various Search Techniques

Adjacent List of above graph: S: A, B A: C, D B: E, G C: D, S D: B, G E: G G1: C, D G2: B Breadth-First Search a) Goal State: G b) States expanded: S, A, B, C, D, E c) Open and close list during breadth search Step 0 1 2 3 Open List {s} {A, B} {B, C, D} {C, D, E, G2} Close List Empty {S} {S, A} {S, A, B} Step 4 5 6 7 Open List {D, E, G2} {E, G2, G1} {G2, G1} {G1} Close List {S, A, B, C} {S, A, B, C, D} {S, A, B, C, D, E}

{S, A, B, C, D,

E}

Depth-First Search a) Goal State: G b) State Expanded: S, A, C, D c) Open and Close List during depth-first search Step 0 1 2 3 4 5 Open List {s} {A, B} {C, D, B} {D, B} {G1, B} {B} Close List Empty {S} {S, A} {S, A, C} {S, A, C, D} {S, A, C, D} Best-First Search a) Goal State: G b) States Expanded: S, A, D Open List Close List Initial State {S} Empty After Expanding S {A, B} {S} After Expanding A {D, C, B} {S, A} After Expanding D {G1, C, B}

{S, A, D}

After return goal state

{C, B} {S, A, D}

A*

S 10 S 10 A 5 B 8 S 10 A 5 B 8 C 3 D 2 S 10 A 5 B 8 C 3 D 2 G 0 B 8

Expanding D B(20), G1(14), B(19), S, B(15)}

D(10),

D(11)}

After return goal state

{ G1(15),

B(20),

B(19), S,

B(15)}

{S, A, C,

D(10),

D(11)}

RBFS(using f=g+h) The search tree for RBFS search (Goal state is G1): (1). After expanding S, A, C, D : ∞ 7 3 15 6 1 11 4 2 11 6 3 (2). After unwinding back to A and expanding D D 11 G1 14 16 B 19 B^ G1 15 20 S 10 B 15=7+ A5 8=3+ D 11=3+6+ C3 7=3+1+ D 10=3+1+4+ S 16=3+1+2+ G1 0 14=3+1+4+ B 19=3+1+4+3+

∞ 7 3 15 1 6 14 6 3 (3). After switching back to C and expanding D. This time, because the best alternative path (through D or B) is 15, this expansion continues to G1. ∞ 7 3 15 6 1 15 4 2 15 6 3 15 SMA with open list is 3* a) Goal State: G b) Expanded State: S, A, C, D, D S 10 B 15=7+ A5 8=3+ C3 (^14) D 11=3+6+ G1 0 15=3+6+6 B 20=3+6+8+ S 10 B 15=7+ A5 8=3+ D2 (^15) C 14 D 10=3+1+4+ S 16=3+1+2+ G1 0 14=3+1+4+ B 19=3+1+4+3+

B(19)}

change to {G1(15), B(20), G1(14)} After return goal state

{G1(15),

B(20)}

{S, A, C,

D(10),

D(11)}

Problem 3 --- Compare RBFS and A*

Compare RBFS and A. What are the main differences between the two algorithms? What are the weaknesses of each algorithm? Illustrate your claims by giving a particular example run of the particular algorithm that shows its weakness, if feasible. [ANSWER] RBFS and A main differences are as followings: A:* A* Expands nodes based on the f-value evaluation and keeps all the visited leaf nodes and their f-values; A* keeps all generated nodes in memory; RBFS: RBFS remembers the f-value of the best alternative path available form any ancestor of the current node. If the current node exceeds this limit, the recursion unwinds back to the alternative path. As recursion unwinds, RBFS replaced the f-value of each node along the path with the best f-value of its children; RBFS remembers only the f-value of the best leaf in the forgotten subtree; RBFS search uses only linear space , which is much less than A* search; RBFS will re-expand and re-generate the same the nodes. Example: Figure 4.3 page 98 of Textbook and Figure 4.6 page 102 of Textbook Weakness of RBFS:

  1. RBFS suffers from excessive node regeneration and redundant work. D 11 G1 14 16 B 19 B^ G1 15 20

Example: Figure 4.6 Textbook page 102. In step a) the algorithm expand the node “Rimnicu Vilcea”, and forget the nodes under “Rimnicu Vilcea” in step b). In step c) the algorithm need to expand the node “Rimnicu Vilcea” again.

  1. RBFS algorithm is subject to the potentially exponential increase in runtime complexity associated with searching on graphs, because it can not check for repeat states other than those on the current path. Example: Figure 4.6 Textbook page 102. When expanding “Sibiu”, start node “Arad” still need to be considered. When expanding nodes, all the connecting nodes are need to be considered. Therefore, if nodes number increase, the running time of RBFS will increases exponentially. Weakness of A:* A* keeps all generated nodes in memory. So, it usually runs out of space long before that it runs out of time. For most problems, the number of nodes within the goal search space is still exponential in the length of the solution. For that reason, A* is not practical for large-scale problems. Example: Figure 4.3 Page 98 of Textbook, if there are more nodes were added in the graph, the number of nodes needed to keep will increase exponentially.

Problem 4: A* Termination

Algorithm A* does not terminate until a goal node is selected for expansion. However, a path to a goal node might be reached long before that node is selected for expansion. Why not terminating as soon as the goal node is found? Illustrate your answer with an example! [ANSWER] When a goal node is reached along a path, the f-value of this goal state might not be the optimal. Until a goal node is selected for expansion, the f-value of this goal state is optimal. Example: Figure 4.3 page 98 of Textbook In step e), the goal node “Bucharest” is already reached, but its f-value is 450, which is not optimal. Until step f), the goal node “Bucharest” is selected to be expanded, the optimal f-value 418 is found and the algorithm terminate.