This is a multi-agent reinforcement learning solution to Flatland3 challenge. The solution itself is elaborated on in our paper.
Jiang, Yuhao, Kunjie Zhang, Qimai Li, Jiaxin Chen, and Xiaolong Zhu. "Multi-Agent Path Finding via Tree LSTM." arXiv preprint arXiv:2210.12933 (2022).
$ git clone http://gitlab.parametrix.cn/parametrix/challenge/flatland-marl.git
$ cd flatland-marl
The code is tested with Python 3.7 and is expected to also work with higher versions of Python. If you are using conda, you can create a new environment with the following command (optional) :
$ conda create -n flatland-marl python=3.7
$ conda activate flatland-marl
We found a bug in flatland environment that may lead to performance drop for RL solutions, so we cloned flatland-rl-3.0.15
and fixed the bug. The bug-free one is provided in folder flatland-rl/
. Please install this version of flatland.
$ cd flatland-rl
$ pip install .
$ cd ..
$ pip install -r requirements.txt
flatland_cutils
is a feature parsing package designed to substitute the built-in flatland.envs.observations.TreeObsForRailEnv
. Our feature parser is developed in c++ language, which is much faster than the built-in TreeObsForRailEnv
.
$ cd flatland_cutils
$ pip install .
$ cd ..
The game rendering relies on OpenGL
. If you are wsl2 user, it is very likely that you don't have OpenGL installed. Please install it.
$ sudo apt-get update
$ sudo apt-get install freeglut3-dev
Run our solution in random environments:
$ cd solution/
$ python demo.py
In a terminal without GUI, you may disable real-time rendering and save the replay as a video.
$ python demo.py --no-render --save-video replay.mp4
We provide a script to generate test cases with the same configuration as Flatland3 challenge round 2. The generation may take several minutes.
$ cd solution/
$ python debug-environments/generate_test_cases.py
$ python demo.py --env debug-environments/Test_3/Level_0.pkl
The Flatland3 challenge is evaluated in Client/Server architecture, which relies on redis. Please go to https://redis.io/docs/getting-started/ and follow the instructions to install redis.
We relies on ffmpeg to generate replay videos.
$ sudo apt-get install ffmpeg
First, start redis-sever.
$ sudo service redis-server start
Then start the flatland-evaluator server.
$ redis-cli flushall
$ FLATLAND_OVERALL_TIMEOUT=999999 flatland-evaluator --tests ./debug-environments/ --shuffle False --disable_timeouts true
Open another terminal, and run our solution.
$ cd solution
$ python remote_test.py --save-videos
Replays are saved in solution/replay/
.
If you use this repo in your research, please cite our paper.
@article{jiang2022multi,
title={Multi-Agent Path Finding via Tree LSTM},
author={Jiang, Yuhao and Zhang, Kunjie and Li, Qimai and Chen, Jiaxin and Zhu, Xiaolong},
journal={arXiv preprint arXiv:2210.12933},
year={2022}
}