代写Assignment 2.1 - AI Viruses代写Python编程
- 首页 >> Matlab编程Assignment 2.1 - AI Viruses
Key Information
Your Task
This is a team-based open-book home assignment. It involves making a game that is broken up into a set of programming questions. We provide a small set of tests to allow you to check the correctness of your solutions. However, these tests are not exhaustive, and passing the tests does not guarantee full marks. You should perform. your own testing to ensure your solution is coded correctly.
Mark Value
The assignment is worth 100 marks. 50 marks are for the code, which is group based. 50 marks are for an individual written interview/test to be conducted during Week 10
Due Date
The code part of the assignment is due on Friday Week 9 (3 May 2024 11.55 PM Melbourne time for Clayton students, 11.55PM MA time for Malaysian students)
Submission
The final submission of the assignment is to be done through Ed.
Assessment Criteria
Please check the rubric for the assessment criteria
Video explanation:
Here is a helpful video explaining the concepts of the assignment so watch this before beginning the assignment
There are a couple of minor tweaks to the video commentary:
· The explanation of collect_all_computers mentions doing it in constant time complexity, it should be linear
· Any mention of Hash Maps refers to Hash Tables, please don't get confused. We are not going to cover Hash Maps in this unit, only hash table.
Late Penalty
· 10% deduction per calendar day or part thereof for up to one week
· Submissions more than 7 calendar days after the due date will receive a mark of zero (0) and no assessment feedback will be provided.
Generative AI tools cannot be used in this assessment task: In this assessment, you must not use generative artificial intelligence (AI) to generate any materials or content in relation to the assessment task.
Academic Integrity
Your code will be checked against all other students' with a similarity checker.
Anything you are able to google can be easily found by the teaching team and compared against your work.
In this assessment, you must not use generative artificial intelligence (AI) to generate any materials or content in relation to the assessment task. This includes ChatGPT and GitHub Copilot.
Keep in mind that you are responsible for all code submitted, whether you or a teammate wrote it.
How can I avoid academic integrity issues?
Never copy code from anywhere. If you learn something useful online, rewrite it from scratch. It's also the best way to make sure you have understood it.
This includes not submitting code you have submitted in a prior assessment, whether this is from FIT1008 or another unit. Self-plagiarism is as serious a breach as collusion or plagiarism.
· If a fellow student asks you for a solution to a question, try to help them build their solution. Do not give them yours.
Giving your solution is just as much of an Academic Integrity breach as receiving it.
Don't leave your devices unlocked and unattended.
Collaborating efectively
In this assignment, you will be working with one of your peers, and as such, you will need to build on your collaboration skills. In previous units you may have also done group work and tried dividing the work evenly, though this isn't always the best way to collaborate...
Instead, we will be focusing on working together like you might in a Google Doc or in an Ed
Workspace. This allows us to work together more closely than if we were to just work on our own and make our own git commits. This practice is also known as pair programming.
Pair programming has many beneits to working solo - generally it is much easier to integrate
diferent parts of the program as both programmers are available for decision-making and changes. It also decreases the number of mistakes made (such as a pesky typo) since there is always another pair of eyes constantly reviewing (and in your case, updating) the code.
To achieve this goal, we will be using the VSCode extension, Live Share. It allows for any number of people to 'join' your VSCode and develop code together -just like you would in other collaborative solutions. If you haven't yet installed the extension, you can do it easily by opening VSCode, press Ctrl+P to open the 'Quick Open' menu at the top of the window, then paste the following command ext install MS-vsliveshare.vsliveshare to install the plugin. Once done with this, follow the quick start guide in the above link to get yourselves connected to each other.
Welcome to A2 - AI Viruses!
Now that you've acquainted yourself with Stacks, Queues, Lists and the like, it's time to explore more complex data structures, and use them to solve more complicated tasks!
In this assignment, you'll work on the following features:
A computer network representation
A plot view that shows the longest routes suitable for a given virus
A route organiser that keeps track of the relative ranking of routes
In doing this, you'll need to demonstrate knowledge on the following topics:
Linked Structures
Hash Tables and their various methods / approaches
Use of recursive sorting algorithms and recursive methods
Please Note: With the advent of A2, the ban on python inbuilts is mostly lifted with the exception of the sorted function and dict inbuilt type! Feel free to use list and all other python functionality to its full extent.
The only exception on this exception is that if you are essentially using a list as a stack then please use the provided LinkedStack instead.
Please make sure to read the next slide for some important information before diving into the rest of the assignment.
Please read all instructions carefully. It is useful to have a general understanding of the app and of routes before you begin; however, you do not need a deep understanding to complete most of the tasks.
IF YOU FORK THE REPOSITORY, I WILL HUNT YOU DOWN
and politely ask you to delete it and create a new repository using the template.
The template git repository can be found here. Follow the instructions in the "Getting Started with Git" document to copy across the repository (KEEPING IT PRIVATE) and get coding.
DO NO FORK THE REPOSITORY. Please use the 'Use Template' button instead. Anyone that FORKS could be in breach of Academic Integrity and liable for penalties that apply.
Important Information, Tips and Tricks
Before you get working on the application, please read these tips & tricks to ensure you don't get lost, or lose any silly marks!
Group Work
This is the first assignment you'll be doing in groups.
Common Mistakes
You are marked on correctness in Ed. It doesn't matter if your code passes locally, it needs to pass in Ed. Contact a TA if you are having trouble achieving parity.
Be careful of the specific Python version used, and don't import any other third party modules. Write clear and concise docstrings for methods you introduce / edit.
If introducing new classes, consider using dataclasses to simplify this definition.
Separate your code into small methods of at most 20 lines, and try to abstract logic if you find lots of duplicated work.
Note: Almost all methods in the sample solution are 10 lines or less.
Initial Setup + Running Tests
To get up and running you want to do a few things:
Import the template repository - Follow the instructions in the Getting Started with Git page.
To run tests, call python run_tests.py . Note that you can restrict which tests are run using a second
argument. For example, running python run_tests.py 1 will only run tests from the tests/test_ route_edits.py file.
What files should I be editing?
Everything for the assignment can be solved in the following files:
computer_manager.py
computer_organiser.py
computer.py
double_key_table.py
infinite_hash_table.py
route.py
virus.py
Assumptions & Tidbits
dataclasses are used in some of the scafold code. In short, they do a lot of the initialisation boilerplate for you by inspecting the type hinting for class variables. You'll be expected to understand at a high level what this does to get started with your route tasks. You should read more about it here.
This project also uses abstraction with the abc module. You can read more about it here.
Since this is a virus network traversal app, here's some recommended listening while you knock these tasks out of the park!
What is a route?
Wiktionary defines a route to follow diferent paths through any network.
In this assignment, a route is a connection both between and passed computers.
Motivating the basic components of a route
The basic route
The most simple form. of a route is:
1. A line with no computer on it; or
2. A line with a computer on it.
Combining Routes
We can combine two routes to form. a larger route:
1. In parallel (Branching paths); or
2. In series (One after the other).
All possible route can be generated by combining routes according to these rules.
Defining a Route in Code
We can define a route more formally using the following rules:
Route is wrapper class* and takes exactly one argument. It can take one of the following objects:
None, RouteSeries, or RouteSplit . These are typed as RouteStore in the code (this uses the
typing Union, which means whenever we mention RouteStore , we are saying "this variable is either a RouteSeries , RouteSplit or None "). A Route is represented by a Route object containing some RouteStore , which might in turn contain more Route objects in the hierarchy.
* For more information about wrappers, see this wiki article.
The simplest route we can have is a line with no computer.
This is the route object Route(None) .
We can combine routes in sequence by having a computer and a route.
This is the RouteStore object RouteSeries(Computer(name, difficulty, length), Route(...)) .
RouteSeries takes exactly two arguments.
The fi rst argument must be a computer, and this is the only way we can add a computer to a route.
The second argument is the remaining Route that follows.
We can combine routes in parallel by having three routes: two which are in parallel, and the route that follows.
This is the RouteStore object RouteSplit(Route(info), Route(info), Route(info)) . RouteSplit takes exactly three arguments.
The fi rst argument is the route that splits upwards
The second argument is the route that splits downwards
The third argument is the route that follows once the previous two join together
Seeing it all in action
Note that every Route object in code has a store , which contains one of the 3 objects above. So for example, we could model the below image with the following object:
route = Route(RouteSplit(
Route(RouteSplit( # The top branch
Route(RouteSeries(
Computer("top-top", 5, 3, 0.1),
Route(None),
)),
Route(RouteSeries(
Computer("top-bot", 3, 5, 0.2),
Route(None),
)),
Route(RouteSeries(
Computer("top-middle", 4, 7, 0.3),
Route(None),
)),
)),
Route(RouteSeries( # The bottom branch
Computer("bottom-1", 2, 5, 0.4),
Route(RouteSplit(
Route(RouteSeries(
Computer("bottom-2", 0, 0, 0.5),
Route(None),
)),
Route(None),
Route(None),
)),
)),
Route(RouteSeries( # The following branch
Computer("final", 4, 4, 0.6),
Route(None),
)),
))
Which also looks like the following memory diagram (click the image to enlarge):
Fun side note, not required for assessment: The definition here is near identical to Series-Parallel graphs.
[TASK] Route creation & Edit methods
It is highly recommend you fully read and understand the slide "What is a route?" before continuing.
Complexity Analysis is not required for this task
In this task, you'll be working on:
route.py
The fi rst task is to add a few helper methods to the Route definitions in route.py to support editing the Routes.
In route.py , you'll find the following methods on a few diferent classes, already type hinted for you:
remove_branch
remove_computer
add_computer_before
add_computer_after
add_empty_branch_before
add_empty_branch_after
These methods can be used to add and remove elements from the route. They should not modify the existing Route, but create new Route / Route Store objects representing what the route would look like if edited.
If this method is defined on the Route class, you should return a new Route instance, which has completed the action specified.
If this method is defined on a RouteStore class, you should return a new RouteStore instance, which has completed the action specified.
For example, suppose we have the following:
a, b, c, d = (Computer(letter, 5, 5, 0.2) for letter in "abcd")
empty = Route(None)
series_b = RouteSeries(b, Route(RouteSeries(d, Route(None))))
split = RouteSplit(
empty,
Route(series_b),
Route(RouteSeries(c, Route(None)))
)
t = Route(RouteSeries(
a,
Route(split)
))
This is represented by the following diagram:
Calling series_b.add_empty_branch_after() returns the following object:
RouteSeries(
computer=b,
following=Route(store=RouteSplit(
top=Route(store=None),
bottom=Route(store=None),
following=Route(store=RouteSeries(
computer=d,
following=Route(store=None)
))
))
)
While calling split. remove_branch should return the following object:
RouteSeries(
computer=c,
following=Route(store=None)
)
And calling empty.add_empty_branch_before() should return the following object:
Route(store=RouteSplit(
top=Route(store=None),
bottom=Route(store=None),
following=Route(store=None)
))