Skip to content

Aadi7171/SwachhVan-Predictive-Resource-Allocation-Matrix

Repository files navigation

SwachhVan — Predictive Resource Allocation Matrix 🚚

A dynamic routing engine for mobile sanitation vans. Instead of treating public washrooms as static infrastructure, SwachhVan models urban foot traffic as a data-driven supply chain problem — forecasting demand before it peaks and routing vans to intercept it.

This project shifts urban sanitation from a reactive chore to an optimized logistics matrix.


The Architecture

[Synthetic Data]      ← 30 days of hourly foot traffic (peaks, weekends, events)
        │
        ▼
[forecaster.py]       ← EWMA baseline + spike detection per zone
        │
        ▼
[router.py]           ← Greedy demand-weighted van assignment (w/ distance penalty)
        │
        ▼
[fleet_manager.py]    ← Tracks vehicle telemetry (lat/lng, status, utilization)
        │
        ▼
[simulator.py]        ← Orchestrates the pipeline over a T-hour window
        │
        ▼
[dashboard.py]        ← Folium HTML map + Matplotlib demand charts

The Simulation (10 Zones, 6 Vans)

The simulation runs over a 24-hour period (by default), fetching live (synthetic) foot traffic data across 10 distinct socio-economic zones in Delhi (e.g., Connaught Place, AIIMS, residential sectors).

Component Logic
Demand Forecasting Exponential smoothing (EWMA, α=0.35) tracks zone baselines. Flags a SPIKE if demand crosses 1.5× baseline.
Routing Algorithm Zones are ranked by forecast demand. The closest available van is assigned, heavily penalized if far away (MAX_SERVE_RADIUS_KM = 5.0).
Fleet Tracking Vans transition through IDLE → EN_ROUTE → SERVING, tracking km travelled and total zones served.

Setup & Usage

# Install dependencies (pandas, folium, matplotlib)
pip install -r requirements.txt

# Run a 24-hour simulation and open the HTML dashboard
python main.py

# Run a 48-hour simulation with a larger fleet (15 vans)
python main.py --hours 48 --vans 15

Output / Dashboard

The simulation automatically generates output/dashboard.html showing:

  • 🗺️ Heatmap of the 10 zones colored by Peak Demand (green/orange/darkred).
  • 🚐 Van Markers tracking the fleet's final assignment status.
  • 📈 Matplotlib Chart comparing the EWMA forecast vs. actual raw foot traffic for the busiest zones.
  • 📊 Telemetry Metrics like Demand Spikes Caught and Avg Demand Served.

Key Design Decisions

  • Why EWMA instead of ARIMA / LSTM? For mobile vans, you don't need highly complex seasonal models — you need fast decay to handle immediate, chaotic spikes (like a sudden protest or concert). EWMA is extremely fast and tunable on edge devices.
  • Why a greedy distance Router? For fleets < 50 vehicles, solving a full VRP (Vehicle Routing Problem) is computationally wasteful. A greedy, demand-sorted assignment with a distance penalty achieves 90% of the efficiency in O(Zones × Vans) time.

About

Dynamic routing engine for mobile sanitation vans that treats urban foot traffic as a data-driven logistics problem — using EWMA forecasting and greedy demand-weighted routing to deploy vans before demand peaks, not after.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages