Python代写｜COMP3211 Multi-Agent Path Finding
Imagine in a warehouse, a fleet of robots are designed to pick up packages from certain locations and deliver them to certain ports. They should deliver the packages as efficiently as possible, and at the same time, must not bump into each other or obstacles (no collision).
In this project, you are going to design environment specific controllers for these robots.
There are three environments called small, medium and large – see the appendix. Each environment comes with two fixed goal positions, one for each robot.
For each environment, you need to come up with 2 policies (π1, π2), one for each robot.
A policy for a robot is a function from states to actions, with the following definitions of states and actions:
We will test your policies on some random initial states, and measure the quality of them by the sum of the numbers of actions the robots take to arrive at their respective goal locations.
This project comes with a simulator and a code skeleton.
2.1 File Description
2.2 Environment Set-up
conda create -n mapf python=3.8
conda activate mapf
pip install -r requirements.txt
2.3 Run the Code
conda activate mapf
python run.py –agents p1 p2 –map empty –goals 5_5 1_5 –vis
This command launched two agents named ‘p1’ and ‘p2’ on the map named ‘empty’ and goals are specified as (5,5) and (1,5) for each, respectively. The –vis option turns on the visualizer. Note that the visualizer for large maps is quite slow, you may want to turn off the –vis option for large maps.
Your main task is to implement MyAgent class in agent.py. In particular, you need to implement a MyAgent.get_action() function. This function is basically your controller:
it will be called to decide which action to do in each state. In order for the robot to run in realtime, a hard constraint is that every call to this function will need to return in 1 second. Otherwise the nil action is selected for the agent. This function will have access to information about which environment the robots are in so that your controller can be environment specific.
You are allowed to 1) implement any other helper functions, which can be global functions or member functions; 2) import any other packages. This will enable you to design your controller in any way you want. For example, you can build a database of state-action pairs.
Then your MyAgent.get_action() can simply perform query to this database. However,this is unlikely to be effective for the large map as the number of states is very large.
Another approach is to train a machine learning model for each map, and then use this model in your controller.