# 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:

- To derive, in detail, some of the results of Chapter 2 and, in passing, repair the (considerable number of) typos in the book.
- 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.
- 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

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

### Expected cost¶

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

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

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,

Note that the average demand during a lead time is

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

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

### 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,

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

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

Thus,

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

### Computing the average backorder level¶

When does a back-order occur? This happens whenever

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

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:

For later purposes we prove that

where

Define first the function

so that we can write

Now, using (8),

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

## \((Q,r)\) Model¶

### Computing the service level¶

The service level is

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:

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

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

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

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,

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