2
$\begingroup$

I am learning the A* search algorithm on an 8-puzzle problem.

I don't have questions about A*, but I have some for the heuristic score - Nilsson's sequence score.

Justin Heyes-Jones web pages - A* Algorithm explains A* very clearly. It has a picture for Nilsson's sequence scores.

Nilsson's sequence scores

It explains:

Nilsson's sequence score

A tile in the center scores 1 (since it should be empty)

For each tile not in the center, if the tile clockwise to it is not the one that should be clockwise to it then score 2.

Multiply this sequence by three and finally add the total distance you need to move each tile back to its correct position.

I can't understand the steps above for calculating the scores.

For example, for the start state, what h = 17?

0 A C

H B D

G F E

So, by following the description,

B is in the center, so we have 1

Then for each title not in the center, if the **tile** clockwise to **it** is not the one that should be clockwise to it then score 2. I am not sure what this statement means.

What does the double starred title refer to?

What does the double starred it refer to?

Does the double starred it refer to the center title (B in this example)? Or does it refer to each title not in the center?

Is the next step that we start from A? So C should not be clockwise to A, then we have 2. And then B should be clockwise to A, then we ignore, and so on and so forth?

Raphael
73.3k31 gold badges184 silver badges406 bronze badges
asked May 14, 2012 at 15:41
$\endgroup$
0

1 Answer 1

3
$\begingroup$

See if this explanation can help you:

Current pos: Goal:
*AC ABC
HBD H*D
GFE GFE

How to calculate the score:

Center

B in the center -> 1

Distances (manhattan distance)

A must move LEFT -> 1
B must move UP -> 1
sum of distances = 2

Successors (clockwise)

current: ACDEFGH* (skip B because it is in the center)
goal: ABCDEFGH
the [tile,tile clockwise to it] pairs are:
[A,C], [C,D], [D,E], [E,F], [F,G], [G,H], [H,*]
([*,A] is not considered)
the "goal" pairs are:
[A,B], [B,C], [C,D], [D,E], [E,F], [F,G], [G,H], [H,A]

There are 2 pairs that do not match the goal pairs:

[A,C], [H,*]

So the final score is: $distances + 3*(center + 2*successors) = 2 + 3 * (1 + 2*2) = 17$

answered May 18, 2012 at 8:17
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.