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

PartTopicCore Engine & AlgorithmBusiness Impact
Part 1Real-Time Inventory ReservationRedis Atomic Lua, Kafka CDCZero overselling across warehouses
Part 2Multi-Warehouse AllocationGoogle OR-Tools Integer ProgrammingMinimum shipping cost and split shipments
Part 3Distance & Carrier RoutingGraphHopper, Distance Matrix APILowest-cost carrier selection per zip code
Part 4Order Fulfillment EngineGo Microservices EngineSub-10ms allocation latency at 5,000 QPS
Part 8Intelligent Order ReleaseAgentic AI, Dapr Pub/Sub, OR-Tools VRPTWDynamic real-time order batching vs static waves
Part 9Order SplittingOpen Policy Agent, Graph Coloring, First-FitMicrosecond bin packing for cart routing
Part 10Picker RoutingGraphHopper 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:

Split Shipment, Consolidation & Last-Mile Delivery

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. ...

May 6, 2026 · 8 min · Lê Tuấn Anh

Google OR-Tools: Build Delivery Allocation Engine API

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: ...

May 6, 2026 · 8 min · Lê Tuấn Anh

GraphHopper Distance Matrix API for Ecommerce Order Routing

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. ...

May 6, 2026 · 12 min · Lê Tuấn Anh

Agentic AI for Dynamic Intelligent Order Release (IOR)

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. ...

July 31, 2026 · 12 min · Lê Tuấn Anh