How Optimization and Forecasting Power Amazon Fulfillment

Image for Query-aware index pruning for retrieval under budget constraints

Step 1: Identifying the Learning Outcomes

After studying this material, a student should:

Know the scientific domains powering large-scale fulfillment systems Understand how optimization and forecasting interact in real-world logistics Be able to recognize, formulate, and reason about fulfillment problems using appropriate scientific tools


Step 2: Structured Teaching β€” Concept by Concept


🧱 FOUNDATION: What Problem Are We Solving?

The Core Question:

How do you move hundreds of millions of packages daily β€” efficiently, cheaply, and on time?

Think of Amazon's network as a giant puzzle with:

PieceQuestion
Warehouses (Fulfillment Centers)Which one ships your order?
TrucksWhich route? Which load?
LaborHow many workers are needed?
PromisesCan we guarantee delivery by Tuesday?

Key Insight: No human can solve this manually at scale. This requires mathematical optimization + machine learning.


πŸ”¬ PILLAR 1: Large-Scale Optimization & Planning

What is Optimization?

Optimization means finding the best possible decision among millions of options, subject to constraints.

Formal Definition:

Minimize (or Maximize): Objective Function
Subject to: Constraints

Core Techniques Used


πŸ“ Linear Programming (LP)

Concept: Optimize a linear objective with linear constraints.

Simple Example:

Minimize: 2x + 3y        ← cost function
Subject to:
  x + y β‰₯ 100            ← must ship 100 orders
  x ≀ 80                 ← warehouse A capacity
  y ≀ 60                 ← warehouse B capacity
  x, y β‰₯ 0

In Fulfillment: Allocate orders across warehouses to minimize shipping cost while respecting capacity.


πŸ”’ Mixed Integer Programming (MIP)

Concept: Like LP, but some variables must be whole numbers (integers).

Why needed?

  • You can't assign half a truck
  • A warehouse is either open or closed (binary: 0 or 1)

Example:

x ∈ {0, 1}   ← Is warehouse A used? Yes or No
y ∈ integers  ← How many trucks dispatched?

Challenge: MIP problems are NP-hard β€” they get exponentially harder as scale grows. This is why decomposition methods matter.


βš™οΈ Decomposition Methods

Concept: Break one massive problem into smaller, solvable subproblems.

Analogy:

Instead of solving one impossible 10,000-piece puzzle, break it into 100 manageable 100-piece puzzles, then connect the solutions.

Common Approach β€” Lagrangian Relaxation:

  1. Take a hard constraint
  2. Move it into the objective with a penalty
  3. Solve the relaxed (easier) problem
  4. Iterate until solution is feasible

In Fulfillment: Decompose the global network problem by region, then coordinate solutions.


πŸ”„ Multi-Objective Optimization

Concept: Real problems have competing goals β€” you can't optimize everything simultaneously.

Fulfillment Tradeoffs:

COST  ←————————————→  SPEED
Low cost = slower shipping
Fast shipping = higher cost

Pareto Frontier: The set of solutions where you cannot improve one objective without worsening another.

Speed
  ↑
  |  * ← Pareto optimal solutions
  | *
  |*
  +----------β†’ Cost (lower is better)

Practical Meaning: Leadership uses the Pareto frontier to choose which tradeoff fits business needs today.


🌐 Combinatorial Optimization

Concept: Choosing the best combination from a discrete set of options.

Key Problem Types:

ProblemFulfillment Application
Assignment ProblemWhich order goes to which warehouse?
SchedulingWhen does each truck depart?
Network FlowHow do packages route through the network?

Network Flow Example:

[Warehouse A] ──5 units──→ [Hub 1] ──3 units──→ [Customer Zone X]
[Warehouse B] ──3 units──→ [Hub 1]
                           [Hub 1] ──2 units──→ [Customer Zone Y]

Goal: Maximize flow, minimize cost, respect capacity on each edge.


πŸ€– PILLAR 2: Demand Forecasting & Predictive ML

Why Forecasting Matters

You cannot optimize what you cannot predict.

Before assigning orders to warehouses, you need to know:

  • How many orders will arrive tomorrow?
  • Where will demand be concentrated?
  • How uncertain is that estimate?

πŸ“ˆ Time-Series Forecasting

Concept: Predicting future values based on historical patterns over time.

Structure of a Time Series:

Demand
  ↑
  |    /\      /\
  |   /  \    /  \      ← Seasonal pattern
  |  /    \  /    \
  | /      \/      \___
  +β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β†’ Time
  Mon Tue Wed Thu Fri

Components:

ComponentDescriptionExample
TrendLong-term directionGrowing order volume year-over-year
SeasonalityRepeating patternsMore orders on weekends, peaks in December
NoiseRandom variationUnpredictable daily fluctuations

🌦️ Contextual Information

Concept: Improve forecasts by incorporating external signals.

Examples in Fulfillment:

Base Forecast + Context = Better Forecast

Base: 10,000 orders tomorrow
+ Weather: Snowstorm predicted β†’ +15% online orders
+ Sales event: Prime Day β†’ +200% orders
+ Day of week: Monday β†’ -5% orders
= Adjusted Forecast: ~22,000 orders

Why this matters: Without context, you under-staff warehouses during storms or over-staff during slow periods.


πŸ“Š Probabilistic Forecasting & Uncertainty Quantification

Concept: Instead of one number, produce a distribution of possible outcomes.

Point Forecast vs. Probabilistic Forecast:

Point Forecast:     "Tomorrow: 10,000 orders"

Probabilistic:      "Tomorrow:
                     10% chance: < 8,000 orders
                     50% chance: ~10,000 orders  ← median
                     90% chance: < 13,000 orders"

