Decision Intelligence platform for Traffic Crossing Signal Control

opendilab, updated 🕥 2022-11-05 02:59:35



Twitter Style Docs Code test codecov Loc Comments

GitHub Org's stars GitHub stars GitHub forks GitHub commit activity GitHub license


DI-smartcross doc

DI-smartcross is an open-source Decision Intelligence platform for Traffic Crossing Signal Control task. DI-smartcross applies several Reinforcement Learning policies training & evaluation for the traffic signal control system in provided road nets. DI-smartcross is application platform under OpenDILab.

DI-smartcross uses DI-engine, a Reinforcement Learning platform, to build RL experiments. DI-smartcross uses SUMO (Simulation of Urban MObility) and CityFlow traffic simulator packages to run signal control simulation.

DI-smartcross supports:

  • Single-Agent and Multi-Agent Reinforcement Learning
  • Synthetic and Real roadnet, Arterial and Grid network shape
  • Customizable observation, action and reward types
  • Easily achieve Multi-Environment Parallel, Actor-Learner Asynchronous Parallel when training with DI-engine



DI-smartcross supports SUMO version >= 1.6.0. You can refer to SUMO documentation or follow our installation guidance in documents. CityFlow can be installed and compiled from source code. You can clone their repo and run pip install .

Then, DI-smartcross is able to be installed from the source code. Simply run pip install . in the root folder of this repository. This will automatically install DI-engine as well.

bash pip install -e . --user

Quick Start

DI-smartcross provides simple entry for RL training and evaluation. DI-smartcross supports DQN, Off-policy PPO and Rainbow DQN RL methods with multi-discrete actions for each crossing, as well as multi-agent RL policies in which each crossing is handled by a individual agent. A set of default DI-engine configs is provided for each policy. You can check the document of DI-engine to get detailed instructions on these configs.

Here we show RL training sript for sumo envs, same with cityflow env.

  • train RL policies

Example of running DQN in sumo wj3 env with default config.

bash sumo_train -e smartcross/envs/sumo_wj3_default_config.yaml -d entry/config/

Example of running PPO in cityflow grid env with default config.

bash cityflow_train -e ./smartcross/envs/cityflow_grid/cityflow_grid_config.json -d entry/cityflow_config/

  • evaluate existing policies

Example of running random policy in wj3 env.

bash sumo_eval -p random -e smartcross/envs/sumo_wj3_default_config.yaml

Example of running fix policy in cityflow grid env.

bash cityflow_eval -e smartcross/envs/cityflow_grid/cityflow_auto_grid_config.json -d entry/cityflow_config/ -p fix

It is rerecommended to refer to documation for detailed information.

File Structure

DI-smartcross |-- .flake8 |-- .gitignore |-- .style.yapf |-- LICENSE |-- |-- |-- |-- |-- docs | |-- .gitignore | |-- Makefile | |-- figs | |-- source |-- entry | |-- cityflow_eval | |-- cityflow_train | |-- sumo_eval | |-- sumo_train | |-- cityflow_config | |-- sumo_config |-- smartcross |-- |-- envs | |-- | |-- | |-- | |-- sumo_arterial7_default_config.yaml | |-- sumo_arterial7_multi_agent_config.yaml | |-- | |-- sumo_wj3_default_config.yaml | |-- sumo_wj3_multi_agent_config.yaml | |-- action | |-- cityflow_grid | |-- obs | |-- reward | |-- sumo_arterial_7roads | |-- sumo_wj3 | |-- tests | |-- | |-- |-- policy | |-- | |-- | |-- tests | |-- |-- utils |-- |--

Join and Contribute

We appreciate all contributions to improve DI-smartcross, both algorithms and system designs. Welcome to OpenDILab community! Scan the QR code and add us on Wechat:


Or you can contact us with slack or email ([email protected]).


DI-smartcross released under the Apache 2.0 license.


latex @misc{smartcross, title={{DI-smartcross: OpenDILab} Decision Intelligence platform for Traffic Crossing Signal Control}, author={DI-smartcross Contributors}, publisher = {GitHub}, howpublished = {\url{}}, year={2021}, }


add different settings for ppo

opened on 2022-11-05 02:59:35 by kxzxvbk


Related Issue


Check List

  • [ ] merge the latest version source branch/repo, and resolve all the conflicts
  • [ ] pass style check
  • [ ] pass all the tests


DI-smartcross (beta) v0.1.0 2022-04-24 16:21:47

Initial release of DI-smartcross with SUMO and CityFlow env supported.


Open sourced Decision Intelligence (DI)

GitHub Repository Homepage

traffic-light-control traffic-signal-control reinforcement-learning