Question: Complete algo function in following below code after that perform these Implement the following uninformed search methods on the agent environment.i . Breadth - first

Complete algo function in following below code after that perform these Implement the following uninformed search methods on the agent environment.i. Breadth-first searchii. Depth-first searchiii. Uninformed search with the following cost function: left operation =1, up operation =2,down operation =3, right operation =4iv. Greedy Best-First search with the Manhattan distance as a heuristic functionv. A* search with the cost and heuristic functions as defined previously in UCS and GreedyBFS, respectively.a. Make changes in the given code so that the user will specify the start and goal states.b. For each algorithm, show the (a) time complexity, (b) space complexity, (c) complete pathfrom start to goal.c. Make changes in the UI of agents environment so that all the explored paths are alsodisplayed as the agent is searching for the goal node. That is, use a different color to showthe nodes placed on the fringe.from lib.agents import *import numpy as npclass Wall(Thing): passclass Goal(Thing): passfrom random import choiceclass OurAgent(Agent): location =[0,1] direction = Direction("down") def moveforward(self, loc): self.location[0]+= loc[0] self.location[1]+= loc[1] def turn(self, d): self.direction = Direction(d) def program(percepts): global it '''Returns an action based on it's percepts''' for p in percepts: if isinstance(p, Wall): print("Cannot move in a wall
Implement the algorithm again") it +=1 return steps[it]class Maze(GraphicEnvironment): def percept(self, agent): '''return a list of things that are in our agent's location''' things = self.list_things_at(agent.location) for thing in self.list_things_at(agent.location): if not isinstance(thing, OurAgent): things.append(thing) return things def execute_action(self, agent, action): '''changes the state of the environment based on what the agent does.''' if action == 'right': agent.moveforward([1,0]) elif action == 'left': agent.moveforward([-1,0]) elif action =='up': agent.moveforward([0,-1]) elif action == 'down': agent.moveforward([0,1]) def is_done(self): things =[] for agent in self.agents: for thing in self.list_things_at(agent.location): things.append(thing) for thing in things: if isinstance(thing, Goal): return True return Falsemaze_layout =[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,3,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1],[1,0,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1],[1,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1],[1,0,0,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1],[1,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1],[1,0,1,1,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1],[1,0,1,1,0,1,1,0,1,0,0,0,0,1,1,0,1,1,0,1],[1,0,0,0,0,1,1,0,1,0,1,1,0,1,1,0,0,0,0,1],[1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,1,1],[1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1],[1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,1,1,0,1],[1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1],[1,0,1,0,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]maze_instance = Maze(20,20, color={'Goal': (0,128,0),

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 Databases Questions!