Why uncertainty matters:

  • Plan for the 90th percentile β†’ avoid stockouts, protect delivery promises
  • Plan for the 50th percentile β†’ minimize cost
  • The right choice depends on business risk tolerance

🧠 Generative AI Models for Forecasting

Concept: Large-scale neural networks (transformers) trained on massive time-series datasets.

Advantage over classical methods:

  • Learn patterns across thousands of products/locations simultaneously
  • Transfer knowledge from one region to another
  • Handle complex, non-linear relationships

Classical vs. GenAI Forecasting:

AspectClassical (ARIMA, ETS)GenAI Models
ScaleOne series at a timeMillions simultaneously
ContextLimitedRich (text, weather, events)
UncertaintyParametric assumptionsLearned distributions
Data neededSmallLarge

πŸ” Causal Inference

Concept: Understanding why something happened, not just what happened.

Correlation vs. Causation in Fulfillment:

Observation: "Orders spike when we send emails"
Correlation: Email β†’ More orders?
Causal Question: Would orders have spiked anyway (holiday)?
                 What is the TRUE effect of the email?

Spatiotemporal Causal Modeling:

  • How does a policy change in one region affect neighboring regions?
  • Did a new warehouse opening actually reduce delivery times, or was it other factors?

Offline Policy Evaluation:

  • Before deploying a new routing algorithm, simulate its effect using historical data
  • Avoid costly real-world experiments

πŸ”— INTEGRATION: How Optimization + Forecasting Work Together

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  DAILY CYCLE                        β”‚
β”‚                                                     β”‚
β”‚  1. FORECAST                                        β”‚
β”‚     "We expect 2M orders tomorrow in Europe"        β”‚
β”‚              ↓                                      β”‚
β”‚  2. UNCERTAINTY QUANTIFICATION                      β”‚
β”‚     "Range: 1.8M – 2.4M with 90% confidence"       β”‚
β”‚              ↓                                      β”‚
β”‚  3. OPTIMIZATION                                    β”‚
β”‚     "Given this demand, assign orders to           β”‚
β”‚      warehouses, allocate trucks, schedule labor"   β”‚
β”‚              ↓                                      β”‚
β”‚  4. MULTI-OBJECTIVE TRADEOFF                        β”‚
β”‚     "Show leadership cost vs. speed options"        β”‚
β”‚              ↓                                      β”‚
β”‚  5. DECISION + EXECUTION                            β”‚
β”‚     "Ship millions of packages"                     β”‚
β”‚              ↓                                      β”‚
β”‚  6. FEEDBACK LOOP                                   β”‚
β”‚     "Actual data improves next forecast"            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ PRACTICAL SKILLS: What Applied Scientists Actually Do

Problem Formulation Workflow

Step 1: WHITEBOARD
  Define: What are we optimizing?
          What are the constraints?
          What data do we have?

Step 2: PROTOTYPE (Python)
  - Build small-scale version
  - Use real data samples
  - Validate logic

Step 3: EXPERIMENT
  - Test against production-scale data
  - Measure performance vs. baseline
  - Iterate on model

Step 4: COMMUNICATE
  - Present Pareto frontiers to operations leaders
  - Translate math into business decisions

Step 5: PRODUCTION
  - Collaborate with engineers
  - Deploy system serving millions of orders

Key Tools & Technologies

ToolPurpose
PythonPrototyping, data analysis
Optimization Solvers (Gurobi, CPLEX)Solve LP/MIP problems
ML Frameworks (PyTorch, TensorFlow)Build forecasting models
Decomposition AlgorithmsScale optimization to real size
Statistical MethodsUncertainty quantification

πŸ“ SUMMARY: Complete Learning Map

QUERY-AWARE INDEX PRUNING FOR RETRIEVAL UNDER BUDGET CONSTRAINTS
(Applied to Fulfillment Optimization)

β”œβ”€β”€ OPTIMIZATION
β”‚   β”œβ”€β”€ Linear Programming (LP)
β”‚   β”œβ”€β”€ Mixed Integer Programming (MIP)
β”‚   β”œβ”€β”€ Decomposition Methods
β”‚   β”œβ”€β”€ Combinatorial Optimization
β”‚   β”‚   β”œβ”€β”€ Assignment Problems
β”‚   β”‚   β”œβ”€β”€ Scheduling
β”‚   β”‚   └── Network Flows
β”‚   └── Multi-Objective Optimization
β”‚       └── Pareto Frontier Analysis
β”‚
└── MACHINE LEARNING / FORECASTING
    β”œβ”€β”€ Time-Series Forecasting
    β”‚   β”œβ”€β”€ Trend, Seasonality, Noise
    β”‚   └── Contextual Features
    β”œβ”€β”€ Probabilistic Forecasting
    β”‚   └── Uncertainty Quantification
    β”œβ”€β”€ Generative AI for Forecasting
    └── Causal Inference
        β”œβ”€β”€ Spatiotemporal Modeling
        └── Offline Policy Evaluation

βœ… Self-Assessment Questions

Test your understanding:

  1. Why can't you use LP alone for truck assignment problems? (Hint: Think about integer constraints)

  2. What is the Pareto frontier and why does leadership care about it?

  3. What is the difference between a point forecast and a probabilistic forecast? When would you use each?

  4. Why is causal inference important before deploying a new routing policy?

  5. How do forecasting and optimization connect in the daily fulfillment cycle?


πŸ’‘ Core Takeaway: Large-scale fulfillment optimization is the art of making mathematically optimal decisions under uncertainty, at massive scale, in real time β€” combining the rigor of operations research with the adaptability of modern machine learning.

More to study