Addendum to Chapter 2 of Factory Physics: Formulae

Over the past few years I have been teaching a course on production planning and control based on [hopp08:_factor_physic]. Quite a number of my students had difficulties understanding the details of Chapter 2 on inventory models, both with respect to the derivations of the formulae and the computational aspects. Based on these teaching experiences I wrote this document. It has the following aims:

  1. To derive, in detail, some of the results of Chapter 2 and, in passing, repair the (considerable number of) typos in the book.
  2. I dislike the book’s use of integrals to compute expectations of the involved random variables, as it does not show how to implement the expectations in simple code, or in a spreadsheet, except for the case when the demand in normally distributed. Here I present the relevant formulas for discrete demand.
  3. To provide a list of formulas students are allowed to skip.

I assume a student has Factory Physics at hand when reading this document below. I will not explain the examples of the book, but refer to Factory Physics for background.

Please check http://nicky.vanforeest.com/inventorySystems/inventory.html in case you are interested to see a considerable number of inventory models implemented in python.

In case you find errors or obvious omissions, please let me know by mail.

News boy/vendor model

Let \(X\) (a random variable) be the number of units sold during a particular period, and let \(Q\) denote the number of units ordered. I assume that \(g_i = \P\{ X = i\}\) is given.

Computing the expected number of items left over

To compute the expected number of items over, i.e., unsold at the end of the period, observe that when items are over it must be that \(X< Q\), that is, the demand \(X\) was smaller than the number \(Q\) of items ordered at the start of the period. Therefore, the expected number of

\[\begin{split}\E \max\{Q-X, 0\} &= \sum_{i=0}^\infty \max\{Q-i,0\}\P\{X=i\}\\ &= \sum_{i=0}^\infty \max\{Q-i,0\}g_i\\ &= \sum_{i=0}^Q (Q-i) g_i \\ &= (Q-0) g_0 + (Q-1)g_1+ \cdots (Q-(Q-1))g_{Q-1} + (Q-Q)g_Q\\ &= (Q-0) g_0 + (Q-1)g_1+ \cdots (Q-(Q-1))g_{Q-1} + 0 g_Q\\ &= \sum_{i=0}^{Q-1} (Q-i) g_i,\end{split}\]

as \(Q-i=0\) when \(i=Q\).

Computing the expected number of items short

If there is a shortage of items, it must be that \(X>Q\), hence the expected number short is

\[\begin{split}\begin{split} \E \max\{X-Q, 0\} &= \sum_{i=0}^\infty \max\{i-Q,0\}g_i\\ &= \sum_{i=Q}^\infty (i-Q) g_i \\ &= \sum_{i=Q+1}^\infty (i-Q) g_i. \end{split}\end{split}\]

Expected cost

The expected cost resulting from ordering an amount \(Q\) follows from combing the above two formulas:

\[Y(Q) = c_o \E \max\{Q-X, 0\} + c_s \E \max\{X-Q, 0\},\]

where \(c_o\) is the cost per unit over and \(c_s\) is the cost per unit short.

Formulas to skip

Students do not have to learn the following formulas of in edition 3 of Factory Physics:

  • 2.13, 2.14, 2.15.

Base Stock Model

Let \(I_t\) denote the on-hand inventory at time \(t\), \(B_t\) the number of backorders, \(R_t\) the number of out-standing replenishments, and \(X(t-L,t]\) the demand that occurred during the time interval \((t-L, t]\). Note that here we write \(X(t-L, t]\) to represent the random variable \(X\) of the book.

Some important relations

The above random variables satisfy a number of important relations. First, as for each demand a replenishment order is sent, it must be that

(1)\[R_t = X(t-L, t],\]

that is, the number of outstanding replenishments at time \(t\) equals all demand that occurred during the previous leadtime. Note that here we write \(X(t- L, t]\) to represent the random variable \(X\) of the book. Hence,

(2)\[G(r) = \P\{X\leq r\} = \P\{X(t-L, t])\}.\]

Note that the average demand during a lead time is

\[\theta = \E X(t-L, t].\]

