Professional Documents
Culture Documents
Cos3751 201 2 2013 PDF
Cos3751 201 2 2013 PDF
the state at node n to a goal state. It is used to sort the nodes in the frontier, which
is a priority queue. Whenever a node is added to the frontier, the cost of reaching
the goal from this node is estimated using the evaluation function and the node is
then inserted into the queue (frontier) at a position that leaves the queue sorted
on estimate costs after the insertion has completed. In the greedy best-first search
algorithm below, the underlined statements indicate where the evaluation
function comes into play.
(3.10) Consider figure 7 and table 5 and answer the questions that follow. The table provides
the estimated distances from each node to N.
A
7 3
B D 2
F C I
L
3
G K
5
H
M E
1
N
Figure 7: A* search
G 4
H 6
I 4
K 2
L 1
M 1
N 0
7 3
7
10
7
6
4
10
8
8
5
4
5
2
5
5
3
1
1
7 3
8
7
8
5
5
1
(a) List the nodes in the order in which they are expanded (not generated).
Expanding a node means that you remove it from the frontier, add its state to the
explored set, and finally generating and adding all its successors, which meat
specific criteria, to the frontier. So, according to this definition, the goal node (in
this case N) is never expanded, since, the GOAL-TEST is done directly after the node
is removed from the frontier (its state is not added to the explored set, nor is its
children, if any, generated). Thus, the order in which the nodes are expanded is as
follows:
A D K L M (N is POPed from the frontier, but technically not expanded).
The sequence of diagrams above graphically depicts the search process.
(b) Write down the content of the frontier at the time the search terminates.
The contents of the frontier at the time the search terminates is as follows: I use
the syntax n(f,g,h) to represent frontier elements, where n is the label of the node,
f is the corresponding f-cost of n (sum of g and h), g is the path-cost of getting from
the start node (A) to n, and h is the cost-estimate of the cheapest path to the goal
from n.
C(12,8,4), I(14,10,4), E(16,12,4), B(19,7,12)
(d) Explain why the search algorithm does not get stuck in loops when one considers
that there is a circular path from A to D to K to E (which leads back to A).
In the case of A* graph search. Since the algorithm keeps track of which nodes in
the state-space have already been expanded (through the implementation of an
explored set), and the fact that the algorithm discards newly generated nodes with
matching states in the explored set or frontier, it is guaranteed that the algorithm
will never get stuck in a loop (in fact, it will not even make one complete lap
around any circuit!) It is important to note that all step-costs are nonnegative,
hence the reason why newly generated nodes with matching states, only in the
frontier, will be discarded.
On the other hand, in the case of A* tree search, A* is guaranteed not to expand
any node with an f-cost greater than that of the cost of the optimal solution. So,
since the path-cost (which is a summand in the f-cost formula) is ever increasing
(accumulating) along any path in the given graph, the f-costs of some (or all) of the
nodes that form the circuit will eventually, after a finite number of trips around the
circuit, exceed the cost of the optimal solution. Hence, terminating the looping
path!