GithubHelp home page GithubHelp logo

labicon / rl-traffic-dynamics Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 817 KB

Code repo for implementation of RL on traffic headway dynamic controls

License: MIT License

Python 8.98% Jupyter Notebook 91.02%

rl-traffic-dynamics's Introduction

RL-Traffic-Dynamics

License: MIT

Overview

This is the public code repo for the paper at ICRA 2023 London , Learning to Influence Vehicles' Routing in Mixed-Autonomy Networks by Dynamically Controlling the Headway of Autonomous Cars, by Xiaoyu Ma and Prof. Negar Mehr from University of Illinois at Urbana-Champaign.

In this work, we propose that in mixed-autonomy networks, i.e., networks where roads are shared between human-driven and autonomous cars, the headway of autonomous cars can be directly controlled to influence vehicles' routing and reduce congestion. We argue that the headway of autonomous cars -- and consequently the capacity of link segments -- is not just a fixed design choice; but rather, it can be leveraged as an {infrastructure control} strategy to {dynamically} regulate capacities.

This code repo provided is developed as a custom environment on top of OpenAI Gym. By defining the classic traffic network -- Braess network in the format of a gym env, we employed Stable Baselines3 to harness the power of Reinforcement Learning. The current implementation provides an one-on-one control scheme for each link in the classic Braess network. By learning a policy to generate varying headway for links, the resulted vehicle distribution across the network is very different from the one without controlling (constant headway), as shown below, where red links are more crowded and green links are less congested.

Constant Headway (without control) Varying Headway (with control)

The repository include necessary files for running the RL_headway_dynamics project in the classic Braess network. Both Linex local implmentation and jupyter notebook implementation are included for demonstration purpose.

Local Implementation

The local copy of code is located in the gym_traffic folder. To use the code implementation locally, you need to setup a Linex system and install python 3.0+.

After that, run pip torch to install Torch. Similarly, use pip to install all required packages before moving on to register our gym env.

Required packages

torch, gym, stable_baselines3, wandb

Register the Env

Please register the env file as a self-defined env in gym before running the runner.py. gym-traffic/gym_traffic/envs contains the defined traffic model.

Refer to Registering Envs for how to register the custom environment.

Jupyter Notebook Implementation

If you are only planning to use the Jupyter Notebook implementation, simply download the notebook. Without registering the env, you can run the notebook in any Linux environment or online server interface (Google CoLab for instance).

rl-traffic-dynamics's People

Contributors

xiaoyum2 avatar

Watchers

 avatar Kostas Georgiou avatar

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.