ICS 361 Artificial Intelligence Programming
Heuristic Search and State Space Representations
Assignment #3
This assignment is worth 200 points.
 Implement, test and compare heuristic search (A* or a
variant) to the results in assignment #2 on the same problems.
 (10 p) Farmer, Wolf, Goat and Cabbage
 (10 p) Water Jugs
 (25 p) 8 puzzle
The default heuristic for all problems is the number of
"items" out of place when compared to the goal state. For the
Npuzzles, also implement the Manhattan distance and
the number of direct tile reversals heuristics.
Use the same printing functions from Assignment #2 to show the currently expanded node at each iteration.
When a goal is reached, print the solution path (if one is found) as
well as the length of the *OPEN* and *CLOSED* lists. The transcripts from these runs will be
the data for your report.
 (25 p) Implement a SOLVABLE? function for the npuzzle to determine if a given
state is solvable for a given goal. I.e. not all initial
states of the Npuzzle are solvable for a specific goal state.
There are two separate sets of states. All states in each set are
unreachable from states in the other and vice versa.
SOLVABLE?
should return T if the configuration is solvable, otherwise return NIL
(meaning unsolvable).
Puzzles are solvable if there are an even number of
tiles that need swapping. If an odd number is needed, the puzzle is unsolvable.
This is called parity.
See the papers posted on Laulima for the way
to calculate the parity of an Npuzzle with respect to a specific goal.
Test your
function on at least 2 unsolvable puzzles.
Discuss your solution to detecting and handling
unsolvable cases in your report. Explain how you generated the new,
novel puzzle instances.
 (30 p) Create and demonstrate at least 3 new nontrivial instances
of the 8 puzzle. You may use a depth limit of 35 or iterative
deepening in your depthfirst search on the npuzzle. One instance must have a
short, one medium and one long solution path (approx. 5, 15 and 30
states) for the leastcost/shortest/optimal solution.
For reference, see the 8puzzle papers posted on Laulima. Use the resources provided or search for other
information. Remember to cite any resources you use.
Save your output in 3OUT.txt
Insert A, B, C, etc. between the assignment number and OUT if you have more than one output file. (nreed3AOUT.txt)
 (100 p) Report  Must be written in proper English in a Scientific Style
 (25 p) Describe your SOLVABLE? function that prevents unlimited
searching for a configuration that is not solvable in the npuzzle?
Describe how this function was integrated with the main control lop
 (50 p) Create a table using at least the following
variables to compare characteristics of depth breadth and best first
searches.
Additional variables may be included in the table as long as they are described concisely.
 b – max branching factor of the search tree
 d – depth of the leastcost solution
 m – max depth of the statespace (may be infinity)
Properties:
 Completeness: does the method always find a solution if one exists?
 Time complexity: how long does it take as a function of the number of nodes?
 Space complexity: how much memory does it require?
 Optimality: does the method guarantee the leastcost solution?
 (25 p) Discuss the degree to which your transcripts demonstrate the complexities in your table above.
Turn in the following on Laulima
 One or
more plain text files containing your code and output scripts.

Your report (in a standard format like text, rtf, or pdf). Ask our TA
if you would like to use a format other than the above.
(c) N. E. Reed, 20042016