- This project is to provide a way to :
- Reduce traffic congestion
- Reduce delays
- Prioritize emergency vehicle
- Optimizing traffic light timing
- It is a web-based solution to optimize the traffic effectively
- Please view the document 'QUBO-Equation.pdf' to check the equations used
- 'DOME' is just a name, easy to call =)
- Clone the project repo into any desired folder
- Navigate to traffic-app folder
- Create a virtual environment
- Activate the virtual environment
- Install the dependencies
- Start the server
- Interface to input the city network (may seem a little robust :) but improving)
- Give priority to emergency vehicles
- Finds three best routes using k_simple_path algorithm
- Utilize congestion parameter to optimize the green the green light timing (aims to increase the time at most congested places)
- Runs Optimization using QUBO formation to find the best of three paths for each Vehicle
- Currently, using dimod exactSolver to simulate solving of QUBO on a Quantum Annealer
- Utliized networkx library to form and visualize directed graphs
- Each road (edge) has two parameters : congestion (no of vehicles) and distance (the length of road)
- Each vehicle input consist of two parameters : source node, destination node
- First the model routes emergency vehicles and after that normal vehicles
- Using networkx k_simple_path algorithm (essentially multiple times dijkstra) we find all the simple paths (non-cyclic) from source to destination (for each vehicle)
- Used Jaccard Similarity Index to find least overlapping paths
- Formed i*j binary variables where i = number of Cars and j = number of alternative routes
- Implemented weight for each binary variables based on following :
- If non emergency car then increase the weight
- Each of the three routes are prioritized based on an overall parameter : (1.5*total_congestion + 1*total_distance)
- Congestion heavier parameter then distance (more weight)
- Finally formed the QUBO matrix based on the equation
- Solved it (for now) using dimod's exactSolver (classical simulator) which aims to minimize the total energy
- For optimizing traffic light timing :
- Asssumed that traffic signal is present at each road ith point if road is going from j to i
- the weight of each signal is determined by the congestion at that road
- Due to memory limitations, please look at the QUBO implementations details of traffic Signal (in city-network.ipynb) only
NOTE : For testing sample data , please check city-network.ipynb and if you want to insert your own network please install the traffic-app following the instructions below
Library Name | Version |
---|---|
Python | 3.8 |
Jupyter Notebook | 6.5.4 |
Please type the following commands inside Anaconda Prompt
git clone https://github.com/Aksgo/City-traffic-optimization.git
cd ./traffic-app
conda create --name traffic-app-env python=3.8
conda activate traffic-app-env
pip install -r requirements.txt
python app.py
Below are some images of application for a sample in city-data.txt
-
NOTE : I have improvised and changed the formulation from those given earlier in write-up