Question: I want two differnt solutions with clear execution and steps and the program code with excepted final outputs Artificial Intelligence Machine Problem 1 A *

I want two differnt solutions with clear execution and steps and the program code with excepted final outputs
Artificial Intelligence
Machine Problem 1 A* for Solving a Maze
IMPORTANT NOTICE: You do not have permission to share the description of this assignment or discuss it with anyone outside the
class. Also, you cannot share your code (or solution in general) with anyone, nor can you ask anyone for the code or solution.
Failure to adhere to this policy will result in a zero grade for the assignment and may result in a dismissal from Lewis University.
Introduction
For this assignment, you will implement the A* algorithm to find an exit out of a maze. Your goal is to return the instructions for
solving the maze and show the configuration after each move. The maze is a rectangular grid containing passageways, walls, and a
single exit point that the agent must reach. The agent can move in four directions: 'down', 'right', 'left', and 'up', but cannot move to
a location containing a wall.
Requirements
For this assignment, you are given base Python 3 code that contains a part of the implementation. Download this code first, and
then do the following:
1. Determine a heuristic function that can be used with A* to solve the search problem. Make sure the A* heuristic satisfies
the admissibility and consistency properties.
2. Modify that code so it solves the maze problem using the A* algorithm.
3. Modify the print statements from the base code to include your info in the printed heading.
4. Run the code and verify it finds the correct path and generates the right number of states visited.
Additional Requirements
1. The name of your source code file should be mp1.py. All your code should be within a single file.
2. You can only import numpy, queue, and heapq packages.
3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block
comments.
4. You need to use meaningful identifier names that conform to standard naming conventions.
5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name,
semester, and assignment name.
6. The output should exactly match the sample output shown on the last page.
What to Turn In
You will turn in the single mp1.py file using BlackBoard.
refrence code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
"""
@author: szczurpi
This program implements a search algorithm for solving a grid maze
It allows moves in 4 directions (1 point cost for each move)
"""
import numpy as np
import queue # Needed for frontier queue
from heapq import heapify
class MazeState():
""" Stores information about each visited state within the search """
# Define constants
SPACE =0
WALL =1
EXIT =2
START =(1,1)
END =(9,1)
maze = np.array([
[0,1,1,0,1],
[0,0,0,0,1],
[0,0,1,1,1],
[1,0,0,0,0],
[1,1,0,1,0],
[1,0,0,1,0],
[1,0,0,1,0],
[1,0,1,1,0],
[1,0,0,0,0],
[0,0,1,1,1]], dtype=np.int32)
maze[END]= EXIT
def __init__(self, conf=START, g=0, pred_state=None, pred_action=None):
""" Initializes the state with information passed from the arguments """
self.pos = conf # Configuration of the state - current coordinates
self.gcost = g # Path cost
self.pred = pred_state # Predecesor state
self.action_from_pred = pred_action # Action from predecesor state to current state
### TODO - heuristic value for A*/greedy search ###
def __hash__(self):
""" Returns a hash code so that it can be stored in a set data structure """
return self.pos.__hash__()
def __eq__(self, other):
""" Checks for equality of states by positions only """
### TODO ###
def __lt__(self, other):
""" Allows for ordering the states by the path (g) cost """
### TODO ###
def __str__(self):
""" Returns the maze representation of the state """
a = np.array(self.maze)
a[self.pos]=4
return np.str(a)
def is_goal(self):
""" Returns true if current position is same as the exit position """
### TODO ###
move_num =0 # Used by show_path() to count moves in the solution path
def show_path(self):
""" Recursively outputs the list of moves and states along path """
if self.pred is not None:
self.pred.show_path()
if MazeState.move_num==0:
print('START')
else:
print('Move',MazeState.move_num, 'ACTION:', self.action_from_pred)
MazeState.move_num = MazeState.move_num +1
print(self)
def can_move(self, move):
""" Returns true if agent can mo
I want two differnt solutions with clear

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!