# (Q,r) model

In inventory theory, the (Q,r) model is used to determine optimal ordering policies. It is a class of inventory control models that generalize and combine elements of both the Economic Order Quantity (EOQ) model and the base stock model. The (Q,r) model addresses the question of when and how much to order, aiming to minimize total inventory costs, which typically include ordering costs, holding costs, and shortage costs. It specifies that an order of size Q should be placed when the inventory level reaches a reorder point r. The (Q,r) model is widely applied in various industries to manage inventory effectively and efficiently.

## Overview
### Assumptions

* Products can be analyzed individually
* Demands occur one at a time (no batch orders)
* Unfilled demand is back-ordered (no lost sales)
* Replenishment lead times are fixed and known
* Replenishments are ordered one at a time
* Demand is modeled by a continuous probability distribution
* There is a fixed cost associated with a replenishment order
* There is a constraint on the number of replenishment orders per year

### Variables

* $D$ = Expected demand per year
* $\ell$ = Replenishment lead time
* $X$ = Demand during replenishment lead time
* $g(x)$ = probability density function of demand during lead time
* $G(x)$ = cumulative distribution function of demand during lead time
* $\theta$ = mean demand during lead time
* $A$ = setup or purchase order cost per replenishment
* $c$ = unit production cost
* $h$ = annual unit holding cost
* $k$ = cost per stockout
* $b$ = annual unit backorder cost
* $Q$ = replenishment quantity
* $r$ = reorder point
* $SS=r-\theta$, safety stock level
* $F(Q,r)$ = order frequency
* $S(Q,r)$ = fill rate
* $B(Q,r)$ = average number of outstanding back-orders
* $I(Q,r)$ = average on-hand inventory level

### Costs

The number of orders per year can be computed as $F(Q,r)={\frac {D}{Q}}$, the annual fixed order cost is F(Q,r)A. The fill rate is given by:
$S(Q,r)={\frac {1}{Q}}\int _{r}^{r+Q}G(x)dx$
The annual stockout cost is proportional to D[1 - S(Q,r)], with the fill rate beying:
$S(Q,r)={\frac {1}{Q}}\int _{r}^{r+Q}G(x)dx=1-{\frac {1}{Q}}[B(r))-B(r+Q)]$
Inventory holding cost is $hI(Q,r)$, average inventory being:
$I(Q,r)={\frac {Q+1}{2}}+r-\theta +B(Q,r)$

#### Backorder cost approach

The annual backorder cost is proportional to backorder level:
$B(Q,r)={\frac {1}{Q}}\int _{r}^{r+Q}B(x+1)dx$

##### Total cost function and optimal reorder point

The total cost is given by the sum of setup costs, purchase order cost, backorders cost and inventory carrying cost:
$Y(Q,r)={\frac {D}{Q}}A+bB(Q,r)+hI(Q,r)$
The optimal reorder quantity and optimal reorder point are given by:
$Q^{*}={\sqrt {\frac {2AD}{h}}}$
$G(r^{*}+1)={\frac {b}{b+h}}$
    Proof To minimize set the partial derivatives of Y equal to zero: ${\frac {\partial Y}{\partial Q}}=-{\frac {DA}{Q^{2}}}+{\frac {h}{2}}=0$ ${\frac {\partial Y}{\partial r}}=h+(b+h){\frac {dB}{dr}}=0$ ${\frac {dB}{dr}}={\frac {d}{dr}}\int _{r}^{+\infty }(x-r)g(x)dx=-\int _{r}^{+\infty }g(x)dx=-[1-G(r)]$ ${\frac {\partial Y}{\partial r}}=h-(b+h)[1-G(r)]=0$ And solve for G(r) and Q.

##### Normal distribution

In the case lead-time demand is normally distributed:
$r^{*}=\theta +z\sigma$

#### Stockout cost approach

The total cost is given by the sum of setup costs, purchase order cost, stockout cost and inventory carrying cost:
$Y(Q,r)={\frac {D}{Q}}A+kD[1-S(Q,r)]+hI(Q,r)$
What changes with this approach is the computation of the optimal reorder point:
$G(r^{*})={\frac {kD}{kD+hQ}}$

### Lead-Time Variability

X is the random demand during replenishment lead time:
$X=\sum _{t=1}^{L}D_{t}$
In expectation:
$\operatorname {E} [X]=\operatorname {E} [L]\operatorname {E} [D_{t}]=\ell d=\theta$
Variance of demand is given by:
$\operatorname {Var} (x)=\operatorname {E} [L]\operatorname {Var} (D_{t})+\operatorname {E} [D_{t}]^{2}\operatorname {Var} (L)=\ell \sigma _{D}^{2}+d^{2}\sigma _{L}^{2}$
Hence standard deviation is:
$\sigma ={\sqrt {\operatorname {Var} (X)}}={\sqrt {\ell \sigma _{D}^{2}+d^{2}\sigma _{L}^{2}}}$

#### Poisson distribution

if demand is Poisson distributed:
$\sigma ={\sqrt {\ell \sigma _{D}^{2}+d^{2}\sigma _{L}^{2}}}={\sqrt {\theta +d^{2}\sigma _{L}^{2}}}$