Automated Application of Inventory Optimization

  • Tomáš MartinovičEmail author
  • Kateřina Janurová
  • Kateřina Slaninová
  • Jan Martinovič
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9842)


We present automated application of inventory optimization based on sales forecast. Inventory stock optimization is very required issue by companies recent years, however inventory models are based on the sales expectation. Therefore, the problem of optimizing inventory stock is divided into two parts, sales forecast and setting optimal inventory. We describe an automated solution to model selection for sales forecast and the inventory setting based on those predictions. In the end, we present our validation of the system through historical simulation. We compare simulations results against real inventory levels. Due to the large number of different length time series, this simulation was run in parallel on cluster and was parallelized in R. The algorithms were developed and tested on inventory time series from real data sets of the K2 atmitec company (Sales forecasting and inventory optimization are parts of ERP solution K2, which is provided by K2 atmitec s.r.o. company,


Inventory optimization Sales forecasting Model selection Parallelization 

1 Introduction

The goal of our work was the design and implementation of automated application of inventory control for optimization and simplification of the decision making process of sales managers. Models for inventory control are based on the products sales expectations. Therefore, as the first step of inventory control, the sales forecast needs to be estimated. In our application, the sales forecast can be determined by four different models applied on several modifications of sales history. The result of the model with the best prediction according to the selected measure of accuracy is used as the input for the inventory control model.

Because of the lack of information needed for the standard inventory control models like Economic Order Quantity model or newsvendor model, we had to base our approach for the second step of inventory control on a fixed time review period model with variable demand and modify it to better suit our needs. This modification was verified by the simulation, which imitates behavior of sales manager on the assumption of complete trust in our application. The results of such simulation were compared with the real historical data of inventory time series.

The simulations were parallelized in R language and run in parallel on cluster because of the large number of products used for verification and repeated model estimations.

2 Inventory Stock Optimization

As described above, the inventory stock optimization consists of the two steps: sales forecasting and optimal inventory setting.

2.1 Sales Forecasting

Sales forecasting represents a typical application of time series analysis and prediction. Classical time series analysis is based on the assumption that the time series \(y_t\) for \(t = 1, 2, \ldots , n\) can be decomposed into four components: trend, cyclic, seasonal and irregular. The trend component characterizes a long-term tendency of the examined phenomenon that is influenced by factors operating in the same direction eg. production technology, demographic conditions, market conditions, etc. The first approach we used in time series modeling is based on the idea that if the long-term tendency of time series corresponds to a certain function of time eg. a linear, quadratic, exponential, S-curve etc., the trend component can be modeled using this function [1].

Assume that the time series \(y_t\) can be written as the sum of trend and residual process
$$\begin{aligned} y_t = T_t + \varepsilon _t\ \ t = 1, 2, \ldots , n , \end{aligned}$$
where \(T_t\) can be described by the appropriate mathematical function of the time variable t, and \(\varepsilon _t\) is the residual component with the character of white noise process.
We used three different mathematical functions for modeling the trend components in our simulation:
  1. 1.
    linear trend function in the form
    $$\begin{aligned} T_t = \beta _0 + \beta _1 t, \ \ t = 1, 2, \ldots , n, \end{aligned}$$
  2. 2.
    quadratic trend function in the form
    $$\begin{aligned} T_t = \beta _0 + \beta _1 t + \beta _2 t^2, \ \ t = 1, 2, \ldots , n, \end{aligned}$$
  3. 3.
    and cubic trend function in the form
    $$\begin{aligned} T_t = \beta _0 + \beta _1 t + \beta _2 t^2 + \beta _3 t^3, \ \ t = 1, 2, \ldots , n . \end{aligned}$$

The regression parameters of the trend functions \(\beta _0, \beta _1, \beta _2\) and \(\beta _3\) were estimated by the least squares estimation method. Although this approach may appear to be too simple, in many practical cases the best solution is the simplest one.

The second approach we used in time series modeling is provided by the ARIMA model [2]. ARIMA - Autoregressive integrated moving average - is part of the Box-Jenkins methodology, which was developed for the analysis of time series, where we assume that the residual component \(\varepsilon _t\) does not have the character of white noise. Unlike the first approach, where the regression model is built only as the function of time, the Box-Jenkings models are built as the function of linear combination of p past values of the modeled variable itself, hence the term autoregressive, and regression-like model of \(q+1\) past forecast errors. In such way the ARMA(pq) - autoregressive moving averages - model is obtained. ARIMA(pdq) model is then essentially an ARMA model applied to the dth difference of the original series. Such approach is used in the cases when the studied series is not stationary (it’s properties depend on the time at which the series is observed). The stationarity can be achieved by applying the difference of the first or the second order, difference of the higher order are usually not used in practice.

The final sales forecast is made in four steps. At first, all the models described above are fitted to the training part of the data, \(y_t \) for \(t = 1, 2, \ldots , m,\) where \(m < n\), then the sales forecasts \(\hat{y}_t\) for \(t = m+1, m+2, \ldots , n\) are made on the basis of fitted models. The different forecasts are compared with the test part of the data \(y_t\) for \(t = m+1, m+2, \ldots , n\) using appropriate measure of accuracy, and finally the best forecast is chosen as the input for inventory control model. Additionally, the models are fitted simultaneously on the original daily data and data with weekly and monthly aggregation.

For the best forecast selection, several measures of accuracy eg. RMSE, MAE, MAPE, etc. were considered [3]. However, because of the different time aggregation of the compared time series, the accuracy measure, that is independent of the scale of the data, seems to be the most convenient one. This kind of accuracy measure, Mean Absolute Scaled Error, was proposed by Hyndman and Koehler [4] as
$$\begin{aligned} \text {MASE} = \text {mean }\left( \left| q_t\right| \right) , \end{aligned}$$
with the scaled error \(q_t\) defined as
$$\begin{aligned} q_t = \frac{e_t}{\frac{1}{n-m-1}\sum \limits _{i=m+2}^{n}{\left| y_i-y_{i-1}\right| }}, \end{aligned}$$
where \(e_t\) is the forecast error defined as \(e_t = y_t-\hat{y}_t, t = m+1, m+2, \ldots , n\).

2.2 Inventory Control

Numerous models for inventory control were developed such as Economic Order Quantity model (EOQ) or newsvendor model. Those are the basic deterministic and stochastic models for the inventory control. Based on the stochastic nature of our problem and available data we used fixed time review period model with variable demand as a basis for our solution.

It was difficult to estimate ordering costs and holding costs due to the character of the available data. Therefore, we use just quantities and we focus on providing inventory level measures based on the user specified service level in our approach. To achieve that, three measures need to be computed. The first is the safety stock, which should cover most of the uncertain demand. This uncertainty means that it would be too costly, and often impossible, to hold enough inventory to cover all the variations in demand. Therefore, the user of the software may set requested level of service. Safety stock then depends on standard deviation of sales, lead time, service level and probability distribution of sales. Assuming standard normal distribution of sales, constant lead time and constant variation of sales, we can define the safety stock [5] as
$$\begin{aligned} S = \varphi (sl) \sqrt{t_l \sigma _d^2}, \end{aligned}$$
where \(\varphi (sl)\) is the quantile function for normal distribution and its quantile is given by service level. Variable \(t_l\) stands for lead time and \(\sigma _d\) is standard deviation of demand. By leaving the assumption of constant lead time and adding uncertainty to lead time we get
$$\begin{aligned} S = \varphi (sl) \sqrt{t_l \sigma _s^2 + E(s) \sigma _{l}^2}, \end{aligned}$$
where E(s) is expected mean sales and \(\sigma _{l}\) is lead time standard deviation. Now we can define reorder point, which is the level of inventory needed to cover the demand until the arrival of the next batch of inventory plus safety stock. If we assume the constant demand and constant lead time we can define reorder point as follows
$$\begin{aligned} R = S + E(s) t_l. \end{aligned}$$
The last step is to compute the order quantity. This is defined as the quantity necessary to cover the demand for the user specified time. Hence, the order quantity is affected by mean expected sales, order time, incoming goods and goods reserved in advance. Additionally, the ordered quantity should be adjusted by the difference between actual stock and reorder point. We can write this as
$$\begin{aligned} Q = E(s) t_o - G_i + G_r + R - A, \end{aligned}$$
where \(t_o\) is the order time, \(G_i\) is the incoming goods quantity, \(G_r\) is reserved goods quantity and A is actual level of inventory. This definition of order quantity covers the demand for the defined time with set service level for covering the stochastic behaviour of customers.

2.3 Automated Application of Inventory Optimization

The theory described in Sects. 2.1 and 2.2 was used for development of an approach for inventory optimization that was implemented as part of ERP software by K2 atmitec company. This software can simplify the decision making process of sales managers. It includes three main parts, which are “best model selection”, “sales prediction” and “inventory control”.

3 Verification of Automated Application of Inventory Optimization

To evaluate our approach, we created a simulation which imitates behavior of sales manager on the assumption of complete trust in our approach. The simulation includes all three parts mentioned in previous section, which are complemented by an automatically controlled decision making process for running specific parts. We used historical time series of sales and inventory stock levels for verification of our simulation, the results are given in Sect. 3.3.

3.1 Data Description

The real historical data for our software verification was provided by the K2 atmitec company. The dataset contained the information about approximately 33 000 products in several warehouses in Czech Republic. We were not able to simulate the behavior for all of the provided products due to the small number of observations in the followed history. The software was finally verified on about 950 and 750 products in two selected warehouses, what was sufficiently large enough number.

3.2 Simulations

On the beginning of the simulation, some parameters must be set. The lead time for the given goods, order interval and maximum level of inventory. The lead time and maximum level of inventory are variable for every type of stock. The review period was set to 30 days. In addition, we had to select the service level, which was set to 95 %.

The starting point for the simulation is a year and a half. That means we take the first year and a half of sales time series and the inventory level at that time. The “best model selection” part begins with running the model selection algorithm, when the original time series is preprocessed in several steps. In order to find the best model for given data, the time series with originally daily sales is aggregated in weekly and monthly sales. There is a possibility of removing outliers for each aggregation and also filtering by Kalman [6] or Baxter-King [7] filter for weekly and monthly aggregation. At the end of preprocessing step, each original time series leads to 10 final modifications on which the four models given in Sect. 2.1 are fitted and compared by the MASE accuracy measure. This chooses a predictive model used for the next three months. Then, the simulation runs the “sales prediction” part, that calculates the predicted sales quantity on the basis of previously selected predictive model. The result of this step is the predicted time series, that is used as the input for the “inventory control” part, which sets the reorder point and safety stock. The visualization of such prediction is shown in Fig. 1.
Fig. 1.

Prediction of sales quantity of real inventory time series

After the first day, the simulation iterates by day, reducing the inventory level by the same amount as it is reduced in the real inventory time series. When it reaches the reorder point, the “sales prediction” and “inventory control” parts are run again. The reorder point and safety stock are updated according to the new results and order for the new inventory is made. The ordered inventory is added to the simulated inventory after the lead time period. Every three months new predictive model is chosen based on the “best model selection” part. This process is repeated until the end of the time series.

The main output of this simulation is simulated inventory time series. This may be compared with the actual inventory time series, as is shown in Fig. 2. In general, if the mean level of simulated inventory is less than the actual inventory and the stockout time is within boundaries of chosen service level, we can say, that the simulation is successful. In addition, to the simulated inventory time series, we have other outputs. Those are chosen predictive models, history of inventory control settings, orders history and graphical output. These outputs allow us to make a quick analysis of reasons for the success or failure of our simulation.
Fig. 2.

Comparison of simulated inventory time series and real inventory time series

Because of a large number of products at each warehouse and repeated model estimations, we had to parallelize this algorithm. Due to the independency of simulations for specific goods, the computation was easily parallelized through Rmpi1 package in R software. This package uses MPI for communications between nodes. Our algorithm uses distributed apply function, where a master node sends time series data to free slave nodes, which execute the simulation on given data. This method allows us to run this algorithm both single node or on the cluster and scales well, because there is minimal need for the communication. The computation was made on Salomon cluster equipped with Intel Xeon E5-2680v3 processors. We used 8 compute nodes, each with 24 cores and 128 GB RAM.

In the future, we would like to make improvements in the computations of reorder point and safety stock, since they are very susceptible to sudden changes in demand as is shown in Fig. 3. The most sensible seems to be the solution by moving averages since this will allow for changes to happen, but it would smooth them at the same time. However, this approach needs to be tested.
Fig. 3.

Inventory quantity, safety stock, reorder point and order quantity history for inventory control simulation

3.3 Comparison of Simulation Results and Real Inventory Data

Simulations were completed on two warehouses, one with 950 products and the second with 761 products. For each simulation, the mean level of real inventory and the mean level of simulated inventory were determined, and the relative percentage difference with respect to mean level of real inventory was calculated. The higher relative percentage difference, the more successful simulation was. Stockout was calculated for the sake of real information as the number of days for which the product was unavailable. The mean and median values for the relative percentage difference as well as the mean values of stockout days for both warehouses are given in Table 1.
Table 1.

Summary statistics for the comparisons of the mean level of real inventory and the mean level of simulated inventory.

Warehouse 1

Warehouse 2

Number of products



Mean stockout [%]



Mean relative percentage difference [%]



Median relative percentage difference [%]



As can be seen from the summary statistics, the mean stouckout is within the required level of 5 % for both warehouses. The mean level of relative percentage difference was 17.4 % and 20.0 %, with the meaning that if the sales manager trusted completely in our software, the mean inventory level would be lower by 17.4 % and 20.0 %.
Fig. 4.

Distribution of relative percentage difference with respect to real inventory in Warehouse 1

Fig. 5.

Distribution of relative percentage difference with respect to real inventory in Warehouse 2

The values of median relative percentage difference suggest, that the decrease could be even more significant, and that the mean relative percentage difference value is influenced by several unsuccessful simulations, as can be seen from the distribution of relative percentage difference with removed outliers in Figs. 4 and 5. Those were mainly simulations on products with the lead time greater than 40 days. Improvement of the simulation on such products is one of the tasks for our future research.

4 Conclusion

Our paper describes design, implementation and verification of the automated application of inventory control that is based on predictions of real historical sales data. The sales prediction is estimated by several approaches of time series modeling of which the best is chosen by the selected measure of accuracy. Modification of fixed time review period model with variable demand was proposed for inventory control model and verified by the described simulation process which compares inventory time series simulated by our application with the real inventory time series. The results of the simulation showed, that if the sales manager acted completely in accord with our application recommendation, the mean inventory level would decrease by 17.4 % in one tested warehouse and by 20.0 % in the second tested warehouse.

The future work in this area involves, besides the tasks mentioned in previous section, the research and the implementation of other suitable models for sales forecasting and their ensembles, an improved model selection, and alternative inventory control models.


  1. 1.

    Yu, H. (2002). Rmpi: Parallel Statistical Computing in R. R News 2/2:10-14.



This work was supported by The Ministry of Education, Youth and Sports from the National Programme of Sustainability (NPU II) project ‘IT4Innovations excellence in science – LQ1602’ and from the Large Infrastructures for Research, Experimental Development and Innovations project ‘IT4Innovations National Supercomputing Center – LM2015070’.


  1. 1.
    Hyndman, R.J., Athanasopoulos, G.: Forecasting: Principles and Practice. OTexts, Melbourne (2013). Accessed 26 April 2016
  2. 2.
    Asteriou, D., Hall, S.G.: Applied Econometrics, 2nd edn. Palgrave MacMillan, Basingstoke (2011)Google Scholar
  3. 3.
    Palit, A.K., Popovic, D.: Computational Intelligence in Time Series Forecasting: Theory and Engineering Applications. Springer-Verlag, London (2005)zbMATHGoogle Scholar
  4. 4.
    Hyndman, R.J., Koehler, A.B.: Another look at measures of forecast accuracy. Int. J. Forecast. 22, 679–688 (2006)CrossRefGoogle Scholar
  5. 5.
    Russell, R.S., Taylor, B.W.: Operations Management. Wiley, Hoboken (2011)Google Scholar
  6. 6.
    Durbin, J., Koopman, S.J.: Time Series Analysis by State Space Methods. Oxford Statistical Science Series. Clarendon Press, Oxford (2001)zbMATHGoogle Scholar
  7. 7.
    Baxter, M., King, R.G.: Measuring business cycles approximate band-pass filters for economic time series. Technical report, National Bureau of Economic Research (1995)Google Scholar

Copyright information

© IFIP International Federation for Information Processing 2016

Open Access This chapter is licensed under the terms of the Creative Commons Attribution-NonCommercial 2.5 International License (, which permits any noncommercial use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.

The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

Authors and Affiliations

  • Tomáš Martinovič
    • 1
    Email author
  • Kateřina Janurová
    • 1
  • Kateřina Slaninová
    • 1
  • Jan Martinovič
    • 1
  1. 1.IT4Innovations National Supercomputing Center, VŠB – Technical University of OstravaOstravaCzech Republic

Personalised recommendations