Stochastic production planning with internal and external storage and ordering costs

: This paper aims to compare different models to support decision making in production planning (and, consequently, in sales and inventory), in an environment where product demands are variable and uncertain, it is possible to produce at normal hours and overtime, loss of sales is consequence of stockouts, there is limit to internal storage, with possible and more expensive external storage, and ordering costs are non-negligible. At first, we present a linear and deterministic model, with known demand and without shortage. In the second model, safety stocks are calculated to meet a probabilistic demand, but it is not yet considered the possibility of shortage. The third model includes shortage calculation as a consequence from demand uncertainty. The last two models use an iterative process to re-estimate the unit cost of storage, needed to calculate safety stocks in each period of the planning horizon. The models were implemented in MSExcel, making use of linear programming and search functions available in the software. As the original problem, data of the examples are based on real companies. The study allows concluding that, in the problem analyzed, linear models, simpler and faster to execute, may be sufficient to support good decisions.


Introduction
On the theme of aggregate production planning, or production and sales planning, companies should define how to use their resources to reach their operational goals (overall, maximize operational margin).Decision variables may include overtime work, additional shifts, outsourcing part of the production, not meeting part of the demand, and building inventories in low demand periods to be used in periods with higher demand (Buffa & Sarin, 1987;Silver et al., 1998).Bookbinder & Tan (1988), Feiring & Sastri (1990), Tarim & Kingsman (2004), Ketzenberg et al. (2006), Tarim & Kingsman (2006), Lejeune & Ruszczynski (2007), Helber et al. (2013), Pauls-Worm et al. (2016), and Biazzi (2018) found two approaches to define the size of safety stocks for each period of the planning horizon.The first one results from the arbitrary definition of values of service level indicators, as the ratio of shortage-free replacement cycles (cycle service level) and the ratio of demand met without stockout (fill rate), leading to the identification of a safety coefficient to meet demand (based on normal distribution or on another probability distribution).The second approach considers storage and stockout costs to define this safety coefficient.This second approach is more adequate if the intention is to minimize total operation costs.In parallel, there are two approaches to define how long should be the time intervals for batches produced in uncertain environments: in the sequential approach, intervals are defined without considering uncertainty, and safety stocks are calculated later; in the joint approach, intervals and safety stocks are defined at the same time.
This study presents a research problem with a unique feature: because of storage limits in a company's facilities (refrigerated storage, for example), with the possibility of external storage with costs that are higher than those of internal storage, the unit cost of storage depends on building seasonal and safety stocks for high demand periods, which would require using an iterative planning process, because the safety stock would be defined by the ratio between storage and stockout costs to meet demand.The present study expands the work of Biazzi (2018), in which ordering costs are considered negligible, and consequently, production occurs in all periods, and defining the size of seasonal and safety inventories becomes the only concern.This paper has the aim of comparing models that support production decision making in an identified environment and making considerations that will enable decision markers to choose the most suitable model to apply in their companies.
In addition to this introduction, section 2 in this paper presents its methodology; section 3 has the literature review; section 4 presents the features of the aggregate planning problem to be solved by the models presented in sections 5 to 7. Section 5 presents the deterministic linear model with variable demand, internal storage constraints and optional use of overtime.Section 6 presents the linear model proposed for the problem of probabilistic demand, while section 7 shows the nonlinear model with probabilistic demand and stockout, thus enabling the comparison between models and defining which to use in companies, in section 8. Section 9 presents the conclusions and possible further studies.

