# The Economic Order Quantity Model with Backlogging¶

All code in one file

We consider an Economic Order Quantity (EOQ) model with backlogging. This is like the normal EOQ model, but we do not order when the inventory level is 0, but equal to some level $$s\leq 0$$. This extra degree of freedom should make the average cost per unit time smaller provided $$s$$ is chosen appropriately. We are going to check this on this page.

We use the following notation:

$\begin{split}\begin{split} Q &= \text{ordering amount} \\ D &= \text{Demand rate} \\ s &= \text{Order level} \\ h &= \text{holding cost per item per unit time} \\ b &= \text{backlogging cost per item per unit time} \\ K &= \text{Ordering cost} \end{split}\end{split}$
from __future__ import division
from math import sqrt

def averageCost(Q, D, s, h, b, K):
I = (Q-s)/2.     # average inventory level
B = s/2.         # average backlog level

TI = (Q-s)/D     # Time the inventory level is positive
TB = s/D         # Time the inventory level is negative
T = TI + TB      # Total cycle time

cI =  h*I*TI     # Total holding cost
cB =  b*B*TB     # Total backlogging cost
cT = cI + cB + K # Total cycle cost

cA = cT/T        # Average cost
return cA

D = 4
s = 1
h = 1
b = 3
K = 10
Q =  8.

print("Average cost with backlogging: ", averageCost(Q, D, s, h, b,
K))

print("Average cost without backlogging: ", averageCost(Q, D, 0, h, b,
K))

Average cost with backlogging:  8.25
Average cost without backlogging:  9.0


The cost with $$s=0$$ should be minimal when we order the optimal order quantity, which is given by the famous EOQ formula.

def EOQ(D, h, K):
return sqrt(2.*D*K/h)

Q = EOQ(D, h, K)

print(averageCost(Q-1, D, 0, h, b, K))
print(averageCost(Q-0.5, D, 0, h, b, K))
print(averageCost(Q, D, 0, h, b, K))
print(averageCost(Q+0.5, D, 0, h, b, K))
print(averageCost(Q+1, D, 0, h, b, K))

9.00721033980928
8.959074844027372
8.94427190999916
8.957507445908249
8.99455211196118


The minimal cost that can be achieved is given by the formula

$\begin{split}g^* &= \sqrt{2DK bh/(b+h)} \\ S^* &= g/h\\ s^* &= -g/b\end{split}$
g = sqrt(2.*D*K*b*h/(b+h))
print("g^* = ", g)
print("s^* = ", -g/b)
print("S^* = ", g/h)

g^* =  7.745966692414834
s^* =  -2.581988897471611
S^* =  7.745966692414834