Skip to content

A multi-agent deep reinforcement learning model to de-traffic our lives

License

Notifications You must be signed in to change notification settings

DeTraffic/detraffic

Repository files navigation

DeTraffic logo

DeTraffic

DeTraffic is a multi-agent deep reinforcement learning model to de-traffic our lives.

Table Of Contents

  1. Installation
  2. Development
  3. Running experiments
  4. Acknowledgement
  5. License

Installation

SUMO

You have to install SUMO beforehand.

sudo add-apt-repository ppa:sumo/stable
sudo apt-get update
sudo apt-get install sumo sumo-tools sumo-doc

Don't forget to set SUMO_HOME variable (default sumo installation path is /usr/share/sumo)

echo 'export SUMO_HOME="/usr/share/sumo"' >> ~/.bashrc
source ~/.bashrc

Important: for a huge performance boost (~8x) with Libsumo, you can declare the variable:

export LIBSUMO_AS_TRACI=1

Notice that you will not be able to run with sumo-gui or with multiple simulations in parallel if this is active (more details).

DeTraffic

If you do not have poetry installed:

pip install poetry

For testing:

poetry install --without-dev # for newer versions of poetry
poetry install --no-dev # for older versions of poetry

For development purposes:

poetry install

And then you can dive into the environment with:

poetry shell

Development

After the installation, there are several steps to follow for development.

pdoc

pre-commit

pre-commit install

pytest

mypy

ruff

refurb

Running experiments

You can check predefined experiments at experiments and models at models, or define your own experiments or models.

poetry shell
python detraffic/benchmark.py

Acknowledgement

This repository contains code from PyTorch Reinforcement Learning (DQN) Tutorial and efficient-kan. Also containts SUMO installation steps from sumo-rl.