You are on page 1of 2

3.

4
Proof:
First, we need to define two concepts: sequence and invert number.
Sequence: an eight-number sequence formed by going through the state from left to right, up to
down (blank is b and not included in the sequence). For an example, if the state is [1 2 3; 4 6 8; 7 5
b;], then the sequence of the state is 1 2 3 4 6 8 7 5.
Invert number: we hope the state is [1 2 3; 4 5 6; 7 8 b;], so the sequence should be increasing.
Then we count how many pairs of two numbers in the sequence which the former is greater and
named the result invert number. For the example before, its invert number is 3(8>7, 8>5, 7>5).
Now we get the definition of sequence and invert number, so every state has its sequence. Besides,
when we solve the 8-puzzle problem, what we actually do is exchange the blank and a number
near the blank. If the exchanging happens in rows, it’s nothing to the sequence. Or if the
exchanging happens in columns, (we can assume the blank exchanges with ‘8’ in the example
before) then the sequence changes to 1 2 3 4 6 7 5 8, which shows that ‘8’ moves 2 steps in
sequence. So, what does these 2 steps means? Considering the concept mentioned before, the
invert number, we can find that the new sequence’s invert number is 1, changes from 3.
Actually, there is a rule about the sequence’s invert number and its elements’ moving: if an
element moves odd steps, its parity will change, if it moves even steps, parity will not change.
So now we can easily find that, for every state, its sequence’s invert number can be odd or even,
but one odd sequence can not change to an even sequence because no matter we move in rows or
columns, the element always moves even steps, which means its parity cannot be changed.
Now we divided all states into two parts according to its sequence’s invert number’s parity, but
what if it can be divided into more parts? Actually, it is impossible. For a given sequence, we can
always move all the elements before ‘1’ with 2 steps to make their position after ‘1’. This can be
done until ‘5’. So, there is only 6 situations: 6 7 8, 6 8 7, 7 6 8, 7 8 6, 8 6 7, 8 7 6. We can quickly
find that they can be only divided into two parts, proofed there isn’t a third part.
So, using invert number, the states are divided into 2 parts, and we can use the invert number to
decide if a state has solutions.

3.15
a:
1
2 3

4 5 6 7

8 9 10 11 12 13 14 15
b:
breadth-first search: 1 2 3 4 5 6 7 8 9 10 11
depth-limited search: 1 2 4 8 9 5 10 11
Iterative deepening search: 1, 1 2 3, 1 2 4 5 3 6 7, 1 2 4 8 9 5 10 11

3.21
a: If all steps have a same cost, then uniform-cost search does the same as breadth-first search. So
breadth-first search is a special case of uniform-cost search.

b: If f(n) in best-first search is -depth(n), which leads to searching the deepest node first, then best-
first search does the same as depth-first search. So depth-first search is a special case of best-first
search.

c: If h(n) = 0, then A∗ search does the same as uniform-cost search. So uniform-cost search is a
special case of A∗ search.

3.26
a: The branching factor is 4.

b: If k=1, there are 4 states. And it’s easily to be found that if k++, state = state + 4, so when depth
is k, there are 4k states.

c: 4 + 42 + 43 +…+ 4|x|+|y| = 4*(4|x|+|y| -1)/3 = (4|x|+|y|+1-1)/3 – 1

d: 4 + 4*2 + 4*3 +…+ 4*(|x|+|y|) = 2*(|x|+|y|)*(|x|+|y|+1)

e: Admissible. This is the Manhattan distance which equals to the true distance in this problem.

f: As the h(n) equals to the true distance and all links have same cost. The A* search can search
directly towards (x, y). Considering that generally there are 4 directions to expand, A* search will
expand at least |x|+|y| nodes, at most 4*(|x|+|y|) nodes.

g: Admissible. Removing links may increase the true distance, so the Manhattan distance won’t be
greater than the true distance.

h: Not admissible. Adding links may reduce the true distance, so Manhattan distance may be
greater than the true distance.

You might also like