Second, as each demand spawns a replenishment, it must be for all time \(t\) that the inventory level \(I_t\) plus the number of replenishments \(R_t\) minus all backorders \(B_t\) remains constant. That is, \(I_t + R_t - B_t\) is a conserved quantity. Third, we do not backorder demand when there is on-hand stock and we also match backorders (if any) with replenishments as they arrive, it must hold that

(3)\[I_t B_t =0, \text{ for all } t\geq 0.\]

In other words, either the on-hand inventory is \(0\) or the number of backorders is \(0\).

According to the basestock policy we issue a replenishment order as soon as the re-order level \(r\) is hit. Assuming that at time \(t=0\), there are no outstanding replenishments and no backorders, we can safely assume that \(I_0 = r+1\). The above then implies that

(4)\[I_t + R_t - B_t = r+1, \text{ for all } t\geq 0\]

Computing the Service level

The service level \(S(r)\) is defined as the fraction of demand that perceives, on arrival, a positive stock level. As we assume that demand occurs in single units, this fraction is therefore equal to the fraction of demand served from on-hand stock. We also assume that the arrival process is given by a Poisson process. Therefore, by the PASTA property, the fraction of demand served from stock is equal to the (long-run) fraction of time that the inventory level is positive. Hence,

\[S(r) = \P\{I_t >0\}.\]

Using that \(I_t>0\) at time \(t\) implies that \(B_t = 0\), and (4)

(5)\[\begin{split}S(r) &= \P\{I_t >0\} \\ &= \P\{r+1 + B_t - R_t >0\}, \text{ * } \\ &= \P\{r+1 - R_t >0\}, \text{ as } B_t = 0, \\ &= \P\{R_t < r+1\} \\ &= \P\{R_t \leq r\} \\ & = \P\{X(t-L,t] \leq r\}, \text{ ** }, \\ &= G(r), \text{ *** }, \\ &= \sum_{i=0}^{r} g_i\end{split}\]

where * follows from (4), ** from (1), and *** from (2).

Thus,

(6)\[S(r) = G(r),\]

and not \(G(r+1)\) as in Factory Physics.

Computing the average backorder level

When does a back-order occur? This happens whenever

(7)\[\{B_t > 0\} = \{R_t - r-1>0\} = \{X(t-L, t] - r-1>0\},\]

where we use (3), (4) and (1). Hence,

\[\begin{split}\begin{split} B(r) &= \E B_t \\ &= \E \max\{B_t, 0\} \\ &= \E \max\{R_t - r - 1, 0\} \\ &= \E \max\{X(t-L, t] - r - 1, 0\} \\ &= \sum_{i=r+1}^\infty (i- r -1)\P\{X(t-L, t] = i\}\\ &= \sum_{i=r+1}^\infty (i- r -1)g_i \\ &= \sum_{i=r+2}^\infty (i- r -1)g_i, \end{split}\end{split}\]

where the last equation follows from the fact that when \(i=r+1\), \(i-r-1 =0\). I find the following easier to memorize, hence I use this in the sequel:

(8)\[B(r) = \sum_{i=r+1}^\infty (i- r -1)g_i.\]

For later purposes we prove that

(9)\[B(r) = \sum_{i=r+1}^{\infty} \bar G(i)\]

where

(10)\[\bar G(i) = \P(X>i) = 1 - P(X\leq i) = 1 - G(i).\]

Define first the function

\[\begin{split}1_{i< j} = \begin{cases} 1, &\text{ if } i < j, \\ 0, &\text{ else}, \end{cases}\end{split}\]

so that we can write

\[\sum_{j=0}^\infty 1_{j< i-r - 1} = i-r -1\]

Now, using (8),

(11)\[\begin{split} B(r) &= \sum_{i=r+1}^\infty (i-r-1) g(i) \\ &= \sum_{i=r+1}^\infty\sum_{j=0}^\infty 1_{j < i-r-1}\, g(i) = \sum_{j=0}^\infty \sum_{i=r+1}^\infty 1_{i > j +r + 1}\, g(i)\\ &= \sum_{j=0}^\infty \sum_{i=j + r+2}^\infty g(i) = \sum_{j=0}^\infty \P(X \geq j + r+2) \\ &=\sum_{j=0}^\infty \P(X > j + r+1) \\ &= \sum_{j=0}^\infty \bar G(j+r+1) =\sum_{j=r+1}^\infty \bar G(j).\end{split}\]

