This is the multi-agent reinforcement learning system that aims to optimize the emergency services pipeline in rwanda.
# Kigali EMS — Multi-Agent Reinforcement Learning for Emergency Dispatch
A research-grade simulation platform that applies **Deep Q-Networks (DQN)** and **Multi-Agent Reinforcement Learning (MARL)** to optimise emergency medical service dispatch and traffic signal control across Kigali, Rwanda. The system is built on a full digital twin of the Kigali road network derived from OpenStreetMap, simulated with SUMO (Simulation of Urban MObility), and deployed through a live FastAPI backend with a React dashboard.
This project was developed as an academic capstone in partial fulfilment of a Bachelor of Science degree in Software Engineering.
## Table of Contents
- System Overview
- Key Features
- Repository Structure
- Prerequisites
- Local Setup
- Running the Notebooks
- Training the Models
- Evaluation
- Live Server & Dashboard
- Architecture
- Model Details
- Benchmark Results
- Configuration Reference
- Acknowledgements
## System Overview
Emergency response time is one of the strongest predictors of patient survival in trauma and cardiac events. In a rapidly urbanising city like Kigali, a growing population, dense road network, and a limited ambulance fleet make optimal dispatch a genuinely hard combinatorial problem. Static rule-based protocols — dispatch the nearest idle unit — ignore real-time hospital congestion, dynamic traffic, and incident severity.
This platform addresses that gap by training two cooperative AI agents:
- **Dispatch DQN** — a Deep Q-Network that decides *which ambulance* to send to each incoming incident, learning to minimise the total time-to-care (drive time + emergency department wait time).
- **Traffic MARL** — a parameter-shared Multi-Agent Q-Learning controller that manages traffic signal phases citywide, prioritising green waves for approaching emergency vehicles.
Both agents are trained offline in a headless SUMO simulation of Kigali and evaluated against three heuristic baselines: random dispatch, nearest-idle dispatch, and se …