Docsity

Admissibility and Monotonicity of Heuristics in Artificial Intelligence, Assignments of Computer Science

Toggle sidebar
bg1
CPSC 625 : ARTIFICIAL INTELLIGENCE (Fall 2000)
SOLUTIONS TO HOMEWORK 2
Question 1 (Exercise 4.6)
Let us define a heuristic h for the 8-puzzle problem as follows:
h(s) = clockwise-distance(i,s)
All tiles i not in the centre
where
clockwise-distance(i ,s) = Manhattan distance of tile i (in state s) from its goal position,
going in a clockwise direction along the border.
This is obviously not a very smart heuristic, but nonetheless it is a meaningful one.
To prove that h is not admissible, we just need to give an example of a state s where h(s)
> h*(s). Consider the following state s0:
*12
783
654
The optimal solution is moving tiles 1 to 7 one step each in an anti-clockwise direction,
and then move tile 8 one step to the left. That is, the cost of the optimal solution, h*(s0) is
8. This is clearly the optimal solution since all 8 tiles are out of place, and hence all tiles
have to be moved by at least one step each.
But clockwise-distance(i,s0) = 7 for i = 1 to 7.
Therefore
h(s0) = 7*7
= 49
> h*( s0)
We therefore conclude that h is not admissible.
We now show that using the heuristic h can lead to a sub-optimal solution. Consider a
problem with the following start state:
7*1
682
543
pf3
pf4

Partial preview of the text

Download Admissibility and Monotonicity of Heuristics in Artificial Intelligence and more Assignments Computer Science in PDF only on Docsity!

CPSC 625 : ARTIFICIAL INTELLIGENCE (Fall 2000)

SOLUTIONS TO HOMEWORK 2

Question 1 (Exercise 4.6) Let us define a heuristic h for the 8-puzzle problem as follows:

h(s) =  clockwise-distance(i,s)

All tiles i not in the centre where clockwise-distance(i ,s) = Manhattan distance of tile i (in state s) from its goal position, going in a clockwise direction along the border. This is obviously not a very smart heuristic, but nonetheless it is a meaningful one. To prove that h is not admissible, we just need to give an example of a state s where h(s)

h*(s). Consider the following state s 0 :

783 654 The optimal solution is moving tiles 1 to 7 one step each in an anti-clockwise direction, and then move tile 8 one step to the left. That is, the cost of the optimal solution, h*(s 0 ) is

  1. This is clearly the optimal solution since all 8 tiles are out of place, and hence all tiles have to be moved by at least one step each. But clockwise-distance(i,s 0 ) = 7 for i = 1 to 7. Therefore h(s 0 ) = 7* = 49 > h( s 0 ) We therefore conclude that h is not admissible. We now show that using the heuristic h can lead to a sub-optimal solution. Consider a problem with the following start state: 7 682 543

The optimal solution here is moving tiles 1 to 7 two steps each counter-clockwise and then move tile 8 one step to the left. That is, the cost of the optimal solution is (72) + 1 i.e. 15. Now consider best-first search, in which the next node expanded is the one with lowest f value, where f(s) = g(s) + h(s). The following shows part of the search tree obtained. The g, h and f values of each state are shown. Nodes which have already been expanded are, of course, not re-generated. The next node expanded is the leftmost one at every level. 7 682 543 71 71 781 682 682 6* 543 543 543 g=1, h=41, f=42 g=1, h=43, f=44 g=1, h=48, f= This state is never expanded although it leads to the optimal 671 solution.

543 g=2, h=40, f= 671 671 582 8* 43 543 g=3, h=39, f=42 g=3, h=40, f= 671 582 4 g=4, h=38, f= (continued next page) 671 671

Consider the following heuristic h: h(s) = 2n - 3 if n > 1 1 if n = 0 otherwise where n = number of people on the left bank in state s We claim that h is an admissible heuristic. Proof: If we relax the constraint that missionaries should not be outnumbered by cannibals, we need 2 trips (one forward and one return) to take one person from the left to the right bank, since the boat needs at least one person to row back to the left from the right bank. Taking the last 2 persons from the left to the right bank will cost only one trip. Therefore for n>1, we shall need 2(n-2) + 1 i.e. 2n - 3 trips. Therefore 2n - 3 is a lower bound on the number of trips, since adding any constraint can only increase the number of required trips. We therefore conclude that h is admissible. (The proof is trivial for n = 0 or 1). Question 4 Search programs are usually assessed on the following criteria:  Optimality  Completeness  Time efficiency  Space efficiency In this case, the relevant criteria are optimality and time efficiency. If we decrease the temperature T very fast, then the program will be efficient, but we have a higher probability of obtaining sub-optimal solutions. On the other hand, if temperature is decreased very slowly, then we have a better chance of getting the optimal solution, but the program will be less efficient. Therefore we can compare the two programs based on the following considerations:  To what extent is optimality required?  How efficient do we want the program to be?  What type of state space surface are we dealing with? Does it have many local maxima or just a few? There is no obvious choice (based on the information provided) between the two programs. Most likely the best choice will be based on a trade-off among the competing objectives.