Sample Solution for Assignment 2 (Total: 50 marks)
Due Friday, Feb. 24,
The heuristic h = h1 + h2 (adding misplaced tiles and
f(n) = g(n) + h(n)
≤ g(n) + h*(n) + c
≤ C* + c
≤ g(G2)
so G2 will never
be expanded before an optimal goal is expanded.
The misplaced-tiles heuristic is exact for the problem where a tile can move from square A to square B. As this is a relaxation of the condition that a tile can move from square A to square B if B is blank, Gaschnig’s heuristic cannot be less than the misplaced-tiles heuristic. As it is also admissible (being exact for a relaxation of the original problem), Gaschnig’s heuristic is therefore more accurate.
If we permute two
adjacent tiles in the goal state, we have a state where misplaced-tiles and
To compute Gaschnig’s heuristic, repeat the following until the goal
state is reached: let B be the current location of the blank; if B is occupied
by tile X (not the blank) in the goal state, move X to B; otherwise, move any
misplaced tile to B. Students could be asked to prove that this is the optimal
solution to the relaxed problem.
If we assume the comparison function is transitive, then
we can always sort the nodes using it, and choose the node that is at the top
of the sort. Efficient priority queue data structures rely only on comparison
operations, so we lose nothing in efficiency—except for the fact that the comparison operation on states may be much more
expensive than comparing two numbers, each of which can be computed just once.
A* relies on the division of the total cost
estimate f(n) into the
cost-so-far and the cost-to- go. If we have comparison operators for each of
these, then we can prefer to expand a node that is better than other nodes on
both comparisons. Unfortunately, there will usually be no such node. The
tradeoff between g(n) and h(n) cannot be realized without numerical values.
Consider a MIN node whose children are terminal nodes. If MIN plays suboptimally, then
the value of the node is greater than or equal to the value it would have if MIN played
optimally. Hence, the value of the MAX node that is the MIN
node’s parent can only be increased. This
argument can be extended by a simple induction all the way to the root. If
the suboptimal play by MIN is predictable,
then one can do better than a minimax strategy. For
example, if MIN always falls for a certain kind of trap and loses,
then setting the trap guarantees a win even if there is actually a devastating
response for MIN. This is shown in Figure S6.2.