Skip to content

Aksgo/DOME-traffic-optimizer

Repository files navigation

DOME Traffic Optimizer

  • 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 =)

  • 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

    Index

    1. Setting up the Project
    2. Features
    3. Preview
    4. DOME implementation

    Setting up the Project

    Required Tech

    Library Name Version
    Python 3.8
    Jupyter Notebook 6.5.4

    Local Installation

    Please type the following commands inside Anaconda Prompt

    1. Clone the project repo into any desired folder
    git clone https://github.com/Aksgo/City-traffic-optimization.git
    
    1. Navigate to traffic-app folder
    cd ./traffic-app
    
    1. Create a virtual environment
    conda create --name traffic-app-env python=3.8
    
    1. Activate the virtual environment
    conda activate traffic-app-env
    
    1. Install the dependencies
    pip install -r requirements.txt
    
    1. Start the server
    python app.py
    

    Features

    • 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

    Preview

    Below are some images of application for a sample in city-data.txt

    DOME Implementation

      NOTE : I have improvised and changed the formulation from those given earlier in write-up

      Summary of Implementation

    • 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

    Copyright ©️ Aksgo, 2025

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published