I am facing an optimization problem in my business environment that hopefully you guys can help me with. To give you some background on the topic, I am trying to calculate the inventory (called "safety stock") that is needed to buffer for variability in customer demand (more specifically forecast error) so we can guarantee a certain service level to our customers. Let's say this service level should be 97%.
Now, assuming forecast error follows the normal distribution, I could easily calculate the required "safety stock" as $z * \sigma_{forecast error}$, where z in this case would be 1.88 (97%). However, because of specific reasons, we always have an extra buffer of inventory (called "cycle stock") on top of the safety stock. This cycle stock follows a uniform distribution and can vary between 0 units and X units.
As a consequence of this cycle stock, the safety stock that I would calculate with the basic formula ($z * \sigma_{forecast error}$ ) is too high. This is an opportunity for us to improve, our inventory holding cost is relatively high and we need to cut inventory wherever we can. On the other hand, we don't want to keep too few inventory and lose customers...
The question therefore is: how can I combine the standard normal distribution (z) with the uniform distribution into one formula such that I can calculate the correct (lower) safety stock level which would still allow for a total 97% service level?
Appreciate your help!
Thanks.
Jan
I'm still not sure I follow your formulation, but I'll solve according to my understanding and feel free to correct me.
Current situation: you have some fixed quantity $x$ and you have some "noise" (uncertainty in demand or forecast error) $N$. The overall demand is therefore $$Y=x+N.$$ Now, you would to increase your quantity such that the probability of someone asking for more that you have is less than 3% (i.e. 97% service level). Then, you find $m$ such that $$P(Y>m)<0.03$$ $$P(x+N>m)<0.03$$ $$1-P(N<m-x)<0.03$$ $$0.97<P(N<m-x)$$ $$P(N<1.89)<P(N<m-x)$$ $$1.89<m-x$$ $$m>x+1.89$$ so you need to add 1.89 to your quantity to be sure that in 97% certainty you'll have enough stock.
Desired situation: you have an additional uniformly distributed quantity $U\sim \mathcal U[0,u]$ of between 0 and $u$ items that's added to your stock. So you have: $Z=x+N+U$ (unrelated to your $z$ in the question), and you need to figure out what's the value of $m$ such that $$P(Z>m)<0.03,$$ exactly as before, only now $Z$ contains another quantity.
Before you could have easily calculated this since you have the normal distribution tables. But now, $P(Z>m)=P(x+N+U>m)=P(N+U>m-x)=1-P(N+U<m-x)$, and $R\triangleq N+U$ is not normally distributed. Its distribution is given by the following convolution: $$f_R(r) = (f_N*f_U)(r) = \int_{-\infty}^\infty f_U(t) f_N(r-t) dt$$ $$ = \frac{1}{u} \int_0^u f_N(r-t) dt$$ $$ = \frac{1}{u} \int_{r-u}^{r} f_N(t) dt$$ Now, since $f_N(t)$ is a normal density, we get $$f_R(r) = \frac{1}{u} [\Phi(r)-\Phi(r-u)]$$
To get back to our problem, we have
$$0.97<P(R<m-x)$$ $$0.97<F_R(m-x)$$ $$F^{-1}_R(0.97)<m-x$$ $$m>x+F^{-1}_R(0.97)$$
where $F^{-1}_R(r)$ is the inverse cdf of $R$. We have the density, $f_R(r)$. We need to numerically integrate it to get the cdf and then find the value in which it is equal to $0.97$. Fortunately, we can use MATLAB (or any other software), and get:
The code is:
So, the value we want is $m>5.67$, the value we need to add to the current stock, for an arbitrary choice of $u=5$ and certainty of $0.97$.
If I check it by simulation:
the value of
resis the average number of times the "customer" ($Y$) wanted more than I kept ($x+m$), then indeed I get values very close to 3%.EDIT:
According to your comments, here's a general way to solve it, using Excel.
The main equation here is $$P(N>m+c)<0.03$$ $$1-P(N<m+C)<0.03$$ $$0.97<P(N-C<m)$$ Let $R=N-C$, then $$0.97<F_R(m)$$ $$F_R^{-1}(0.97)<m$$ so, we need to do the following: a. get $f_R(r)$ for $R=N+C$ where $N$ is standard normal and $C$ is some uniformly distributed variable. Note that I took $C$ instead of $-C$ but due to the uniform distribution it doesn't matter as long as the boundaries are correct. Similarly to before, $f_R(r)$ is given by: $$f_R(r) = \frac{1}{u-v} [\Phi(r-v)-\Phi(r-u)]$$ where $u,v$ are the boundaries of the uniform distribution. b. Get the cdf via $F_R(r)$ by cumulative summation (numerical integration). c. find the value of $r$ for which $F_R(r)=0.97$, i.e. find $F^{-1}_R(0.97)$.
Now, I'm pretty rusty in Basic so I wrote up something in Excel, but you might be able to do much better. Nevertheless, the code produces the correct result. The main idea in this file is to write the values for the cdf in Excel cells, and then use a VBA script to calculate $F_R(r)$ in the desired values and look for the correct $r$ that matches $0.97$.
I'm not sure if it's allowed to attach files here, but I attach a link to the xlsx file itself: https://www.dropbox.com/s/1cvfrkna8vbged3/Book1.xlsm?dl=0