Answers.Body: <p>I will use the 8-puzzle game to show you why Nilson's sequence score heuristic function is not admissible.  In the 8-puzzle game, you have a <span class="math-container">$3 \times 3$</span> board of (numbered) squares as follows.</p>
  
  <pre><code>+---+---+---+
  | 0 | 1 | 2 |
  +---+---+---+
  | 7 | 8 | 3 |
  +---+---+---+
  | 6 | 5 | 4 |
  +---+---+---+
  </code></pre>
  
  <p>The numbers in these squares are just used to refer to the specific squares (to avoid saying the "middle square" or the "upper-left square"). So, when I say square 1, I refer to the upper-left square. In these games, you have 8 "tiles". Let's denote these tiles by <span class="math-container">$A, B, C, D, E, F, G$</span> and <span class="math-container">$H$</span>. So, in this game, there is always one square which is free (or empty), given that there are <span class="math-container">$9$</span> squares. The goal of this game is to reach the following configuration of tiles</p>
  
  <pre><code>+---+---+---+
  | A | B | C |
  +---+---+---+
  | H |   | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  </code></pre>
  
  <p>Note that, in the case of the 8-puzzle game, a "state" is a configuration of the board. So, the following two board configurations are two distinct states</p>
  
  <pre><code>+---+---+---+
  |   | A | C |
  +---+---+---+
  | H | B | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  </code></pre>
  
  <p>and </p>
  
  <pre><code>+---+---+---+
  |   | C | A |
  +---+---+---+
  | H | B | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  </code></pre>
  
  <p>The rules of the 8-puzzle are simple. You can move one tile (at a time) from its current position (or square) to another position, provided that the destination square is free. You can only move a tile horizontally and vertically (and one square at a time).</p>
  
  <p>I will not explain in this answer how the Nilson's sequence score heuristic works. <a href="https://stackoverflow.com/a/10607141/3924118">Here</a> is a explanation of how is used in the case of the 8-puzzle game. <em>You should read this explanation and make sure you understand how Nilson's heuristic works before proceeding!</em> You can also find an explanation of how this heuristic works in the book "Principles of Artificial Intelligence" (at <a href="https://books.google.ch/books?id=4JwN5DTpcqkC&amp;pg=PA85&amp;lpg=PA85&amp;dq=Nilsson%27s+sequence+score&amp;source=bl&amp;ots=KA9Xb018fZ&amp;sig=ACfU3U3c5yuf9bWmc42kICTLZIv65aZTOQ&amp;hl=en&amp;sa=X&amp;ved=2ahUKEwib8M76ktTgAhVM-yoKHQxXDWoQ6AEwCXoECAMQAQ#v=onepage&amp;q=Nilsson&#39;s%20sequence%20score&amp;f=false" rel="nofollow noreferrer">page 85</a>), by Nils J. Nilsson (1982).</p>
  
  <blockquote>
    <p>Why isn't then Nilson's sequence score admissible?</p>
  </blockquote>
  
  <p>A heuristic function <span class="math-container">$h$</span> is admissible if <span class="math-container">$h(n) \leq h^*(n)$</span>, for all states <span class="math-container">$n$</span> in the state space, where <span class="math-container">$h^*(n)$</span> is the actual distance to reach the goal (which is often unknown in practice, hence the need to use heuristics to estimate such distance).</p>
  
  <p>Note that admissibility is a property that must hold for <strong>all</strong> states. So, if we find a state where the condition above is not satisfied for the Nilson's sequence score heuristic function, then we show that the Nilson's sequence score is not admissible. </p>
  
  <p>Let us create the following state</p>
  
  <pre><code>+---+---+---+
  | A | B | C |
  +---+---+---+
  |   | H | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  </code></pre>
  
  <p>Note that this state only differs from the goal state by one move: if we move the tile <span class="math-container">$H$</span> to square <span class="math-container">$7$</span>, then we reach the goal state. So, the actual distance to reach the goal state is <span class="math-container">$1$</span> move. But what does the Nilson's score function tell us regarding the distance of this state to the goal state? You can see from the algorithm presented <a href="https://stackoverflow.com/a/10607141/3924118">in this answer</a> to compute the Nilson's sequence score (of a board configuration) that the score of the configuration (or state) above would be more than <span class="math-container">$1$</span> (you can immediately see this because you need to multiply by <span class="math-container">$3$</span>). Therefore, Nilson's sequence score overestimated the distance to the goal (at least for one state), thus it cannot be admissible (by definition).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-24T11:49:23.113Z
