Back to projects

Stochastic Inventory Explorer

A web app that optimizes reorder policies over thousands of simulated demand futures, not a single forecast.

Most inventory tools size safety stock off a single demand forecast, an average that says nothing about the days that actually cause stockouts. This app instead treats the reorder decision as a stochastic optimization problem: it scores about 240 candidate (r, Q) and (s, S) policies against 1,000 Monte Carlo simulations of a 180-day future built from empirical demand, then returns the cheapest policy that hits a reliability target you choose, a technique called Sample Average Approximation. It runs on three real point-of-sale datasets (two Walmart items from the M5 competition and a heavy-tailed UK gift-shop SKU from UCI Online Retail II), chosen specifically to break different intuitions: a clean baseline, an intermittent-demand item where cycle service level and fill rate diverge, and a fat-tailed item where the closest achievable reliability tops out around 93.5%, short of the usual 95% target. Every run returns a cost-vs-reliability Pareto frontier and a fan chart of simulated inventory paths, plus a plain-English breakdown of the recommendation and a side-by-side comparison against textbook safety-stock rules. The same pipeline also ships as a Jupyter notebook for anyone who would rather read the Python than click through the UI.

Challenges

  • Choosing grid search plus Monte Carlo over an MIP formulation, since the policy space is small and the empirical demand distribution would reduce to scenario sampling anyway
  • Making cycle service level vs. fill rate legible for intermittent-demand SKUs, where the two metrics tell very different stories
  • Failing gracefully on the heavy-tailed scenario, where the closest achievable policy still falls short of the requested reliability target

Outcomes

  • A live web app that scores ~240 candidate policies against 1,000 simulated futures in a couple of seconds, fast enough to feel interactive rather than batch
  • Three real POS scenarios, each picked to teach a different lesson about reliability
  • A parallel Jupyter notebook exposing the same optimizer end-to-end, for anyone who'd rather read the Python

Technologies

Python
NumPy
FastAPI
React
TypeScript
Vite
Docker
Google Cloud Run