1. Homepage
  2. Programming
  3. EN MI Homework 1 Search

EN MI Homework 1 Search

Engage in a Conversation
Budapest University of Technology and Economics (BME)Machine LearningArtificial IntelligencePythonSearchManhattan heuristic

Homework 1 Search CourseNana.COM


In this homework assignment, you will be working with Python 3 and modifying the search.py file within the provided search.zip archive. Your task is to implement two functions: aStarSearch and manhattanHeuristic. You will be using the Pacman environment for testing and evaluating your search algorithm. The environment was created at UC Berkeley (http://ai.berkeley.edu ). CourseNana.COM

Project Overview: CourseNana.COM

The provided search.zip file contains the following components: CourseNana.COM

1. search.py: This is the main Python file that you need to modify to implement the A* search algorithm with the Manhattan heuristic. CourseNana.COM

2. Google Colab Notebook (https://colab.research.google.com/drive/1r_zlADKx_xeSDk7n0usxs0HUFB0a8SFo? usp=sharing ): This notebook offers overall guidance on solving search problems. CourseNana.COM

Tasks: CourseNana.COM

  1. Implement the manhattanHeuristic function in the search.py file. This function should calculate the Manhattan heuristic for a given state. CourseNana.COM


  2. Implement the aStarSearch function in the search.py file. This function should perform A* search using a heuristic to find the optimal route. CourseNana.COM

Usage Instructions: CourseNana.COM

To test your implementation, you can use the following commands in the terminal: CourseNana.COM

Breadth First Search: python pacman.py -l mediumMaze -p SearchAgent -a fn=bfs CourseNana.COM

Depth First Search: python pacman.py -l mediumMaze -p SearchAgent -a fn=dfs CourseNana.COM

A* Search with Euclidean Heuristic: python pacman.py -l mediumMaze -p SearchAgent -a fn=astar,heuristic=euclideanHeuristic CourseNana.COM

A* Search with Manhattan Heuristic (Your Implementation): python pacman.py -l mediumMaze -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic CourseNana.COM


Submission Instructions: CourseNana.COM

You only need to upload the modified search.py file to the Moodle platform. Ensure that your implementation correctly returns the following lists for the aStarSearch function: CourseNana.COM

  • actions: The final route the agent must complete. CourseNana.COM

  • visitedNodes: Nodes visited during the search process to find the optimal route. CourseNana.COM

  • visitedCosts: The costs (heuristic + actual cost to get there) of the visited nodes. CourseNana.COM

    Be careful not to leave any print functions in this file! CourseNana.COM

    Example Solution (for the tinyMaze test case): CourseNana.COM

    For the test case python pacman.py -l tinyMaze -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic, the expected output should be: CourseNana.COM

    actions: [(0, 'South'), (0, 'South'), (0, 'West'), (0, 'South'), (0, 'West'), (0, 'West'), (0, 'South'), (0, 'West')] CourseNana.COM

    visitedNodes: [(5, 5), (5, 4), (4, 5), (5, 3), (3, 5), (4, 3), (2, 5), (4, 2), (1, 5), (3, 2), (1, 4), (2, 2), (1, 3), (2, 1), (1, 1)] CourseNana.COM

    visitedCosts: [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8] CourseNana.COM

    Example Solution (for the mediumMaze test case): CourseNana.COM

    For the test case python pacman.py -l mediumMaze -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic, the expected output should be: CourseNana.COM

    actions: [(0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'South'), (0, 'South'), (0, 'East'), (0, 'East'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'North'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'East'), (0, 'East'), (0, 'East'), (0, 'East'), (0, 'East'), (0, 'East'), (0, 'East'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'South'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'South'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West'), (0, 'West')] CourseNana.COM

    visitedNodes: [(34, 16), (34, 15), (33, 16), (34, 14), (32, 16), (33, 14), (31, 16), (32, 14), (30, 16), (31, 14), (29, 16), (30, 14), (28, 16), (30, 13), (27, 16), (30, 12), (26, 16), (25, 16), (25, 15), (24, 16), (25, 14), (23, 16), (22, 16), (21, 16), (20, 16), (19, 16), (18, 16), (17, 16), (16, 16), (15, 16), (14, 16), (13, 16), (12, 16), (11, 16), (10, 16), (9, 16), (8, 16), (7, 16), (6, 16), (5, 16), (4, 16), (3, 16), (2, 16), (1, 16), (1, 15), (1, 14), (1, 13), (1, 12), (1, 11), (1, 10), (1, 9), (1, 8), (1, 7), (31, 12), (26, 14),(2, 7), (32, 12), (27, 14), (3, 7), (27, 13), (27, 12), CourseNana.COM

(27, 11), (26, 11), (25, 11), (24, 11), (33, 12), (4, 7), (24, 12), (23, 12), (22, 12), (21, 12), (20, 12), (20, 11), (19, 12), (20, 10), (19, 11), (18, 12), (20, 9), (17, 12), (16, 12), (15, 12), (14, 12), (14, 11), (13, 12), (14, 10), (12, 12), (12, 11), (12, 10), (11, 10), (10, 10), (34, 12), (4, 8), (21, 9), (17, 13), (15, 10), (12, 13), (10, 11), (34, 11), (34, 10), (33, 10), (32, 10), (31, 10), (30, 10), (30, 9), (29, 10), (30, 8), (4, 9), (22, 9), (17, 14), (16,10), (12, 14), (10, 12), (31, 8), (16, 14), (15, 14), (14, 14), (13, 14), (4, 10), (23, 9), (17, 10), (10, 13), (32, 8), (3, 10), (17, 9), (17, 8), (16, 8), (15, 8), (14, 8), (13, 8), (12, 8), (11, 8), (11, 7), (11, 6), (10, 6), (9, 6), (8, 6), (7, 6), (6, 6), (6,5), (5, 5), (4, 5), (3, 5), (2, 5), (1, 5), (1, 4), (1, 3), (4, 11), (24, 9), (10, 14), (33, 8), (2, 3), (9, 14), (8, 14), (8, 13), (8, 12), (8, 11), (8, 10), (8, 9), (8, 8), (7, 8), (6, 8), (4, 12), (25, 9), (34, 8), (3, 3), (6, 9), (34, 7), (34, 6), (33, 6), (32, 6), (31, 6), (30, 6), (30, 5), (29, 6), (30, 4), (30, 3), (4, 13), (26, 9), (4, 3), (6, 10), (31, 4), (31, 3), (4, 14), (27, 9), (5, 3), (6, 11), (32, 4), (27, 8), (27, 7), (27, 6), (27, 5), (27, 4), (27, 3), (27, 2), (27, 1), (26, 2), (25, 2), (24, 2), (23, 2), ( 22, 2), (21, 2), (20, 2), (19, 2), (18, 2), (17, 2), (16, 2), (15, 2), (14, 2), (13, 2), (12, 2), (11, 2), (10, 2), (10, 1), (9, 1), (8, 1), (7, 1), (6, 1), (5, 1), (4, 1), (3, 1), (2, 1), (1, 1)] CourseNana.COM

visitedCosts: [48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, CourseNana.COM

48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 50, 50, 52, 52, 52, 52, 52, 52, 52, 52, 52, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 58, 58, 58, 58, 58, 58, 58, 58, 58, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68] CourseNana.COM

48, 48,
48, 48,
54, 54,
54, 56,
58, 58,
60, 60,
62, 62,
64, 64,
68, 68,
68, 68,

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Budapest University of Technology and Economics (BME)代写,Machine Learning代写,Artificial Intelligence代写,Python代写,Search代写,Manhattan heuristic代写,Budapest University of Technology and Economics (BME)代编,Machine Learning代编,Artificial Intelligence代编,Python代编,Search代编,Manhattan heuristic代编,Budapest University of Technology and Economics (BME)代考,Machine Learning代考,Artificial Intelligence代考,Python代考,Search代考,Manhattan heuristic代考,Budapest University of Technology and Economics (BME)help,Machine Learninghelp,Artificial Intelligencehelp,Pythonhelp,Searchhelp,Manhattan heuristichelp,Budapest University of Technology and Economics (BME)作业代写,Machine Learning作业代写,Artificial Intelligence作业代写,Python作业代写,Search作业代写,Manhattan heuristic作业代写,Budapest University of Technology and Economics (BME)编程代写,Machine Learning编程代写,Artificial Intelligence编程代写,Python编程代写,Search编程代写,Manhattan heuristic编程代写,Budapest University of Technology and Economics (BME)programming help,Machine Learningprogramming help,Artificial Intelligenceprogramming help,Pythonprogramming help,Searchprogramming help,Manhattan heuristicprogramming help,Budapest University of Technology and Economics (BME)assignment help,Machine Learningassignment help,Artificial Intelligenceassignment help,Pythonassignment help,Searchassignment help,Manhattan heuristicassignment help,Budapest University of Technology and Economics (BME)solution,Machine Learningsolution,Artificial Intelligencesolution,Pythonsolution,Searchsolution,Manhattan heuristicsolution,