Find a cheapest solution to the 8-puzzle

Assignment Help Data Structure & Algorithms
Reference no: EM132479627

Description of task

You need to find a cheapest solution to the 8-puzzle. Given the initial state and the goal state of 8-puzzle, you need to use BFS, DFS, and Dijkstra algorithms.

For the BFS and DFS algorithms, the cost of moving tile is 1 and ordering of a move is: left, up, right, and down. For example

1   3    4

8   0    2

7   6    5

 

1   3    4           1  0  4                       1  3  4        1   3   4

0   8    2           8  3  4                       8  2  0        8   6   2

7   6    5           7  6  5                       7   6   5        7   6   5

For the Dijkstra algorithm, suppose that the cost of a move in the 8-puzzle is equal to the number of the moved tile plus the number of displaced tiles. That is, the cost of moving tile 1 is $1+the number of displaced tiles of 1, the cost of moving tile 2 is $2+the number of displaced tiles of 2, and so on. Calculate the number of displaced tiles, for each states and implement theDijkstra algorithm that finds a cheapest solution; it should read a start state from a file, and print outthe shortest path cost and a cheapest sequence of moves that leads to the goal state given in Figure below:

1   2    3

8        4

7   6    5

Use the programing language of your choice.

You may assume that the puzzle always has a solution; that is, the program does not have to deal with unsolvable states.

The format for encoding start states is as follows:

<tile><tile ><tile >
<tile><tile ><tile >
<tile><tile ><tile >

Each <tile>is a digit from 0 to 8, where 0 marks the blank space, and the other digits are real tiles. For example, the following file encodes the start state:
7 2 4
5 0 6
8 3 1

Sample file 1:
1 34
8 02
7 65

Solutions:The shortest path cost =11

Sample file 2:
1 3 4
8 0 6
7 5 2
Solution: The shortest path cost = 30

Final report, slides, and codes: A report that represents the performance evaluation of your solution should include the description of your task, summary of results, main conclusions, comparison of solutions, using different algorithms, and discussion of any surprising discoveries (including the title page, abstract, 3-5 pages, font 12, double space).

Demonstration and presentation: The project concludes with a 10-15 min presentation held during the classes.

Attachment:- Dijkstra algorithm.rar

Reference no: EM132479627

Questions Cloud

What is the percentage increase in sales : Assume the following sales data for a company: Current year $862,747. What is the percentage increase in sales from the preceding year to the current year
Characterize the probability density function : If random variables X and Y are normally distributed, X ~ N(µ = 1,s^2 = 2), and Y ~ N(µ = 2, s^2 = 3), fully characterize the probability density function of Z
Record all relevant journal entries : White Mountain Company-accounting for long-term notes: White Mountain requests that you record journal entries for a note it received in 20X5
Which deliverables would you expect to socialize : As part of the operationalizing a Big Data Analytics project, which deliverables would you expect to socialize with a business intelligence analyst versus.
Find a cheapest solution to the 8-puzzle : Find a cheapest solution to the 8-puzzle. Given the initial state and the goal state of 8-puzzle, you need to use BFS, DFS, and Dijkstra algorithms
Construct a production cost worksheet : Required - Construct a production cost worksheet assuming that spoilage is recognized and the weighted- average method is used
Write about rootkit using your own words : Cybercriminals use many different types of malware to attack systems. Write about Rootkit using your own words, explain how to defend yourself against.
Standard deviation of the sample means : Drawing repeated samples of 25 recruits each, we expect the standard deviation of the sample means to be about?
What is the project NPV : Revenues and other operating costs would be constant over the project's 3-year life. What is the project's NPV? (Hint: Cash flows are constant in Years 1-3.)

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Write code to implement the expression

Write code to implement the expression: A= (B+C) * (D+E) on 3-, 2-, 1- and 0- address machines. In accordance with programming language practice, computing the expression should not change the values of its operands. Show all instructions.

  Find the average number of bits needed to encode

Suppose that the symbols are compressed using Huffman Coding and that the most likely symbol is encoded as a 0, determine the decompressed value of the following compressed string of bits?

  Use the string input by the user as an argument to open file

One of these must use preorder traversal, one must use inorder traversal, and one must use postorder traversal. You must decide which to use for each method, but use comments to document the type of traversal used.

  Provide polynomial-time algorithm to decide in graph

Provide a polynomial-time algorithm to decide whether G has unique minimum s - t cut (i.e., an s - t cut of capacity strictly less than that of all other s - t cuts).

  Create and implement a binary search algorithm

Create and implement modified Quick sort algorithm which will sort the array before the Binary Search algorithm is executed.

  What is the time complexity

Design an algorithm for finding the closest two numbers in the input list - What is the time complexity? Is it probable to improve the algorithm if the input is a sorted list?

  Conversion of centrigral to frahenhit

Conversion of centrigral to frahenhit

  Create pseudo code for the given three stack methods

Assume a "Head" node exists with the NextRef attribute pointing to the first node in the stack or being null if the stack is empty. Create pseudo code for the following 3 stack methods, showing the logic tied to the inverted list.

  Is a flowchart more valuable in documenting

Is a flowchart more valuable in documenting the logic of a program than just the coded instructions in the programming language

  Develop a flowchart and provide a brief explanation

Create a hierarchy chart depicting the chosen situation and develop a flowchart and provide a brief explanation for it.

  Test cases for testing and validate the implementation

Develop suitable test cases for testing and validate the implementation - For evaluating the performance of the EAS, develop a program that will be accept

  Create a linked list that is a palindrome

Create a linked list that is a Palindrome, and call the isPalindrome method. Test to ensure it returns True.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd