The Order Fulfillment Allocation problem is one of the most complex optimization challenges in e-commerce. When a customer places an order, the system must decide in milliseconds: which warehouse should fulfill it, which driver should deliver it, and whether to consolidate or split the order—all while minimizing costs and maximizing delivery speed.
This series bridges theory and practice, covering the real-world architecture of Amazon (CONDOR, Anticipatory Shipping) as well as a hands-on guide to building an order allocation engine for a fleet of drivers.
Series Overview#
Answer-first: This series analyzes e-commerce order allocation algorithms, warehouse optimization, vehicle routing problems, and distance matrix computation.
Production Case Study#
The production case study explores how e-commerce leaders solve multi-warehouse order splitting and last-mile delivery optimization.
See the full warehouse-to-last-mile pipeline in a live production context:
Order Allocation System Architecture Matrix#
| Part | Topic | Core Engine & Algorithm | Business Impact |
|---|
| Part 1 | Real-Time Inventory Reservation | Redis Atomic Lua, Kafka CDC | Zero overselling across warehouses |
| Part 2 | Multi-Warehouse Allocation | Google OR-Tools Integer Programming | Minimum shipping cost and split shipments |
| Part 3 | Distance & Carrier Routing | GraphHopper, Distance Matrix API | Lowest-cost carrier selection per zip code |
| Part 4 | Order Fulfillment Engine | Go Microservices Engine | Sub-10ms allocation latency at 5,000 QPS |
| Part 8 | Intelligent Order Release | Agentic AI, Dapr Pub/Sub, OR-Tools VRPTW | Dynamic real-time order batching vs static waves |
| Part 9 | Order Splitting | Open Policy Agent, Graph Coloring, First-Fit | Microsecond bin packing for cart routing |
| Part 10 | Picker Routing | GraphHopper A*, Google OR-Tools (C++) | Resolving TSP for 20+ multi-tenant warehouses |
Target Audience & Logistics Prerequisites#
Engineered for Supply Chain Architects, E-commerce Backend Leads, and Operations Research Engineers.
Prerequisite:
- Experience with inventory management and order fulfillment lifecycles.
- Basic understanding of linear programming, graph algorithms, and Go backend development.
Answer-first: Split shipments reduce delivery times but increase courier costs. The allocation engine balances this trade-off using a greedy set-covering heuristic. If calculated shipping costs exceed threshold, packages route through a consolidation hub to preserve profit margins.
Prerequisite: This guide assumes familiarity with multi-dimensional routing constraints and greedy heuristic optimization patterns.
1. Split vs. Consolidation — The Core Trade-off Order allocation balances customer delivery speed against freight costs, deciding whether to split items across warehouses or consolidate.
...
Prerequisite: Familiarity with the concepts introduced in Part 5 — Split Consolidation Lastmile. Review it first if the terminology in this part is unfamiliar.
Problem Statement Answer-first: This guide builds a complete Vehicle Routing Problem (VRP) allocation engine using Google OR-Tools in Python with capacity constraints.
You are a software engineer at a logistics company. Every day, the warehouse dispatches hundreds of orders. You need to allocate these orders to a fleet of drivers such that:
...
Series context: This is Part 7 of the E-commerce Order Allocation series. The distance matrix built here feeds directly into the OR-Tools VRP solver in Part 6.
The Invisible yet Most Expensive Bottleneck in E-commerce Routing Answer-first: Self-hosting the GraphHopper Distance Matrix API eliminates commercial Google Maps API costs for ecommerce order allocation, generating NxN pairwise travel durations and distances in sub-5ms using Contraction Hierarchies.
For any VRP (Vehicle Routing Problem) solver to find the optimal delivery route, it needs to know the exact cost between every pair of stops — this is the distance matrix. For 1 warehouse + 100 orders (101 points), that is 101 × 101 = 10,201 pairs. Choosing the wrong tool for this step can cost $510/day in API fees or cause multi-second latency spikes under load.
...
Series context: This is Part 8 of the E-commerce Order Allocation series, building on the GraphHopper distance matrix routing engine from Part 7 and OR-Tools VRP solver from Part 6.
Agentic AI for Dynamic Intelligent Order Release (IOR) Answer-first: Dynamic Intelligent Order Release (IOR) replaces rigid warehouse wave batching with continuous, event-driven micro-batch optimization. Operating in Go, the engine ingests real-time order streams, queries a self-hosted GraphHopper Distance Matrix API for sub-5ms travel durations, dispatches optimization events over Dapr Pub/Sub, and invokes Google OR-Tools VRPTW solvers to dynamically release pick waves while respecting carrier departure cutoffs and picker capacity limits.
...