Week 01 · Model formulation and conservation

Translate an inventory process into units, variables, and a conservation check.

Subject contents · Week 2 →

Translate an inventory process into units, variables, and a conservation check.

Work through the problem

Let Iₜ be stock at opening, Aₜ arrivals before sales, and Dₜ demand that day. All three are measured in units. Sales are Sₜ = min(Dₜ,Iₜ+Aₜ) and Iₜ₊₁ = Iₜ+Aₜ−Sₜ. Unmet demand is Dₜ−Sₜ. This model loses unmet sales instead of carrying them into the following day.

Starting at 5 units, an arrival of 2 and demand of 9 give 7 sales, 2 lost sales, and 0 closing stock. Summing the daily equation cancels the intermediate stock levels. Initial stock plus all arrivals must equal sales plus final stock.

Run the Python lab

stock = 5
arrivals, demand = [2, 4, 0], [9, 1, 4]
sales = []
for received, wanted in zip(arrivals, demand):
    served = min(stock + received, wanted)
    stock += received - served
    sales.append(served)
    print("sales, lost, stock:", served, wanted-served, stock)
assert 5 + sum(arrivals) == sum(sales) + stock

Output from the lab

sales, lost, stock: 7 2 0
sales, lost, stock: 1 0 3
sales, lost, stock: 3 1 0

Practice

  1. What changes if customers wait for stock?

Check your reasoning

  1. Introduce a backlog state. Unserved units add to tomorrow’s demand instead of disappearing.

Subject contents · Week 2 →

Further reading · MIT 6.262 · Discrete Stochastic Processes