Inspiration
Across Monterrey, thousands of gig economy couriers spend 8 to 12 hours a day navigating congested avenues for platforms like Uber Eats, DiDi Food, and Rappi. Unfortunately, legacy delivery applications assign orders using blind FIFO (First-In, First-Out) dispatch queues that treat the city as a flat, frictionless plane:
- They strand couriers on Av. Gonzalitos during rush hour at 10 km/h for meager $30 MXN payouts.
- They force drivers to wait over 20 unpaid minutes in slow restaurant kitchens.
- They calculate straight-line Euclidean distances that completely ignore Monterrey’s imposing topography—such as the Loma Larga mountain ridge separating San Pedro from Monterrey Centro, which in reality requires navigating highway tunnels and complex interchanges.
- They fail to account for severe urban disruptions, such as sudden flash floods along the Par Vial Constitución or high-risk zones where an incident can wipe out an entire day's earnings.
As a result, couriers lose up to 40% of their potential net take-home pay to deadhead kilometers and wasted fuel. We asked ourselves: What if an AI dispatch engine wasn't designed just to maximize platform order counts, but was built to maximize the courier's net take-home profit and physical safety on the real streets of Monterrey?
What it does
DeliMan is a real-time multi-agent AI logistics optimization and simulation arena that pits two cutting-edge AI architectures against a traditional delivery app benchmark (Baseline):
- Agent A ("The Economist" — Deep Q-Network): A Reinforcement Learning agent focused strictly on profit density. It evaluates each incoming dispatch offer using the reward function: $$R = \frac{\text{Net Profit}}{\text{Distance Traveled}} - \lambda \cdot t_{\text{wait}}$$ It filters out empty return legs (deadhead miles) and prioritizes high-margin, fuel-efficient corridors.
- Agent B ("The Hustler" — Google OR-Tools CVRPTW + XGBoost): A high-throughput clustering engine solving the Capacitated Vehicle Routing Problem with Time Windows. It intelligently bundles up to 3 orders into tight, hyperlocal pickup and dropoff routes to maximize successful deliveries per hour.
- Baseline (Traditional App — FIFO): A naive first-come, first-served queue that blindly accepts every incoming order without analyzing traffic, prep delays, or topography.
Operating on Monterrey’s actual road graph via an Open Source Routing Machine (OSRM), DeliMan simulates full 8-hour shifts (480 ticks/minutes), injects live urban crises (Constitución flash floods, BBVA stadium soccer surges, torrential downpours, and road closures), and proves how intelligent dispatch doubles (+100%) courier net earnings while slashing fuel costs by 30%.
The platform also includes a Fleet Operations Console for real-time dispatchers and a Zero-LLM Audit & Compliance Panel featuring 3 clearance tiers (Public, Business, Gov Auditor).
How we built it
We built DeliMan as a modular, high-performance full-stack ecosystem:
- Frontend & Interactive Arena: Built with Next.js 14 (App Router), TypeScript, and Tailwind CSS. We implemented an interactive Leaflet map rendering real Monterrey road geometries, active disaster polygons, and animated courier telemetry streamed via Server-Sent Events (SSE) in real time.
- AI & Optimization Microservice: Developed in Python with FastAPI, powering our core decision engines:
- A PyTorch Deep Q-Network (DQN) trained in a custom OpenAI Gym environment calibrated with empirical delivery datasets for kitchen preparation intervals and tip behaviors.
- A combinatorial solver using Google OR-Tools to resolve multi-objective Capacitated Vehicle Routing Problems with Time Windows (CVRPTW), accelerated by an XGBoost order ranking classifier.
- Urban Physics & Routing Engine: A local containerized instance of OSRM (Open Source Routing Machine) mapped to Monterrey's OpenStreetMap road network. This enforces realistic navigation through the Loma Larga Tunnel, Morones Prieto, and Gonzalitos while calculating live fuel burn ($0.70 MXN/km).
- Database & Provenance Tier: MongoDB Atlas with Mongoose schemas storing shift telemetry and immutable algorithmic decision traces with sub-15 ms query latency.
Challenges we ran into
- Monterrey’s Hostile Orography: Standard routing using Euclidean or Haversine distances yielded absurd assignments (e.g., dispatching an order between San Pedro and Monterrey Centro as if the driver could fly through the mountain). We had to index and deploy an OSRM engine locally with custom speed profiles to force routes through the Loma Larga Tunnel and major corridors.
- High-Speed Real-Time Synchronization: Coordinating the Next.js simulation clock with Python optimization solvers without introducing network latency. We designed an asynchronous batch protocol and a zero-delay Fast-Forward mode capable of evaluating 480 minutes of complex routing in under a second.
- DQN Exploration vs. Exploitation in Disasters: When sudden flash floods hit Av. Constitución, the DQN initially attempted to chase the lucrative surge pricing inside the hazard zone. We tuned the state velocity penalty ($v \le 4\text{ km/h}$) so the agent learned to bypass flooded arteries proactively.
- Explainability Without LLM Overhead: Enterprise operators and regulators demand to know why an algorithm accepted or rejected a specific dispatch. Instead of burning expensive API tokens and adding 2-second response delays with LLMs, we engineered a deterministic Zero-LLM reasoning engine that decodes mathematical decision tensors into natural-language audit reports in milliseconds.
Accomplishments that we're proud of
- Empirical Economic Impact: Proving quantitatively that over an 8-hour shift under real urban disruptions, a courier's net take-home pay jumps from $310 MXN on the traditional app to over $620 MXN with DeliMan—a +100% net profit increase.
- Instantaneous Full-Shift Computation: Delivering an "Instantaneous" mode that computes an entire 480-minute shift in milliseconds with full road-path resolution, telemetry preservation, and consolidated financial statements.
- Reactive Disruption Engine: Creating a live, visual physics simulation where agents dynamically re-route around flash floods, road closures, and stadium crowds in real time.
- Enterprise Governance & Compliance Architecture: Building a tiered security clearance model (Public, Business, Gov Auditor) that allows regulatory authorities to audit the mathematical provenance of every dispatch decision without black-box ambiguity.
What we learned
- Courier economics is about margin density, not gross delivery volume: Completing more orders does not lead to higher take-home pay if half the kilometers are driven empty or if the driver spends 30 unpaid minutes waiting at a crowded kitchen counter.
- Hybrid Reinforcement Learning + Combinatorial Optimization outperforms single models: Google OR-Tools is unmatched at clustering multiple orders within compact physical radiuses, whereas DQNs excel at long-term strategic decisions (such as declining a seemingly profitable order that would strand the courier in a dead zone).
- Local physical realities dictate logistics: General routing models designed for flat grid cities fail catastrophically in Monterrey. Mountain ridges, extreme weather, and choke points must be first-class citizens in any loss function.
What's next for DeliMan
- Multimodal Fleet Expansion: Introducing specialized vehicle profiles and fuel/battery consumption curves for electric bicycles, small-displacement motorcycles, and compact delivery cars.
- Edge AI Mobile SDK: Packaging our lightweight neural nets and heuristic solvers to execute directly on the driver's smartphone, guaranteeing zero-latency dispatch advice even during cellular outages.
- Point-of-Sale (POS) Kitchen Integration: Integrating directly with restaurant POS systems to synchronize courier arrival with exact plate preparation times, eliminating counter wait times.
- Live Fleet Pilot in Monterrey: Partnering with local courier cooperatives and independent last-mile logistics fleets across the Monterrey metropolitan area for real-world pilot deployments.
Built With
- docker
- mongodb
- next.js
- postgresql
- python
- react
- render
- tailwind
Log in or sign up for Devpost to join the conversation.