Inventory Simulation

Powered by SimPy: Process-based discrete-event modeling in Python

This application uses SimPy to model multi-product continuous-review inventory systems with realistic demand, lead times, and cost structures. Built atop SimPy’s event-driven engine, it accurately simulates (r,Q) and (s,S) policies under stochastic demand and can be extended to more complex scenarios.

🔍 View Full Screen

Inventory Simulation

SimPy-based continuous-review inventory with (r,Q) and (s,S) policies, multi-product support, and detailed cost tracking.

1) Why It Matters — The Cost of Poor Replenishment

Fixed rules that ignore variability cause both overstock and stockouts. In continuous-review systems these show up as unnecessary holding costs, lost sales/backorders, and too many small rush orders.

  • Overstock → capital tied up & storage cost.
  • Stockouts → lost sales or degraded service.
  • Unstable ordering → higher setup & expediting cost.
Goal: choose reorder thresholds and policy parameters that reduce average cost while maintaining service.
Multi-product Continuous-review (r,Q) & (s,S) Stochastic demand & lead time

2) System Model — What We Simulate

Core assumptions

  • Demand: Poisson arrivals; each customer draws a discrete demand size.
  • Lead time: exponential per order.
  • Policy per product: (r,Q) or (s,S) (exactly one active).
  • Shortage handling: backorders or lost sales (per product).
  • Costs: holding, shortage, and ordering (setup + per unit).

What you configure

  • Review interval and horizon (periods).
  • Demand/lead distributions, Q or S, and cost rates.
  • Backlog vs. lost sales behavior.

Each period: receive due orders → draw demand → update stock & costs → reorder if the inventory position crosses its threshold.

3) Simulation Mechanics — One Loop

Inventory position: \(IP_t = \text{on hand}_t + \text{outstanding}_t\).
Reorder: if \(IP_t \le r\), order \(Q\) (r,Q) or up to \(S\) (s,S).
Average cost: \(\bar C = \frac{1}{H}\sum_{t=1}^{H}(C^{hold}_t + C^{short}_t + C^{ord}_t)\).
  • Receive → Demand → Update → Possibly reorder (per product).
  • Run for horizon \(H\); record time-series for charts (inventory, position, demand).

4) Quick Defaults (Example A & B)

Review & horizon

  • Review interval: 1 period
  • Horizon: 60 periods

Demand & lead

  • Arrivals: Poisson
  • Demand size: discrete (per product)
  • Lead time: exponential

Per-product static parameters

  • Product A — policy (s,S): S=50, λ=10, sizes=(0.5,1,1.5), probs≈(⅓,⅓,⅓), L̄=3, costs: hold=1, short=5, setup=32, unit=3, backlog=on.
  • Product B — policy (r,Q): Q=15, λ=8, sizes=(1,2,3), probs=(0.2,0.5,0.3), L̄=2, costs: hold=1, short=5, setup=32, unit=3, backlog=off.

Adjust reorder points and policy parameters in the UI; charts update using the recorded history.

5) What You See — Inputs & Outputs

Inputs

  • Per-product policy: choose (s,S) or (r,Q).
  • Reorder point \(r\), Up-To \(S\) or Quantity \(Q\).
  • Demand & lead distributions; cost rates; backlog option.

Outputs

  • Summary per product: avg cost, holding/shortage/ordering cost, fill rate.
  • Time-series charts: inventory, position, demand.
  • Final state: on-hand and outstanding.

6) References

Try it & Learn More

Explore the Result:

Open live sample
Built with SimPy — a process-based discrete-event simulator for Python.

Inventory Simulation Results

GA over reorder points • Best cost, stop reason, per-product metrics

Open Live Demo