Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago

Question

The Nature of Nonverbal Communication

Answered: 1 week ago

Question

Functions of Nonverbal Communication

Answered: 1 week ago

Question

Nonverbal Communication Codes

Answered: 1 week ago