Homework 2

Java Homework代写 For each problem, you should email me your source code (*.java files), and a screenshot of your program executing.

Java Homework代写
Java Homework代写

 

 

 

 

 

 

 

 

 

Email me your answers to the following two problems. For each problem, you should email me your source code (*.java files), and a screenshot of your program executing. You must also answer any questions asked.

Basic Problem: Solving the 15 Puzzle      Java Homework代写

The 15 puzzle is a larger version of the 8 Puzzle. Your assignment is to write a program to solve this puzzle.

Here is the goal state:

Java Homework代写
Java Homework代写

 

 

 

 

 

and here is an easy initial state (it’s not far from the goal):

1
1

 

 

 

 

 

First, you should download the Java implementation of algorithms from Norvig and Russell’s Artificial Intelligence – A Modern Approach from http://code.google.com/p/aima-java/downloads/list. If you don’t have Eclipse, you should install it now. Then you can do “File-Import…-Import Existing projects into Workplace” and import the aima-java project. If the import process doesn’t work, you will need to create a new project in the same folder and then you will see the classes in Eclipse.

Make sure you can run the EightPuzzleDemo.          Java Homework代写

Now you need to extend the existing 8-puzzle implementation to solve the above 15-puzzle problem.

Remember that documentation for the book code is here. To solve a problem with Uninformed Search using the code from the text, you need to write four classes:

1.a class that represents the Problem state. This class is independent of the framework and does NOT need to subclass anything. In this step you need to write aima.search.fifteenpuzzle.FifteenPuzzleBoard.java. This will resemble java.

2.

3.a subclass of aima.search.framework.GoalTest. This implements only a single function —boolean isGoalState(Object state); The parameter state is an instance of the class you created in the first step above. In this step you will write aima.search.fifteenpuzzle.FifteenPuzzleGoalTest. This will resemble java.

4.

5.a subclass of aima.search.framework.SuccessorFunction. This generates a stream of Successors where a Successor is an object that represents an (action, resultantState) pair. In this release of the code the action is a String (something like “placeQueenAt4,4” and the resultant State is an instance of the class you create in step 1 above. In this step you will write aima.search.fifteenpuzzle.FifteenPuzzleSuccessorFunction. This will resemble java.

6.

7.a class that runs your search. This class is independent and does not subclass anything. In this step you need to write aima.search.demos.FifteenPuzzleDemo. This will resemble java.

The EightPuzzleDemo.java file is set up to run many search algorithms on the 8 Puzzle. In your own FifteenPuzzleDemo.java file, try to solve the 15-puzzle with BreadthFirstSearch, DepthFirstSearch, DepthLimitedSearch, and IterativeDeepeningSearch. (This just means you don’t include the calls to the other methods.) Do all of these four uninformed search algorithms work in this case? If not, report which algorithms work and which not, and explain why some algorithms fail and why some algorithms work (just a sentence or two for each method).

Now try to solve the 15-puzzle with following initial states (this just involves editing the initialization in your FifteenPuzzleDemo.java file):

Case 1: At least 59 steps needed.

2
2

 

 

 

 

 

Case 2: At least 38 steps needed.

3
3

 

 

 

 

 

Do the four uninformed search algorithms still work for the above two more difficult cases? Why or why not (a sentence or two for each method)?       Java Homework代写

Java Homework代写
Java Homework代写

 

 

 

 

 

 

更多其他: Assignment代写 网课代修 代写CS  据分析代写  润色修改  代写案例  助学金申请  成品购买

合作平台:天才代写 幽灵代写  写手招聘