Methodology
The methodology of this study may be associated to the proposal of Design Science Research, as presented by Lacerda et al. (2013).The class of problems would be aggregate planning with probabilistic demand, production and storage constraints (with possible, though more expensive, external storage), and non-negligible ordering costs, a specific case of production planning.The artifacts tested are mathematical models to support decision making in companies.As a result, it would be possible to indicate which artifact companies should use.
After identifying the problem (awareness), the models that could be useful for the target problem were built, with the aid of the related literature found in the references of books of the area of operations and in papers obtained from the search of CAPES' journal database (which includes, among others, important databases for the area, like Science Direct, Scopus and Web of Science).The search included words like "stochastic aggregate production planning" (exact) "AND" "storage limit" ("contains"), with variations in which the term "aggregate" was suppressed and the following exchanges were made: "stochastic" for "probabilistic", "storage" for "stock", "limit" for "constraint", and "limit" for "restriction", without including publication date limits.Other papers were considered because they were quoted in papers coming out from the search (the last one conducted in September 2020).
The evaluation method (experimental model) consisted of comparing the performance of the models tested, based on the total margin resulting from the operation of a fictitious company.The total margin is the result of the difference between product sales revenues and direct production costs (materials and energy), labor costs with overtime, storage costs inside and outside the company's facilities, and ordering costs.
The entry data of the fictitious company are practically the same as Biazzi's 2018 paper, which were obtained from real-life companies of the Brazilian agribusiness industry.The data were chosen because they permitted analyzing the real trade-offs between a company's decisions (for example, if it is more advantageous, at a certain point, to build inventories to meet future demand or to work overtime later to meet the same demand).Ordering costs with different orders of magnitude were used so that examples presented differences in purchasing decisions for only one or for more than one period of the horizon.Mathematical models were entered into electronic spreadsheets (Microsoft Excel) and solved by the optimization functionality that is part of the tool (Solver, by Frontline Systems Inc.).The problem was intentionally kept at a size that would enable its resolution by these tools, to make it easier for other researchers or companies to evaluate the models.Real-life problems will probably have more variables and constraints, requiring more sophisticated tools.
After evaluating the performance of the models, conclusions were drawn, and utilization recommendations were made.
3 Literature review Buffa & Sarin (1987), Silver et al. (1998) and Thomé et al. (2012) present several techniques to address aggregate planning problems, from the simplest ones that consider simplified company models, normally implemented with the use of electronic spreadsheets and use of simulation, and whose equations permit evaluating the feasibility of a suggested plan, without result optimization, until others, more sophisticated, that use mathematical programming.Tenhiälä (2011) indicates that companies use slightly more sophisticated models based on linear programming and mixed linear programming (which includes binary variables and is used to represent the consumption of resources-and associated costswhen equipment is prepared in an intermittent production environment).Günther (1982) used simulation to compare the performance resulting from decisions in situations of uncertain demand based on linear programming models and linear decision rules; the latter would generate better results than the former the more uncertain demand is.Li et al. (2013) present a technique (belief-rule-based inference) for uncertain demand conditions, in which plans are evaluated in scenarios with different probabilities, situation which will not be addressed in this paper.Ketzenberg et al. (2006) developed heuristics to analyze the problem of aggregate planning with several products, probabilistic variable demand, and common capacity limits.Marginal analysis heuristics, which allocates production capacity both in limited capacity periods and in advanced production, according to each product's economic return, provided better results than others tested, balanced (fair share), proportional and fixed allocation.The results of the winning heuristics were compared with the optimal ones attained with the use of dynamic programming.The study calculates the safety stocks based on storage and lost sales costs, like this study, but it does not consider preparation costs or the possibility of overtime and external storage.Martínez-Costa et al. (2014) suggest that there are few studies addressing simultaneously strategic capacity management and production and inventory management, although they are substitutes: the higher capacity, the lower can inventories be.This independence occurs for one of the real-life companies that were used to characterize the fictitious company in this study.Strategic capacity planning (with a horizon of several years and annual decision detailing) is designed without analyzing the consequences for mediumterm production and inventory management.These decisions are left for the process of production and sales planning, with a horizon of about one year and monthly detailing.In the first problem, the company adopts a solution based on a demand tracking strategy, in which the company's regular capacity must meet average demand.As suggested by Olhager & Johansson (2012), differently from the anticipation strategy, in which there is always installed capacity to meet demand increases (with higher idleness), and unlike the demand lagging strategy, in which capacity is only installed after demand occurs (with potential demand losses or excessive sub-contracting costs), the tracking strategy leads to situations in which inventories are built to cover high demand periods.In the case of this study, there is the possibility of working overtime (on weekends).Bookbinder & Tan (1988) present basic cases, deterministic and probabilistic, of production planning with variable demand, considering unlimited production and storage capacity, without stockout costs.In the deterministic case, they would not exist because capacity is unlimited.In the situation of demand uncertainty, however, they simplify reality assuming that the minimal service level required by the company would lead to immaterial stockouts.The service level indicator used was the proportion of shortage-free replacement cycles (cycle service level, CSL).The main goal of the Bookbinder & Tan's study was to calculate production batches to balance ordering costs and storage.
Furthermore, with the aim of minimizing total costs, including ordering and storage, Buffa & Sarin (1987), Tarim & Kingsman (2004), and others present several resolution techniques, like Complete Enumeration, Wagner-Whitin algorithm, Silver-Meal algorithm, Mixed Linear Programming and Simulation, in addition to, assuming quadratic costs, Linear Decision Rules (LDR) obtained by the HMMS model (Holt, Modigliani, Mutt and Simon).
Mixed linear programming was the option of Bookbinder & Tan (1988), Tarim &Kingsman (2004), andTarim &Kingsman (2006), whose studies do not consider production capacity and internal storage constraints.Tarim & Kingsman (2006) incorporate stockout costs in the analysis and calculate stockout as a function of the distribution of demand probability of an item in the time interval that the purchased batch would last.To use linear programming, Tarim & Kingsman (2006) suggest piecewise linearization for the cost curve, as a function of quantities of stock and stockout.They also calculate maximal errors in relation to the values that would be obtained from the more realistic nonlinear curve.Lejeune & Ruszczynski (2007) utilized disjunctive mixed integer programming to solve a problem with internal storage limit (without possibility of external storage) and calculate safety stocks to reach an arbitrarily defined service level.Al-E-Hashem et al. (2012) use search algorithms to solve a similar problem (except for the calculation of the safety stock, done through search, in trying to minimize total costs).Helber et al. (2013) consider production capacity, but not storage capacity, and define safety stock as a function of a chosen service level value (they compare models that work with mixed integer linear programming (MILP) in random scenarios or with piecewise linear function).Pauls-Worm et al. (2016) analyze the situation of perishable products with probabilistic demand and fil rate constraints (arbitrarily defined, and not as a function of the ratio between storage and stockout costs), comparing an optimizing approach (mixed integer nonlinear programming) with an approximate approach (mixed integer linear programming).They conclude that linear approximation is suitable when ordering costs make appropriate a replacement cycle close to the product shelf life.Biazzi (2018) compares nonlinear and linear programming models (in this case, with and without demand uncertainty) for situations with negligible ordering costs; the conclusion is that nonlinear programming (NLP) using the Solver search algorithm would provide benefits lower than 1% in the economic margin, and therefore, the linear model with safety stock is recommended.
Chart 1 presents a summary of the characteristics of the problems analyzed and the techniques used by the authors most relevant for this study.
Chart 1. Summary of the characteristics of previous papers (by this author).Therefore, it is possible to note a gap in the research that is study intends to fill: the analysis and suggestion of stochastic production planning models considering internal storage limits, external storage cost greater than internal storage cost, and relevant ordering costs, with inventory sizing method based on the ratio between stockout costs and storage costs.

