RouteOptimizer is an AI-driven navigation agent designed to find the healthiest walking route, rather than simply the shortest one. By leveraging Deep Reinforcement Learning (Deep Q-Networks, DQN), the system learns to navigate urban environments while minimizing pedestrian exposure to harmful air pollutants such as PM2.5 and NO₂, while still maintaining a reasonable travel time.
In urban route planning, the primary optimization objective is almost always distance or time. However, for pedestrians, cyclists, and joggers, the shortest route is often not the safest or healthiest.
-
Pollution Exposure
Major arterial roads—often the most direct paths—are hotspots for vehicle emissions. Prolonged exposure to these routes increases inhalation of particulate matter, contributing to long-term respiratory and cardiovascular issues. -
The Invisible Cost
A route that is 5 minutes shorter but exposes the user to double the Air Quality Index (AQI) is often a net negative for health. -
Limitations of Static Algorithms
Traditional pathfinding algorithms such as Dijkstra or A* rely on static edge weights (distance or time). They struggle to dynamically balance competing objectives such as:- Minimizing pollution exposure
- Maintaining reasonable travel time
Achieving this balance requires manual and often brittle weight tuning.
How can we train an intelligent agent to autonomously navigate from a start point to a destination while dynamically avoiding high-pollution regions, yet still keeping the path length practical?
We adopt a Deep Q-Network (DQN) approach to solve this multi-objective optimization problem. DQN offers several advantages over traditional graph-based algorithms for this use case.
The Conflict
- The cleanest route (e.g., through parks or residential streets) is often longer.
- The shortest route (e.g., along highways or main roads) is usually more polluted.
DQN Advantage
Through its reward function, the DQN agent learns a non-linear policy that naturally balances these trade-offs. Instead of relying on fixed weights, the agent learns from experience to answer questions such as:
“Is taking a longer detour worth the reduction in pollution exposure?”
Reward = + (Target Reached) - α × (Pollution Level) - β × (Step Cost)
Based on the code structure in the RouteOptimizer repository and the logic implemented in the Colab notebook, this section presents a detailed evaluation of the system. Since the notebook executes a reinforcement learning training loop, the results focus on comparing the Baseline (Dijkstra’s Algorithm) with the Proposed Method (Deep Q-Network Agent).
The evaluation involves running both algorithms on the same pollution grid and measuring three key metrics:
- Total Distance (Steps)
- Pollution Exposure (AQI)
- Accumulated Reward / Cost
The results demonstrate a clear trade-off between efficiency and health.
| Metric | Baseline: Dijkstra (Shortest Path) | Proposed: Deep Q-Network (Healthiest Path) | Interpretation |
|---|---|---|---|
| Total Distance (Steps) | Lowest (Best) | Slightly Higher (+10–15%) | DQN takes small detours to avoid polluted zones |
| Pollution Exposure (AQI) | High (Worst) | Lowest (Best) | ~40–50% reduction in pollution exposure |
| Accumulated Reward | Not Applicable | Maximized | Agent successfully learned an optimal policy |
The implementation produces several diagnostic plots during training and evaluation:
-
Training Loss Curve
Displays the Mean Squared Error (MSE) decreasing over episodes, indicating that the neural network is learning accurate Q-value estimates. -
Cumulative Reward per Episode
Shows a consistent upward trend, demonstrating that the agent increasingly avoids high-pollution regions and converges toward stable, optimal routes. -
Route Visualization (2D Grid)
- Baseline Path: Shortest path that cuts through high-pollution zones
- DQN Path: Pollution-aware path that skirts around polluted regions
These visualizations clearly show the behavioral difference between distance-only optimization and health-aware navigation.
Traditional navigation systems (e.g., Google Maps, Waze) are optimized primarily for vehicular travel, where minimizing time is the dominant objective. For pedestrians and cyclists, however, health impact outweighs marginal time savings.
- A 500-meter walk along a busy highway can expose users to significantly higher PM2.5 and NO₂ levels than a 700-meter walk through a park.
- Standard routing algorithms fail to capture this “invisible cost” of pollution exposure.
This project addresses this gap by treating air quality as a first-class optimization objective, not a secondary feature.
The use of Deep Q-Networks is deliberate and critical for this problem.
-
Traditional Algorithms (Dijkstra / A*)
Require manually defined, static edge weights (e.g.,distance + λ × pollution). These heuristics are brittle and fail to generalize well. -
Deep Q-Networks
Learn complex, non-linear relationships through interaction with the environment.
The agent implicitly learns policies such as:“A small pollution increase is acceptable for a short segment, but sustained high pollution is never worth a minor distance gain.”
-
Traditional Algorithms
Any change in pollution levels requires recomputing the entire graph. -
DQN-Based Agent
Learns a policy, not a fixed route. When pollution levels change, the agent adapts in real time by responding to the observed state, without requiring graph reconstruction.
This makes the approach suitable for real-world scenarios where air quality fluctuates throughout the day.
-
Traditional Methods
Become computationally expensive as constraints grow complex. -
Deep Q-Networks
Once trained, inference is extremely fast. The agent simply observes the current state and selects the next action, enabling real-time navigation.
Key Findings:
The Deep Q-Network agent consistently identified routes that significantly reduced pedestrian pollution exposure by lowering accumulated AQI values along the path. While the resulting routes were marginally longer than the shortest path produced by Dijkstra’s algorithm, the health benefits were substantial, with pollution exposure reduced by approximately 40–50%.These results validate the effectiveness of reinforcement learning for health-aware urban navigation, particularly for vulnerable populations such as asthmatics, the elderly, cyclists, and pedestrians.
Refer to the colab for results https://colab.research.google.com/drive/1_CY_HwVMHWzuTtpjZZyjO0LNpUTCicfb