GithubHelp home page GithubHelp logo

roboeden / flatland-marl Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 5.0 34.86 MB

A multi-agent reinforcement learning solution to Flatland3 challenge.

License: MIT License

Makefile 0.25% Python 86.81% Batchfile 0.04% Shell 0.03% C++ 12.53% C 0.34%

flatland-marl's Introduction

Flatland-MARL

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).

Install Dependencies

Clone the repository.

$ 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 

Install flatland

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 ..

Install other requirements

$ pip install -r requirements.txt

Build flatland_cutils

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 ..

For WSL2 users only

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

Usage

Quick demo

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

Test as Flatland3 challenge round 2

Generate test cases

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

Test in a specific case

$ python demo.py --env debug-environments/Test_3/Level_0.pkl

Run the whole Flatland3 challenge round 2

Install redis

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.

Install ffmpeg

We relies on ffmpeg to generate replay videos.

$ sudo apt-get install ffmpeg

Start flatland-evaluator

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/.

Bibtex

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}
}

flatland-marl's People

Contributors

liqimai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flatland-marl's Issues

Error when installed the flatland environment

Hi, I am studyidng your interesting work. However, when I installed the flatland environment you provided, the following error occured. Could you help me deal with it? Thank you !

微信图片_20230117105026

how can I train the Neural network?

I'm a rookie.I would love to be able to repeat the training process, but I can only run the provided network model on the local machine. I would like to try the process of training the neural network, can you give me a link to a simple tutorial? thank you。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.