Assignment 3 information

Announcements

Support code

There are two files containing support code for this assignment:
  1. a3code --- this file contains code for the A* search. (Current version is 1.1 released 9/24).

    This code contains a reasonably efficient implementation of the A* search which uses hash tables for the OPEN and CLOSED lists. A priority queue (implemented with a weight balanced tree) is also used to implement the OPEN list. This implementation is somewhat customized for working with the representation for sliding block puzzles.

  2. a3tests.scm --- this file contains some tests and sample inputs which you can use to run your code

For those of you using MIT Scheme, you will need to increase the amount of memory for your Scheme process in order to solve some of these problems. You should increase the heap size to something like 4096 (that's 4096 K-words of memory; the default is somwhere around 100 or 300) by doing one of the following

Memory does not seem to be a problem in DrScheme.

Tips

Eight puzzle heuristics

We discussed the "tiles out of place" and the "manhattan distance" heuristics in class on Monday 9/24. There are a number of other "known" heuristics for the eight puzzle, but first, let me make a few points regarding problem 4:

In class on Thursday 9/27, we'll talk about how heuristics can be generated by starting with a formal description of a problem and removing some of the constraints.

Here are some heuristics:

Challenge problem

There are some sliding block puzzles which have several identical tiles. Two examples are the "Panama Canal" puzzle (multiple "A"s and "N"s) and the "Rate Your Mind" puzzle (multiple "R"s and "A"s):
+-------------+        +-------------+
| C A N A M A |   ==>  | P A N A M A |
| P A N A L   |   ==>  | C A N A L   |
+-------------+        +-------------+

+---------+       +---------+
| R A T E |       | R A T E |
| Y O U R |  ==>  | Y O U R |
| M I N D |  ==>  | M I N D |
| P A L   |       | P L A   |
+---------+       +---------+
The latter puzzle seems similar to Sam Lloyd's famous 14-15 puzzle:
+-------------+       +-------------+
|  1  2  3  4 |       |  1  2  3  4 |
|  5  6  7  8 |  ==>  |  5  6  7  8 |
|  9 10 11 12 |  ==>  |  9 10 11 12 |
| 13 14 15    |       | 13 15 14    |
+-------------+       +-------------+
The 14-15 puzzle cannot be solved. The "Rate Your Mind" puzzle is different because some of the letters are interchangeable.

One simple heuristic for puzzles with multiple identical tiles is to take the minimum manhattan distance from a tile in the current state to any copy of that tile in the goal state. This heuristic is admissible, but certainly a better heuristic can be designed!

For this challenge problem, write at least one of the following procedures:

Turn in this code separately from the rest of your assignment. In the comments of your code:

Testing for this problem will be done offline, so you will not get any immediate feedback from the web tester. You could just implement the heuristic described above, but you'd get more points if you make up your own (hopefully better) heuristic. Writing a non-admissible heursitic is fine, though it should find a solution faster than an admissible heuristic. Here is a Scheme source code file which contains the two problems above:

Links

I found two good web pages on sliding block puzzles: