In this assignment you will extend the problem solving framework by adding an automatic problem solving capability.

This will be accomplished in the following steps:

The top-level framework classes involved in automatic solving are shown in the diagram below. Note that the java.util.Queue interface type is also involved, allowing reuse of Solver code for both basic state space search and A* search.

Listings of the new files Solver.java and Statistics.java are shown in the menu to the left. They should be downloaded and placed into your framework.solution package.

State space search is implemented by extending the Solver class as shown below.

A skeletal form for StateSpaceSolver.java is shown in the menu to the left. It should be placed in the framework.solution package. Also shown is a StateSpaceSolverTest.java test class.

Develop StateSpaceSolver using the steps below. See the Javadoc comments for more details.

When all tests succeed proceed to the next step.
7-move Farmer, Wolf, Goat, and Cabbage problem:
Breadth-First State Space Search
------------------------------
Solution length   7
Solution time   2
Num of queue ops   31
Max queue size   4

7-move Farmer, Wolf, Goat, and Cabbage problem:
Depth-First State Space Search
------------------------------
Solution length   7
Solution time   0
Num of queue ops   21
Max queue size   3

6-move Arithmetic problem:
Breadth-First State Space Search
------------------------------
Solution length   6
Solution time   5
Num of queue ops   2090
Max queue size   1065

6-move Arithmetic problem:
Depth-First State Space Search
------------------------------
Solution length   4846
Solution time   417
Num of queue ops   19515
Max queue size   9804

5-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   5
Solution time   14
Num of queue ops   139
Max queue size   38

5-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   4485
Solution time   450
Num of queue ops   13127
Max queue size   4022

10-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   10
Solution time   2
Num of queue ops   2611
Max queue size   662

10-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   3208
Solution time   218
Num of queue ops   9394
Max queue size   2903

13-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   13
Solution time   6
Num of queue ops   8273
Max queue size   2328

13-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   3135
Solution time   208
Num of queue ops   9174
Max queue size   2833

18-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   18
Solution time   119
Num of queue ops   157751
Max queue size   44004

18-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   2056
Solution time   89
Num of queue ops   6034
Max queue size   1867

20-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   20
Solution time   473
Num of queue ops   420247
Max queue size   111460

20-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   3380
Solution time   246
Num of queue ops   9891
Max queue size   3054

24-move 8-Puzzle problem:
Breadth-First State Space Search
------------------------------
Solution length   24
Solution time   4725
Num of queue ops   3926555
Max queue size   1109388

24-move 8-Puzzle problem:
Depth-First State Space Search
------------------------------
Solution length   2374
Solution time   120
Num of queue ops   6950
Max queue size   2147

From testExpand: 
framework.solution.Solution@5679c6c6
In this step you will modify your problem solver GUI to allow users to solve the current problem using either breadth-first or depth-first state space search.

The requirements for GUI behavior are given below. You can refer to "before" and "after" snapshots accessible from the menu to the left.

You need not copy the examples exactly; you can use any controls that meet the requirements, and you are encouraged to make your presentations more interesting.

Here are suggestions for your ProblemGUI class:
In this step you will add heuristics to the 8-Puzzle and implement A* search. Refer to the informed search lecture notes (see menu).

To begin, add the following to your State.java interface in the framework.problem package:

This default method will allow A* search to work on problems too simple to warrant heuristics, while it can be overridden for problems like the 8-Puzzle.

Your PuzzleState class must override the getHeuristic method.

To facilitate testing, you should organize your added code as shown below. Note that you can test either the "number of tiles out of place" heuristic or the "sum of Manhattan distances" heuristic by appropriately commenting and uncommenting lines.

Then you can test your heuristics using this PuzzleHeuristicTest.java file, also listed in the menu. (Simply create a new class with this name in the domains.puzzle package under Test Packages, replace its contents with that given here, and run the file.)

Implementing A* search in the problem solver requires:
A skeletal form for AStarSolver.java is shown below. It should be placed in the framework.solution package.

Note that the java.util.PriorityQueue works for the required queue.

In order to test heuristics and A* search, we need to add an A* search option to the GUI, and we need to allow the user to choose among problem benchmarks.

The screenshot below illustrates this.

For extra credit, implement enhanced A* search (see lecture notes in menu) and test it on the 8-Puzzle. A snapshot is shown below. Note: For full credit, your A* and enhanced A* search performance should be similar (though not necessarily exactly similar) to that described in lecture.

When your ProblemApplication.java file runs correctly: Note the general Submission Policy in the menu at left.

Your project will be inspected, tested, and run by the lab instructor. Grading criteria: