The University of Melbourne
School of Computing and Information Systems
COMP90054 AI Planning for Autonomy
Project 1, 2021
This project counts towards 10% of the marks for this subject.
This project must be done individually.
Aims
The aim of this project is to improve your understanding of various search algorithms using
the Berkely Pac Man framework.
Getting started
Before starting the assignment you must do the following:
Create a github account at https://www.github.com if you don’t already have one.
Visit https://classroom.github.com/a/XQszkhjs and accept the assignment. This
will create your personal assignment repository on github.
Clone your assignment repository to your local machine. The repository contains the
framework that you will need in order to complete the assignment.
Complete the following form:
This allows us to link your University ID to your github ID so that we can mark your
assignment.
1
To familiarise yourself with basic search algorithms and the Pacman environment,
how to interact with the framework, I have provided an implementation of the depth first
search algorithm.
Part 1 (1 mark)
Implement the A* Algorithm described in lectures. You should be able to test the algorithm
using the following command:
python pacman.py -l bigMaze -z .5 -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic
Other layouts are available in the layouts directory, and you can easily create you own!
Part 2 (3 marks)
The recursive best first search algorithm is designed to enable optimal solutions to be found
while using less memory than A*. It may be used to find optimal solutions for memoryconstrained
problems. The algorithm is defined on page 99 of [2] (which you can access from
the University library and is linked to in the Week 1 and 2 modules on Canvas) and reproduced
Note that this is a tree-search algorithm which does not consider repeated states. For example,
moving Pacman down and then up again would produce a new state. As a result, the
algorithm will expand a large number of search nodes in order to find solutions to problems.
I encourage you to consider how you could modify the algorithm to reduce the number of
nodes generated without requiring too much memory, but for the purposes of this question
2
you should implement the algorithm as described. You should be able to test the algorithm
using the following command:
python pacman.py -l tinyMaze -p SearchAgent -a fn=rebfs
Other layouts are available in the layouts directory, and you can easily create you own!
Part 3 (4 marks)
We now consider a slight change to the rules of Pacman, specifically allowing non-uniform
action costs. For the purposes of this question, moving Pacman to a square that is empty or
contains food has a cost of 1, while moving Pacman to a square that contains a Capsule has
a cost of 0. Note that once Pacman eats the capsule the square becomes empty so moving
Pacman back to that square would incur a cost of 1.
We wish to solve the problem of eating all the food in the maze in as few steps as possible.
For this, we’ll need a new search problem definition which formalizes the food-clearing problem:
FoodSearchProblem in searchAgents.py (implemented for you). A solution is defined to
be a path that collects all of the food in the Pacman world. You should already be able to
solve this problem using your A* search implementation with the null Heuristic, but you will
find that heuristic quite inefficient. As a reference, our implementation expands over 100,000
node to find a solution of length 25 for task3search.
Your task is to implement foodHeuristic in order to improve the efficiency of A* search
for this problem. Recall that in order to find optimal solutions to the problem, your heuristic
Non-Trivial Heuristics: The trivial heuristics are the ones that return zero everywhere
(UCS) and the heuristic which computes the true completion cost. The former won’t save
you any time, while the latter will timeout the autograder. You want a heuristic which reduces
total compute time, though for this assignment the autograder will only check node
counts (aside from enforcing a reasonable time limit).
any points. Make sure that your heuristic returns 0 at every goal state and never returns a
negative value. Depending on how few nodes your heuristic expands on task3search, you’ll
Less than 20,000 1/4
Less than 10,000 2/4
Less than 5,000 3/4
Less than 2,500 4/4
You can check the performance of your algorithm by running the following command:
python pacman.py -l task3Search -p AStarFoodSearchAgent
Since this computation can take some time for less efficienct heuristics, you may wish to start
3
Part 4 (2 marks)
Challenge Question
Note that this is a much more difficult question that requires you to interpret and
implement an algorithm from a research paper. Learning to implement it successfully
will give you great experience in solving a modern AI planning problem
and experience in self-directed learning – something that is valuable in general,
but particularly with contemporary AI techniques, but is not necessary in order
to do well in the subject. As a result there is only a small mark allocation for
this question.
Deceptive path-planning involves finding a path to a goal that makes it difficult for an outside
observer to guess what that goal might be. This paper by Masters and Sardina describes a
number of algorithms for deceptive path-planning [1]. The main idea is that an agent has a
true goal as well as one or more false goals. The agent plans a path to the true goal designed
to make it difficult for an observer to figure out whether it is trying to reach the true goal or
one of the false goals.
Your task is to implement two of the strategies described in [1] using the Pacman framework.
For each of the deceptive path planning layouts, assume that the true goal is represented
by the Capsule and that the false goals are represented by Food.
a) {1 mark} Implement an agent that uses the πd2 strategy. You can call your agent using
the following command
python pacman.py --layout deceptiveMap --pacman pid2DeceptiveSearchAgent
b) {1 mark} Implement an agent that uses the πd3 strategy. You can call your agent using
the following command
python pacman.py --layout deceptiveMap --pacman pid3DeceptiveSearchAgent
NOTE: You should not change any files other than search.py and searchAgents.py. You
should not import any additional libraries into your code. This risks being incompatible with
our marking scripts.
Run the command:
that you are able to run the autograder and have these tests pass, otherwise, our marking
scripts will NOT work on your submission. While the final tests will be similar to those
provided, we will vary the final test layouts to prevent hardcoded action paths from achieving
any marks.
Marking criteria
This assignment is worth 10% of your overall grade for this subject. Marks are allocated
according to the breakdown listed above, based on how many of our tests the algorithms
4
pass. No marks will be given for code formatting, etc.
Submission
Ensure that you have pushed your files to the repository and completed the form in the
’Getting Started’ section before the due date.
The master branch on your repository will be cloned at the due date and time.
From this repository, we will copy only the files: search.py and searchAgents.py. Do
not change any other file as part of your solution, or it will not run. Breaking these instructions
breaks our marking scripts, delays marks being returned, and more importantly, gives
Note: Submissions that fail to follow the above will be penalised.
Originality Multiplier
We will be using a code similarity comparison tool to ensure that each student’s work istheir
own. For code that is similar to another submission or code found online, an originality
multiplier will be applied to the work. For example, if 20% of the assessment is deemed
tohave been taken from another source, the final mark will be multiplied by 0.8.
Late submission policy
Submissions that are late will be penalised 1 mark per day, up to a maximum of 5 marks.
The University misconduct policy1 applies. Students are encouraged to discuss the assignment
topics, but all submitted work must represent the individual’s understanding of the
topic. The subject staff take academic misconduct seriously. In the past, we have prosecuted
several students that have breached the university policy. Often this results in receiving 0
marks for the assessment, and in some cases, has resulted in failure of the subject.
Important: As part of marking, we run all submissions via a code similarity comparison
tool. These tools are quite sophisticated and are not easily fooled by attempts to make code
look different. In short, if you copy code from classmates or from online sources, you risk
But more importantly, the point of this assignment is to have you work through a series of
foundational search algorithms. Successfully completing this assignment will make the rest
of the subject, including other assessment, much smoother for you. If you cannot work out
solutions for this assignment, submitting another person’s code will not help in the long run.

References
[1] Masters, P., and Sardina, S. Deceptive path-planning. pp. 4368–4375.
[2] Russell, S., and Norvig, P. Artificial Intelligence: A Modern Approach, 3rd ed.
Prentice Hall Press, USA, 2009.

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp2