# Pitfalls of the Inventory Management Challenge

In this post we will discuss some difficulties we face when solving inventory management problems.

All retail stores face the challenge of forecasting demand. For each of the goods in the assortment we need to know the amount of goods that should be delivered to the store. And for this we need to know what the demand for this good will be. Of course, we can’t answer this question precisely, but we can predict this demand based on historical data with some precision. In such way the problem of forecasting demand arises.

However, if we predicted that, for example, the demand for a certain good will be equal to 100 kg tomorrow, it doesn’t mean that this product will be wanted to buy by exactly 100 kg. The demand is to some extent random, and the goods can be wanted to buy both more than 100 kg, as well as less. More often, this problem is solved by adding some safety stock to the predicted demand. This safety stock is calculated by historical forecast error. For example, we can assume that our demand is a sum of our forecast and a random Gaussian noise with zero expectation and constant variance. Then we can estimate this variance by historical data and take safety stock as some coefficient multiplied by standard deviation (square root of the variance). The larger coefficient we take, the less often «out-of-stock» situations will occur, when all the goods will be sold out, and the goods will be run out in the store.

Now let us discuss the ways to estimate the quality of an inventory management system. From one side, the greater the sales level, the better. From this point of view, the «out-of-stock» situations should happen as rare as possible. From the other side, having too large stock in the shop is also expensive. Thus, to estimate the quality of inventory management system we need to develop a metric that aggregates sales and excess inventory. Financial result can be taken as such a metric, for example. It is defined as the earnings from the sales (less costs), minus the «loss due to extra stock», which occurs by the reason that instead of investing in inventory we could put it in a bank and receive interests on it (usually taken rate 20% per annum).

Thus, if we have improved our inventory management system, then the financial result should increase. This is one of the possible criteria for checking whether the system has become better: it’s enough to compare the financial results.

And this is where interesting problems arise. The first problem appears when we have improved our forecast (made it more accurate) and have checked the forecast accuracy and the financial result on historical data. Here we are in for a surprise: the forecast has become more accurate, and the financial result has slightly decreased.

To understand the reason for this, let us imagine the following model situation. Assume that we have some non-perishable good, and its margin is 30% of its prime cost. Assume that we know that the demand for this good is established in such a way that in one random day of the year the buyers want to buy 10 items of this good, and on the other days the demand for it is zero. Then, from the point of view of the financial result, it is more profitable to keep constantly 10 items of this good in the store than, for example, 1 item, because the profit of selling 10 items of this good exceeds the profit from investing its value in the bank. Thus, in terms of financial result, the forecasting methods that overestimate the predicted demand, and not the more accurate ones, will win. Even if the forecast doesn’t overestimate the demand but is simply less precise, due to the increase in its error the safety stock will grow – and the financial result will grow as well.

The correct exit from this situation is to optimize the safety stock. Along with increasing the forecast precision, it necessary to solve the problem of the optimizing the safety stock to optimize the financial result. Also, it’s necessary to take into account an expiry date of goods – for perishable goods the situation is completely different, and simple stock overstatement will not lead to an increase in the financial result.

Another problem is that the task of forecasting demand is not the pure problem of time series forecasting. The point is that we observe not true, but “censored” demand. Indeed, on days when the demand for a certain good was higher than the stock (“out-of-stock” situation), we do not know what the true demand was, and we know only that it was not lower than the available stock. Thus, to solve the problem some kind of “exploration” is required, that is, we need not only to use the historical data to determine future demand, but sometimes to bring more good to determine demand. Such an algorithm balancing exploration and exploitation is described in article [1].

At last, if we have built an improved forecasting algorithm or determining safety stock and want to test on historical data whether it is better than the old algorithms, a new problem arises. Indeed, taking historical sales as the true demand, we can never get more sales than sales from old algorithm.

Thus, the problem of inventory management is much broader than the problem of time series forecasting and needs more effort than applying any standard algorithm of time series forecasting.

[1] Gábor Lugosi, Mihalis G. Markakis, Gergely Neu. On the Hardness of Inventory Management with Censored Demand Data. https://arxiv.org/abs/1710.05739