Characterization of the specific problem of production, inventory, and sales planning
This paper's fictitious company has an installed capacity that enables it to meet total annual demand by using overtime and/or anticipating inventory building, with production greater than demand in periods of lower demand.
Two product families are considered because of their similarity in terms of raw materials and manufacturing processes.As ordering costs may be significant, the company's planning problem is to decide when to produce each family, whether it is better to use overtime in higher demand months or to use seasonal inventories for that purpose, in addition to defining safety stocks for each period in the horizon.
There is limited production capacity both for regular work hours (for which there are no additional labor costs because this labor is a fixed cost during regular shifts) and for overtime production (which could be done on weekends and would mean additional costs).There is also a limit for the internal storage of products.The company has the alternative of outsourcing storage, more expensive than the company's own.Stockouts will lead to lost sales.
The real-life problem is complex because of demand uncertainty, the fact that storage and stockout costs are not linear, and because the unit cost of storage depends on the proportion of internal and external storage.
The deterministic linear model was the first tested in this study.Next, came the probabilistic linear model with iterations, which calculates safety stocks as a function of the ratio between storage and stockout costs, as suggested by Tarim & Kingsman (2006), and uses an iterative process to refine results.This iterative process is necessary because the unit cost of storage, which is initially used to calculate the safety stock, changes after the calculation of decisions on production, inventories, and sales, when external storage is used, as it is more expensive than internal storage.Last, the non-probabilistic linear model with iterations is presented.Unlike the previous model, it calculates expected stockouts as a function of demand uncertainty.In all models, ordering cost is significant.The last model is the closest to reality, but the presentation order chosen, from the simplest to the most complex model, would facilitate understanding the increasing difficulty to operationalize the models.
The models are, then, compared to evaluate if the calculation of expected stockouts and the use of the iterative process to refine the unit cost of storage, methods that take longer and are more laborious, are compensated by a significantly better result for the company.

