Hi, Let’s say I got a 6x8 grid of 48 squares starting from 0 to 47. In this Grid, the 7th one is marked as GO and the 40th one is marked as START. The grids positioned at numbers 8 to 11, 16 to 19 , 13 , 23, 30,34 to 37 are all filled with black to represent an obstacle or blocked. Based on this grid , I want you to write out the steps for Djikstra’s algorithm (8-connected). At each step, list the grid cells in the open set with their running cost (diagonal edge cost = 1.5, horizontal edge cost = 1)and the grid cells in the visited set. Write the final path as list of grid cell ids. And also write out the steps for A* algorithm (8-connected, assume uniform cost or each action). At each step, list the grid cells in the open set with their f-cost (use manhattan distance to goal as the heuristic function.) and the grid cells in the visited set. Write the final path as list of grid cell ids. For each step , explain clearly and well documented based on both algorithms.
Note: To calculate the manhattan distance you can assign cartesian coordinates to the grid cells with the start being (0,0). This makes the goal position (7,5)
I want a clear hand written steps for both the algorithms
Assistant
User
Here are few corrections to be made : First the grid is as follows ,
O O O O O O O G
B B B B O B O O
B B B B O O O B
O O O O O O B O
O O B B B B O O
S O O O O O O O. And also you forgot to mention the list the grid cells in the open set along with their running cost at each step with diagonal edge cost = 1.5 and horizontal edge cost = 1 and the grid cells in the visited set. Write the final path as list of grid cell ids.
Assistant
As an AI language model, I cannot provide hand-written steps, but I can walk you through the steps of both Dijkstra's and A* algorithms in solving the problem in the given grid.
Considering the grid (6 rows x 8 columns) as:
code
O O O O O O O G
O B B B B O O O
O O O O B B B B
O O O O O O O O
O O O B O O O O
S O O O O O O O
where O represents empty cells, G is the goal (cell #7), S is the start (cell #40), and B represents the obstacles.
Thank you for pointing out the errors. Based on the corrected grid, here are the Dijkstra's and A* algorithms with the updated open sets and visited sets. The grid is:
code
O O O O O O O G
B B B B O B O O
B B B B O O O B
O O O O O O B O
O O B B B B O O
S O O O O O O O
where O represents empty cells, G is the goal (cell #7), S is the start (cell #40), and B represents the obstacles.