Finally, this can be simplied a bit by using that \(\sum_{i=0}^\infty \bar G(i) = \theta\):

(12)\[\begin{split}B(r) &= \sum_{j=r+1}^\infty \bar G(j) \\ &= \sum_{j=0}^\infty \bar G(j) - \sum_{j=0}^{r} \bar G(j)\\ &= \theta - \sum_{j=0}^{r} \bar G(j)\end{split}\]

Computing the expected inventory level

Taking expectations at the left and right hand side of (4) we get

\[\E\{I_t + R_t - B_t\} = r+1,\]

from which

(13)\[\begin{split}\E I_t &= r+1 - \E R_t + \E B_t \\ & = r + 1 - \E X(t-L, t] + B(r) \\ & = r + 1 - \theta + B(r) \\\end{split}\]

Formulas to skip

Formulas to skip (in edition 3)

  • 2.24, 2.25.

\((Q,r)\) Model

Computing the service level

The service level is

(14)\[\begin{split}S(Q,r) &= \frac1Q \sum_{i=r}^{r+Q-1} S(i) \\ &= \frac1Q \sum_{i=r}^{r+Q-1} G(i),\end{split}\]

where \(S(i)\) is the service level of the basestock model with reorder level \(i\), i.e. \(S(i)=G(i)\) is given by (6). To verify that the summation should start at \(r\), and not at \(r+1\) (as I have found somewhere), we can take \(Q=1\), as then the \((Q,r)\) model reduces to the basestock model. The above formula then gives \(S(1,r)= G(r)\), and this is the same formula as found for the basestock model, i.e., (6).

Factory Physics mentions also the following formula:

(15)\[S(Q,r) = 1- \frac1Q [B(r-1) - B(r+Q-1)],\]

where \(B(r)\) can be computed according to (8)). I find expression (14) conceptually more important than (15). It appears that in Eq. 2.70 of FP, edition 3, are is off by one. To see this, we prove that (15) is indeed the same as (14). It follows from (15) and (14) that

\[\begin{split}B(r-1) - B(r+Q-1) &= Q - Q S(Q,r) \\ &= Q - \sum_{i=r}^{r+Q-1} S(i) \\ &= \sum_{i=r}^{r+Q-1}(1- S(i)) \\ &= \sum_{i=r}^{r+Q-1}(1- G(i)),\end{split}\]

since \(\sum_{i=r}^{r+Q-1} 1 = Q\). From (6) we see that \(S(i) = G(i)\). With (10) this becomes

\[\begin{split}B(r-1) - B(r+Q-1) &= \sum_{i=r}^{r+Q-1}(1- G(i))\\ &= \sum_{i=r}^{r+Q-1} \bar G(i)\\ &= \sum_{i=r}^{\infty} \bar G(i) -\sum_{i=r+Q}^\infty \bar G(i).\end{split}\]

From (11) it follows that \(B(r-1)=\sum_{i=r}^{\infty} \bar G(i)\), and likewise for \(B(r-1+Q)\). We are done.

Computing backorders

The expected number of back-orders is

(16)\[B(Q,r) = \frac1Q \sum_{i=r}^{r+Q-1} B(i),\]

where \(B(i)\) is defined in (8)). To convince ourselves that the summation has to start at \(r\), observe that for \(Q=1\), we get (8) of the basestock model.

Expected Inventory Level

The expected inventory level can be found as follows. Let \(I(r)\) be the long-run time average inventory level, i.e., (13). Then,

\[\begin{split}I(Q,r) &= \frac1Q\sum_{i=r}^{r+Q-1} I(i) \\ &= \frac1Q\sum_{i=r}^{r+Q-1} (i+1 - \theta + B(r)) \\ &= \frac1Q\sum_{i=r}^{r+Q-1} (i + 1) - \theta + \frac1Q\sum_{i=r}^{r+Q-1} B(r) \\ &= \frac{Q+1}2 + r - \theta + B(Q,r),\end{split}\]

where we used (16). What do you get when \(Q=1\)?

Formulas to skip

Formulas to skip (in edition 3)

  • 2.38, 2.41, 2.42, 2.43.