Realtime Autonomous Traffic Signal Switching system

As per the report by The Guardian (https://www.theguardian.com/environment/2018/jan/01/vehicles-climate-change-emissions-trump-administration) Vehicles are now America's biggest CO2 source but EPA is tearing up regulations. As electric vehicles provide a decent solution to this problem, scaling this at a global level is a slow process. Hence, we plan to leverage the existing infrastructure to reduce the carbon emission as much as possible. Traffic signal switching happens to be one the weakest link in the entire traffic flow system. The current traffic switching system relies on preset timing or a manual controller system based mechanism. We planned to optimize the traffic light switching system using Reinforcement learning in a non-intrusive method. This is similar to adapting the autonomous helicopter training mechanism to model the Traffic Switching system.

We have successfully integrated our q-learning algorithm with realtime traffic flow information provided by HERE maps API. We collected the data for 3 days, and then performed a comparative analysis (plots attached) on how much improvement in traffic flow our model can achieve in terms of average waiting time.

We extended the model to have large negative weights when important vehicles (ambulance, police, fire cars) gets stopped at signals. The algorithm adapts itself to provide a congestion free path for them as much as possible. For example: In case of an emergency, the entire traffic flow system optimizes itself to reduce the waiting time for the emergency vehicle and hence in turn improve the efficiency of emergency services.

How to run the code :

OS requirement: *nix machine

Run this on terminal

To run the live demo :

$ java Main $(echo `node fetch_stats.js`)

To generate graphs :

$node script.js 
$make
$java Main dailytime.csv 
$sudo pip install -r requirements.txt 
$python plotting.py

Visualization

https://github.com/prakhar-agarwal/Traffic-Light-Switching-using-Reinforcement-Learning/blob/master/ambulance-1-d79d2a29f8.gif

  • Values in brackets next to the roads are traffic intensity values fetched via HERE-MAPS api.
  • An ambulance is added(location randomly generated - RED/WHITE - MG Road to Kasturba Road) to indicate autonomous Traffic signals switching to provide congestion free path to important vehicles

Built With

Share this project:

Updates