The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10. The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10. The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10. The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10. The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10. The 8-puzzle problem is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8 and a blank tile. Your goal is to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or vertically into the blank tile. For example, consider the given sequence: 1 2 3 4 5 7 8 6 1 2 3 4 5 6 7 8 1 3 1 3 4 2 5 7 8 6 1 2 3 4 2 5 => => 4 5 => => 7 8 6 7 8 6 Write a program to solve the 8-puzzle problem using each of the following algorithms: 1. Breadth-first search (10 points) 2. Iterative deepening search (10 points) 3. A* search using two different suitable heuristics (15 points) 5 points for analysis section described on the next page. Please note that you must implement all the algorithms and not use any implementation provided by another library or package. Your program should read the initial board con- figuration from the standard input and print to the standard output a sequence of board positions that solves the puzzle (only the path to goal from start), the total number of moves and the total number of search states enqueued. For each of the above algorithms, expand the search only until depth 10, root being at depth 0. If goal state is not reached before or at depth 10, then return a failure message. Example, consider the given input and corresponding output sequence. Input (Any random position of the tiles): * 1 4 7 8 Output (List of states starting from input to goal state, if found): * 1 3 (Initial input state) 4 7 8 6 1 3 4 5 7 6 4 5 7 6 2 3 4 * 7 8 3 (Goal state) 4 6 8 * Number of moves = 4 Number of states enqueued = 10 Note: * represents an empty tile What to turn in: Your code and a readme file for compiling the code in a 'zip' file. Kindly ensure that only these two files are present in the zip file. The readme file should contain the following things: 1. Instructions on how to run the program 2. Sample input and its corresponding output 3. Provide a short comparative analysis of two heuristics used for A* (5 points) You may use any of the following languages for your program: Python, Java, C, C++. Please make sure your program runs in the following way: Python example: python homework1.py <algorithm_name> <space_separated_input> where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. N 00 * N 00 2 * 00 where: algorithm_name can take one of the following values: - bfs : For running the Breadth-first search algorithm - ids : For running the Iterative deepening search algorithm - astari : For running the A* algorithm with heuristic 1. astar2 : For running the A* algorithm with heuristic 2. space_separated_input is the input sequence for the 8-puzzle problem. Example: * 1 3 4 2 5 7 8 6 2 Output of the program: Sequence of board positions that solves the problem, total number of moves and total number of states enqueued OR A failure message if goal state was not found before or at depth 10.
Expert Answer:
Answer rating: 100% (QA)
Code is implemented in java as no specific language is mentioned Filename mainjava import javautil public class Main private boolean goalTestList state forint i 0 i 8 i String inputTile stategeti3geti... View the full answer
Posted Date:
Students also viewed these accounting questions
-
Two long wires are oriented so that they are perpendicular to each other. At their closet, they are 20.0cm apart (Fig. 20-59). What is the magnitude of the magnetic field at a point midway between...
-
The game Corner the King is played on a checkerboard. To begin, a checker is randomly placed in the bottom row. The player can move one or two squares to the left or upwards, and then the computer...
-
To ____________ data means to ensure that they are in the proper range.
-
Discuss the importance of asset allocation when developing a portfolio. In general, what is the conventional guidance in terms of allocating assets across the following three asset classes (equities,...
-
For the sampling plans developed in Exercise 7.31, compare the plans performance in terms of average fraction inspected, given that the process is in control at an average fallout level of 0.15%....
-
Should a managerial accounting system provide both financial and nonfinancial information? Explain.
-
Over the course of about six years, Hanwha Corp., a Korean company, entered into 20 separate contracts to purchase petrochemicals from Cedar Petrochemicals, Inc. While negotiating for the...
-
Edison Leasing leased high-tech electronic equipment to Manufacturers Southern on January 1, 2011. Edison purchased the equipment from International Machines at a cost of $112,080. Required: Prepare...
-
a) A financial institution is a financial intermediary (FI'S) that facilitates the transfer of funds between suppliers and users of funds. Briefly explain the benefits that FI's provide to the...
-
Sales of vegetable dehydrators at Bud Baniss discount department store in Gander over the past year are shown below. Management prepared a forecast using a combination of exponential smoothing and...
-
Let X = R, x, y EX where x = (x1, X2), y= (y1,Y2) with the metric function d(x,y) min{)x- Yl. x2-Yal). Is (X, d) a metric space? Why?
-
Every association must be connected to at least one _______ and one _________. Why?
-
You are considering making a movie. The movie is expected to cost $8.8 million upfront and take a year to produce. After that, it is expected to make $4.3 million in the year it is released and $2.1...
-
Describe the steps used to create a communication diagram.
-
When drawing a behavioral state machine, what guidelines should you follow?
-
How do you show the direction of a message on a communication diagram?
-
Give an example of leading ethical change and explain its limitations insofar as we are social creatures.
-
Prove the result that the R 2 associated with a restricted least squares estimator is never larger than that associated with the unrestricted least squares estimator. Conclude that imposing...
-
A tax auditor reviewing a tax return looks for several kinds of problems, including these two: (1) mistakes made in entering or calculating numbers on the tax return and (2) places where the taxpayer...
-
The weights of individual M&M plain candies were obtained by placing each candy in a paper cup, then obtaining the weight without accounting for the weight of the cup. Identify at least one likely...
-
For a flight on a small plane, the pilot asks passengers what they weigh. Identify at least one likely source of random errors and also identify at least one likely source of systematic errors.
Study smarter with the SolutionInn App