Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🌊 Bullwhip Effect Simulator

Python License Topic Status

Demand amplification analysis across multi-echelon supply chains — quantifying order variance ratios from retail to manufacturer


📋 Overview

The bullwhip effect is one of the most well-documented phenomena in supply chain management: small fluctuations in end-consumer demand get progressively amplified as orders propagate upstream through the supply chain. A 5% increase in retail demand can become a 40% surge at the manufacturer level.

This simulator models the bullwhip effect across a configurable N-tier supply chain using the methodology from Professor Hau Lee's landmark 1997 paper. Each tier applies an order-up-to policy with moving-average demand forecasting and safety stock calculations, producing the characteristic demand amplification pattern.

Key capabilities:

  • Configurable N-tier supply chain (Retailer → Wholesaler → Distributor → Manufacturer)
  • Stochastic demand generation with adjustable mean and variance
  • Order-up-to inventory policy with moving-average forecasting
  • Variance ratio computation quantifying amplification at each tier
  • Sensitivity analysis across lead times, safety factors, and forecast windows

🏗️ Architecture

flowchart LR
    D[🛒 Consumer\nDemand μ=100 σ=15] --> R[📦 Retailer\nLT=2, SF=1.5]
    R -->|Orders\n1.0x variance| W[🏪 Wholesaler\nLT=3, SF=1.5]
    W -->|Orders\n~2x variance| Di[🏭 Distributor\nLT=4, SF=1.5]
    Di -->|Orders\n~4x variance| M[🔧 Manufacturer\nLT=5, SF=1.5]

    style D fill:#e1f5fe
    style R fill:#fff9c4
    style W fill:#ffe0b2
    style Di fill:#ffccbc
    style M fill:#ffcdd2
Loading

❗ Problem Statement

The Demand Amplification Problem

In a typical 4-tier supply chain, order variance amplification follows a predictable but costly pattern:

Tier Role Typical Variance Ratio Cost Impact
Tier 0 Retailer 1.0x (baseline) Moderate safety stock
Tier 1 Wholesaler 1.5–2.0x Excess inventory builds
Tier 2 Distributor 2.5–4.0x Capacity over-investment
Tier 3 Manufacturer 4.0–8.0x Production whiplash, overtime

Root causes (Lee et al., 1997): demand signal processing, order batching, price fluctuation gaming, and rationing/shortage gaming. Each tier adds its own noise to the demand signal, compounding upstream.

"Information distortion is magnified as it moves up the supply chain — companies at each stage have a progressively more distorted view of true demand." — Hau Lee, Stanford GSB


✅ Solution Methodology

  1. Demand Generation — Stochastic consumer demand with configurable mean (μ), standard deviation (σ), and seed for reproducibility
  2. Tier Modeling — Each supply chain tier maintains independent inventory, applies order-up-to policy using rolling 8-period moving average forecast
  3. Safety Stock Calculation — Tier-specific safety factors multiplied by demand standard deviation and square root of lead time
  4. Order Amplification — Orders placed upstream include forecast demand + safety stock replenishment − current inventory position
  5. Variance Ratio Analysis — Order variance at each tier divided by retailer order variance produces the bullwhip amplification metric

💻 Quick Start

Prerequisites

Requirement Version
Python 3.8+
pip Latest

Installation

git clone https://github.com/virbahu/bullwhip-effect-simulator.git
cd bullwhip-effect-simulator
pip install -r requirements.txt

Usage

from bullwhip_simulator import BullwhipSim

# Run simulation: 52 weeks, 4-tier supply chain
sim = BullwhipSim(n=4)
results = sim.run(T=52, mu=100, sig=15, seed=42)

print("Variance Ratios (bullwhip amplification):")
for tier, ratio in results.items():
    print(f"  {tier}: {ratio}x")

# Output:
# Retailer:     1.0x
# Wholesaler:   1.87x
# Distributor:  3.42x
# Manufacturer: 6.15x

📦 Dependencies

numpy
matplotlib

📚 Academic Foundation

Based on Professor Professor Hau L. Lee, Stanford GSB
Key Reference Lee et al. (1997) The Bullwhip Effect in Supply Chains. Sloan Management Review, 38(3), 93-102.


👤 Author

Virbahu Jain — Founder & CEO, Quantisage

Building the AI Operating System for Scope 3 emissions management and supply chain decarbonization.

🎓 Education MBA, Kellogg School of Management, Northwestern University
🏭 Experience 20+ years across manufacturing, life sciences, energy & public sector
🌍 Scope Supply chain operations on five continents
📝 Research Peer-reviewed publications on AI in sustainable supply chains

📄 License

MIT License — see LICENSE for details.

Part of the Quantisage Open Source Initiative | AI × Supply Chain × Climate

About

Bullwhip effect simulator based on Hau Lee (Stanford) research — demand amplification across multi-echelon supply chains

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages