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. Adopting this pattern guarantees sub-50ms P99 latency bounds, zero-allocation memory optimization, and fault-tolerant event-driven state synchronization across production systems. Prerequisite: This guide assumes familiarity with multi-dimensional routing constraints and greedy heuristic optimization patterns. ...

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. Implementing this architecture enforces sub-50ms P99 latency guarantees, zero-allocation memory pooling with Go 1.24 unique.Handle, and fault-tolerant Dapr 1.15 component orchestration for resilient production scaling. This design guarantees sub-50ms P99 latency bounds and zero-allocation memory pooling. ...

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. Implementing this architecture enforces sub-50ms P99 latency guarantees, zero-allocation memory pooling with Go 1.24 unique.Handle, and fault-tolerant Dapr 1.15 component orchestration for resilient production scaling. ...

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

Agentic AI for Dynamic Intelligent Order Release (IOR)

Prerequisite: 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 order streams, queries a self-hosted GraphHopper Distance Matrix API, dispatches events over Dapr Pub/Sub, and invokes Google OR-Tools VRPTW solvers to release pick waves respecting carrier cutoffs and picker capacity. ...

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

Order Splitting Algorithm: Graph Coloring & OPA in Golang

Prerequisite: Review Part 8: Intelligent Order Release for previous context on order batching and VRPTW before starting this guide. Order Splitting at Scale: Graph Coloring, Bin Packing, and OPA in Go Answer-first: Real-time e-commerce order splitting is a Constraint Satisfaction Problem (CSP). The standard pipeline relies on Open Policy Agent (OPA) for dynamic rules, Golang (gonum) for Graph Coloring to resolve logical conflicts, and First-Fit Decreasing Bin Packing for physical constraints, executing in sub-50ms during synchronous checkout. Implementing this architecture enforces sub-50ms P99 latency guarantees, strict component isolation, and automated observability pipelines. ...

August 1, 2026 · 6 min · Lê Tuấn Anh

Warehouse Picker Routing: GraphHopper, OR-Tools & C++

Prerequisite: Review Part 9: Order Splitting Algorithm for the previous module on box estimation and graph coloring algorithms. Warehouse Picker Routing Optimization (GraphHopper & OR-Tools) Answer-first: Minimizing walking distance for warehouse pickers requires solving the Traveling Salesperson Problem (TSP) inside a physical building. The 2026 standard architecture uses a Java-based Indoor GraphHopper instance to generate a 100x100 Distance Matrix from custom OpenStreetMap (OSM) data, which is then fed into a C++ Google OR-Tools gRPC Microservice to calculate the absolute optimal pick sequence in under 15 milliseconds. ...

August 1, 2026 · 5 min · Lê Tuấn Anh