Deterministic linear model
In the deterministic situation, in which demand is known without uncertainty, there would not be shortage, because the company's policy is to always try to meet customers' needs.
The decision variables are: Vit sale (quantity to be sold) of product I in period t (independent) Wit binary indicating production of product i in period t (independent) Pit production (quantity to be produced) of product i in period t (independent) 7/18 EFit inventory (quantity to be stored) of product i at the end of period t (dependent) EFIit internal inventory of product i at the end of period t (dependent) EFEit external inventory of product i at the end of period t (independent) HNt regular hours used in period t (dependent) HXt overtime used in period t (independent) The initial parameters necessary and their values are: EFi0 final inventory of product i at instant 0 (0t e 0t) The value of G must be equal or greater than the demand for the entire planning horizon, permitting, at the limit, that a single order is placed for the entire horizon.This set of inequations, which involves variables Wit, assures that the binary variable is equal to 1, if an order for product i is placed in the respective period t, and zero, if the order is not placed (leftoverit must be greater than or equal to zero; in the tables, they are the lines "Order-production coherence").Table 1 presents an example based on a hypothetical company.A seven-month horizon was used, with only two products, to limit the size of the problem and enable its resolution by the Solver available in MS Excel, which would facilitate the analysis of the models by someone who wants to test them.Larger problems would require adopting other optimization tools that would not add much to the analyses of this paper.In the first period, it is necessary to produce both products.Stockout cost is not considered, because in the deterministic situation stockout is not a must, because there is always capacity to meet demand with production in periods of lower demand.Part of the demand of months 4 to 6 is met with the anticipated production of product 2 on month 3, and with overtime production on months 3 to 6.As the products have the same parameters, the solution of anticipating production of product 1 and storing it would be equivalent.The internal storage limit is reached in months 3 and 4, which required hiring external space.Ordering costs as 100$ is relatively low value, which justifies the production of the two products in all periods.With higher ordering costs, the option of producing products in an alternating system (one in each period) will be adopted, as the following model results will show.This first model had the aim of confirming the results obtained by Biazzi (2018) in the equivalent model (linear without safety stock).