Answers.LastActivityDate: 2019-02-24T13:24:40.513Z
Answers.LastEditDate: 2019-02-24T13:24:40.513Z
Answers.UserDisplayName: nbro
Body: <p>I understand what an admissible heuristic is, I just don't know how to tell whether one heuristic is admissible or not. So, in this case, I'd like to know why Nilsson's sequence score heuristic function isn't admissible.</p>
  
Tags: <proofs><admissible-heuristic><heuristic-functions><8-puzzle-problem><nilssons-heuristic-function>
Title: Why isn't Nilsson's Sequence Score an admissible heuristic function?
UserDisplayName: Jay Critch
ThreadText: # Why isn't Nilsson's Sequence Score an admissible heuristic function?
  
  (Asked by: username_0 on 2019-02-24)
  
  I understand what an admissible heuristic is, I just don't know how to tell whether one heuristic is admissible or not. So, in this case, I'd like to know why Nilsson's sequence score heuristic function isn't admissible.
  
  **Tags:** proofs, admissible-heuristic, heuristic-functions, 8-puzzle-problem, nilssons-heuristic-function
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-24. Score: 1 | Accepted answer
  
  I will use the 8-puzzle game to show you why Nilson's sequence score heuristic function is not admissible.  In the 8-puzzle game, you have a $3 \times 3$ board of (numbered) squares as follows.
  +---+---+---+
  | 0 | 1 | 2 |
  +---+---+---+
  | 7 | 8 | 3 |
  +---+---+---+
  | 6 | 5 | 4 |
  +---+---+---+
  
  The numbers in these squares are just used to refer to the specific squares (to avoid saying the "middle square" or the "upper-left square"). So, when I say square 1, I refer to the upper-left square. In these games, you have 8 "tiles". Let's denote these tiles by $A, B, C, D, E, F, G$ and $H$. So, in this game, there is always one square which is free (or empty), given that there are $9$ squares. The goal of this game is to reach the following configuration of tiles
  +---+---+---+
  | A | B | C |
  +---+---+---+
  | H |   | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  
  Note that, in the case of the 8-puzzle game, a "state" is a configuration of the board. So, the following two board configurations are two distinct states
  +---+---+---+
  |   | A | C |
  +---+---+---+
  | H | B | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  
  and 
  +---+---+---+
  |   | C | A |
  +---+---+---+
  | H | B | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  
  The rules of the 8-puzzle are simple. You can move one tile (at a time) from its current position (or square) to another position, provided that the destination square is free. You can only move a tile horizontally and vertically (and one square at a time).
  I will not explain in this answer how the Nilson's sequence score heuristic works. Here is a explanation of how is used in the case of the 8-puzzle game. You should read this explanation and make sure you understand how Nilson's heuristic works before proceeding! You can also find an explanation of how this heuristic works in the book "Principles of Artificial Intelligence" (at page 85), by Nils J. Nilsson (1982).
  
  Why isn't then Nilson's sequence score admissible?
  
  A heuristic function $h$ is admissible if $h(n) \leq h^*(n)$, for all states $n$ in the state space, where $h^*(n)$ is the actual distance to reach the goal (which is often unknown in practice, hence the need to use heuristics to estimate such distance).
  Note that admissibility is a property that must hold for all states. So, if we find a state where the condition above is not satisfied for the Nilson's sequence score heuristic function, then we show that the Nilson's sequence score is not admissible. 
  Let us create the following state
  +---+---+---+
  | A | B | C |
  +---+---+---+
  |   | H | D |
  +---+---+---+
  | G | F | E |
  +---+---+---+
  
  Note that this state only differs from the goal state by one move: if we move the tile $H$ to square $7$, then we reach the goal state. So, the actual distance to reach the goal state is $1$ move. But what does the Nilson's score function tell us regarding the distance of this state to the goal state? You can see from the algorithm presented in this answer to compute the Nilson's sequence score (of a board configuration) that the score of the configuration (or state) above would be more than $1$ (you can immediately see this because you need to multiply by $3$). Therefore, Nilson's sequence score overestimated the distance to the goal (at least for one state), thus it cannot be admissible (by definition).
  
  
  ---
  
  