Linear model with probabilistic demand and iterations
In more common situations, in which demand is uncertain, the company must adopt safety stocks.Bookbinder & Tan (1988), Feiring & Sastri (1990) and Tarim & Kingsman (2004) use cycle service level as a parameter to define the safety stock.This paper uses Tarim & Kingsman (2006) logic, which considers the relation between stockout (f) and storage (e) unit costs for that purpose.The relation f/(f+e), with both costs calculated having the end of the month as the basis, enables calculating the probability that demand be fully met at the end of the month.The safety coefficient to meet demand (z) is found through the reverse function of accumulated probability for the normal-standard distribution.The safety stock (ES) is the result of the multiplication of z by the standard deviation of the month's demand (sd).Finally, the target minimal initial inventory for the month (EImin) would be the average demand plus the month's safety stock.These calculations should be made for each month of the planning horizon and for each product, which requires using indexes "t" and "i" for the parameters.
As done by Biazzi (2018), in the case of the unit cost of storage and the safety coefficient z, in principle, values would be recalculated through iterations, because, upon the need of using external storage space, the unit cost of storage would increase.This higher storage cost will suggest a lower safety coefficient, leading to an also smaller safety stock.The unit cost of storage in the second iteration is calculated as a weighted average, resulting from quantities stored inside and outside the company in the previous iteration.
It is important to emphasize that, in this model, although demand was considered uncertain to calculate the safety stock, this uncertainty is not considered to calculate possible shortages.In this linear version of the probabilistic problem, demands would still be fully met.The model presented in the following section is more complete and considers the possibility of stockout.
In addition to the parameters presented in the initial model, the following are necessary: sdit standard deviation of demand of product i in period t fi unit shortage cost of product I (includes lost sales plus possible additional shortage costs (fadi), resulting from contract penalties or other penalties) eit unit holding cost of product i per period t zit safety coefficient of product i per period t F(zit) cumulative probability function corresponding to coefficient z of product i ESit safety inventory of product i for period t EImínit minimal initial inventory of product i for period t In this case, the additional stockout cost was estimated to be 600$/t for the two products.As the unit sale price is 3000$/t and the direct production cost without labor is 500$/t, the unit cost of stockout was estimated to be 3100$/t, for each product.Distribution is assumed to be normal and independent from demand along time.
The formulation of the probabilistic linear model is (Formula 2): Objective function: maximize margin, margin = revenue minus variable costs of production, holding and overtime work  It is possible to note that production decisions are equivalent to those of the deterministic linear model.Margin is smaller because of the safety stocks required, 602 t every month, for each product.
In this study, in which the safety coefficient is defined by the relation fi/(fi+eit), an iterative calculation process may be used to recalculate the unit cost of storage, resulting from the weighing between internal and external storage costs, which would be greater than the internal storage cost.In a study in which the safety stock would be calculated in function of an imposed cycle service level, similar to those of Bookbinder & Tan (1988) and Tarim & Kingsman (2004), this iteration would not be necessary, because the coefficient would be the same, even if stockout unit costs changed.
In the example analyzed, the storage unit cost of product 2 in period 3 would go up to 620.6$/t/month, result from the weighing (1,398.0×400+ 1,719.8×800)/(1,398.0+ 1,719.8); a similar effect would occur in period 4. Again, as the products have the same parameters, there are other equivalent solutions.Table 3 presents the results of the second iteration of the probabilistic linear model.It is possible to note that the margin increase was null, thus indicating that the iterative process would be necessary only if the quantities stored externally were much greater than the quantities stored internally and/or if the external storage cost was much higher than the internal storage cost.Even in these situations, the iterative process is unlikely to be necessary, because, although the safety stock and the minimal initial inventory may be smaller, the initial inventory of the period in which this reduction occurs leads to a higher value than the minimal because of the requirement of anticipating production.
With ordering costs as $10,000, decisions still are to produce both products in every period, with a final margin of $148,225,361, smaller only due to the difference in ordering costs.With ordering costs as $1,000,000, making both products in every period still is the most appropriate option.Assuming ordering costs as $10,000,000, making each product once every two periods alternately becomes advantageous (except for the first period, because there is not enough initial inventory of the two products to also meet the demand of the second period).
Table 4 presents the result of the third iteration of the probabilistic linear model considering ordering cost as $10,000,000.The margin is smaller than in the situation with ordering costs as 100$, basically because of ordering costs (even ordering each product once every two periods, the total ordering cost is $80,000,000), besides the increase in total storage costs (necessary due to the decision of ordering once every two periods).On the fourth iteration, the margin stops increasing.Compared to the first iteration, the margin increase was 3.2%, result of the adjustments in the unit cost of storage.

Nonlinear model with iterations and probabilistic demand and stockout
This model complements the previous one, considering that the expected stockout for each period in the horizon is calculated after reevaluating the safety coefficient z.In the periods of lower demand, the minimal initial inventory, calculated as the sum of average demand with the safety stock-suggested by the safety coefficient resulting from the relation fi/(fi+eit)-becomes each period's initial inventory, because there would not be any interest in building inventories.However, in the periods immediately before those of higher demand, in which production is anticipated, the initial inventory of the period leads to a value greater than the minimal.With this, the final safety coefficient (zfit) can be calculated (Formula 3): ( ) In the cases in which demand follows a normal distribution, average loss (Fit) may be estimated for each period based on standardized average loss, given by the loss integral of the normal-standard distribution at point z, I(z) (Formula 4): ( ) I(z) value may be obtained through tables (Silver et al., 1998) or, in MSExcel, with the use of the functions available: I(z) = f(z) -z × (1 -F(z)), in which f(z) is the probability density function of the normal-standard, and F(z) is the accumulated probability function of the normal-standard (according to Chopra & Meindl, 2001).
The function of this loss integral is not linear, which would require adopting a search software or using the technique of piecewise linear function (chosen by Tarim & Kingsman, 2006).In this study, MSExcel's Solver was used; it also has a search function (as chosen by Biazzi, 2018).As stockout is expected, projected sales would not be the demand of the period, but the difference between it and the expected stockout (Formula 5): This stockout would lead to a cost that did not exist in the previous situations.Part of this stockout cost would arise from the margin loss (unit revenue minus direct unit cost of production without labor) and another part, from an additional penalty, whose unit value is fadi.
The formulation of the non-probabilistic linear model would be (Formula 6): objective-function: maximize margin, margin = revenue minus variable costs of production, storage, stockout, and overtime labor.

(
)  The second iteration of the non-probabilistic linear model is shown in Table 6.As in the situation of the probabilistic linear model, a second iteration did not change much the results of the first.The total margin of the horizon is smaller than the previous models because uncertainty requires safety stock and causes shortage too.In the example, stockouts are small (less than 1% of the demand), coherent with their unit cost significantly greater than the unit cost of storage.In the periods immediately before higher demand periods, there are larger inventories than the minimal for that period, leading to less stockout.

Evaluation of the problem-solving approaches
Table 7 presents the results of the decisions of the second iteration of the probabilistic linear model in the form of calculation of the non-probabilistic linear model, considering ordering costs to be $100.It is possible to note that, as the first of them does not consider stockout, decisions would point toward a slightly larger inventory, and the same would occur with expected sales.The total margin, however, would lead to a slightly smaller value (0.4%).The use of a nonlinear model did not lead to significantly better results, and the same can be said of the iterative calculation process to refine the value of the unit cost of storage.In problems of greater dimensions, with tens or hundreds of products, the nonlinear model would be used with greater difficulty.With this, it seems possible to say that the use of a deterministic linear model (equivalent to the probabilistic linear model, but without the iterations) with the adoption of minimal inventories at the end of each period equivalent to the safety stock of each period, can be sufficient for good decision making, without excessive effort to reach results.

Conclusions and possible further studies
The results of the examples of the application of the three models, namely, linear deterministic, linear probabilistic, and nonlinear probabilistic permit saying that, for the hypothetical company analyzed, the application of the most complex model would not be necessary.For situations with several products and longer planning horizons, the quantity of variables and constraints would increase proportionally.Moreover, considering the problem as nonlinear would require using the piecewise linear function technique (which also leads to imprecisions) or using a search software (without assurance of finding optimal results and with longer processing times).If we weight the results each model coherence 1 leftov1t 96500.097000.096500.094500.094000.094500.096000.0Order-production coherence 2 leftov2t 96500.097000.093984.394855.395805.1 94855.3

Table 1 .
Results of the deterministic linear model.
Table 2 presents the results for the problem considering safety stock constraints.

Table 2 .
Results of the first iteration of the probabilistic linear model, considering ordering costs as $100.

Table 3 .
Results of the second iteration of probabilistic linear model, considering ordering costs as $100.

Table 4 .
Results of the third iteration of the probabilistic linear model considering ordering costs as $10,000,000.
Table5presents the results of the first iteration of the non-probabilistic linear model, considering ordering costs to be $100.

Table 5 .
Results of the first iteration of the non-probabilistic linear model.

Table 6 .
Results of the second iteration of the non-probabilistic linear model, considering ordering costs to be $100.

Table 7 .
Results of entering the decisions of the probabilistic linear model in the calculations of the non-probabilistic linear model.