- Original Article
- Open Access
- Published:

# An algorithm for general infinite horizon lot sizing with deterministic demand

*Pacific Journal of Mathematics for Industry*
**volume 9**, Article number: 6 (2017)

## Abstract

We present an algorithm for solving an infinite horizon discrete time lot sizing problem with deterministic non-stationary demand and discounting of future cost. Besides non-negativity and finite supremum over infinite horizon, no restrictions are placed on single period demands. (In particular, they need not follow any cyclical pattern). Variable procurement cost, fixed ordering cost, and holding cost can be different in different periods. The algorithm uses forward induction and its essence lies in the use of critical periods. Period *j* following *t* is the critical period of *t* if satisfying demands in any subset of the set of periods between *t* and *j*, including *j* and excluding *t*, from an order in *t* is not more expensive than satisfying it from an order in a later period and *j* is the last period with this property. When deciding whether to place an order in period *t*, all demands from *t* to its critical period are taken into account.

## Introduction

Firms’ activities are dynamic in their nature and conditions for them can change. Therefore, dynamic models for optimization of inventories are needed. This requirement is satisfied (within the class of deterministic models) by dynamic discrete time lot sizing models with deterministic non-stationary demand. (See ([3], Chapter 4) for their description). Nevertheless, these models have finite horizon. This is usually justified by life-cycle of the good that is purchased ([3], p. 92). Firms, however, usually do not have an upper bound on their life time. Thus, infinite horizon discrete time models are more appropriate for analysis and optimization of their activities, including inventory management. Moreover, a repetition of an optimal inventory strategy computed from a finite horizon program can lead to suboptimal behavior in models with infinite horizon. (See ([1], subsection 2.1) for an example). Therefore, the use of finite horizon discrete time models of dynamic lot sizing with deterministic non-stationary demand should be supplemented by the use of infinite horizon discrete time models of dynamic lot sizing with deterministic non-stationary demand, keeping the usual assumptions of the former, namely periodic review of inventory (at the beginning of a period), zero lead time, impossibility of backorders. Since algorithm for an infinite horizon lot sizing with deterministic demand without a cyclical pattern does not exist, our study is necessary in order to help firms to improve their inventory policy by solving subsequent finite horizon inventory optimization problems in a way consistent with inventory optimization over the infinite time horizon.

In the present paper we develop an algorithm for computing optimal inventory strategy for a general infinite horizon lot sizing with deterministic demand. We work with discounting of future cost (which is a common approach in microeconomics) rather than with the limit of average cost as the length of the time horizon approaches infinity. (See ([3], Chapter 10) for characterization of the latter approach). Besides non-negativity and finite supremum over infinite horizon, no restrictions are placed on single period demands. (In particular, they need not follow any cyclical pattern. Therefore, the algorithm developed in [1] cannot be used here). Variable procurement cost, fixed ordering cost, and holding cost can be different in different periods.

## Methods

Unlike algorithms for finite horizon lot sizing with deterministic demand [6, 7], our algorithm is not based on dynamic programming. It uses (similarly to [7]) forward induction but its essence lies in the use of critical periods. A period *j* following period *t* is the critical period of *t* if (a) satisfying demand in any subset of the set of periods {*t*+1,…,*j*} from an order in *t* (provided that an order is made in period *t* to satisfy demand in period *t*) is not more expensive than satisfying it from an order in a period *k*∈{*t*+1,…,*j*} (from which it can be satisfied) and (b) *j* is the last period with this property. If such period *j* does not exist, then the critical period of *t* is *t*. (If the critical period is the same for period *t* and several consecutive periods following it, then an order is placed only in period *t*). When deciding whether to place an order in period *t*, all demands from *t* to its critical period are taken into account. Thus, for each period *t*, we determine the last period in which demand is served from an order in *t*, not, as in [7], the period in which an order satisfying demand in *t* is placed. (It is worth noting that a backward induction, as in [6], cannot be used in our infinite horizon model). This speeds up computation of an optimal inventory strategy. Each period is considered as a candidate for making an order only once. If it fails the test, it is not considered any more. Nevertheless, if it passes the test, it can be eliminated when some later period passes the test. Once it is eliminated, it is not considered any more. When we get to the first period following the critical period of *t*, in which an order is made, we can be sure that the following computations will not change quantity ordered in the critical period of *t* and preceding periods. Thus, we can compute optimal ordered quantities for any finite number of consecutive periods without computing them for the rest of the time horizon of the model. That is, our algorithm for general infinite horizon decision problem (that, in its general form, can never be solved in real life) is suitable for solving subsequent finite horizon decision problems in a time consistent way (in the sense that solutions of several subsequent decision problems with finite time horizons together give solution to the union of them).

Throughout the paper, \(\mathbb {N}\) denotes the set of positive integers and ℜ the set of real numbers. We endow each finite dimensional real vector space with the Euclidean topology and each infinite dimensional Cartesian product of finite dimensional real vector spaces with the product topology.

## Results and discussion

### 3.1 Inventory optimization problem

The time horizon of the optimization problem is \(\mathbb {N}\). A firm wants to minimize sum of discounted total cost of satisfying demands for a single input. It uses the same discount factor *δ*∈(0,1) in each period. (It does not discount the first period).

###
**Remark 1**

In order to avoid misunderstanding, we stress that, in our deterministic model, discounting of future cost does not express uncertainty about them. (We briefly discuss in Remark 5 how to take uncertainty about model parameters into account). It expresses the fact that the present value of future cost is lower than its actual amount in the future. The discount factor can be approximated using the weighted average of the interest rates (per the time equal to the length of period in the model) for firm’s short-term loans financing material expenditures or non-investment expenditures. When this weighted average of interest rates (expressed as a decimal number, not in percentage points) is *i*, then \(\delta =\frac {1}{1+i}\). Of course, these interest rates can also vary. A model with the same discount factor for each period is suitable when a firm has little information about future development of short-term interest rates. If it has such information, the model can be modified by allowing for different discount factors in different periods. Except for working with different discount factors, the algorithm given in the following section will be unchanged. If the supremum of values of the discount factor over all periods is less than one, then objective function (2) is well defined and program (2)-(6) has an optimal solution.

Durability of the input is \(T\in \mathbb {N} \backslash \left \{ 1\right \} \) periods (i.e., an input purchased in period *t* can be used in periods *t*, *t*+1, …, *t*+*T*−1). For each \(t\in \mathbb {N} \), *d*
_{
t
}≥0 is deterministic demand for the input in period *t*, *C*
_{
t
}≥0 is unit purchasing cost of the input in period *t*, *h*
_{
t
}≥0 is the unit holding cost in period *t* (i.e., cost of storing one unit of the input between periods *t* and *t*+1), and *K*
_{
t
}≥0 is the fixed ordering cost in period *t* (a firm incurs it if and only if it makes an order in period *t*). We assume that

Denote by *x*
_{
t
}≥0 the stock of the input at the beginning of period *t*, before the decision to order or not to order is made. We assume that, using its stock of the input to satisfy demand, a firm proceeds from its oldest to its newest part. We also assume that \(0\leq x_{1}\leq {\sum \nolimits }_{t=1}^{T-1}d_{t}\) and its composition with respect to vintages of the input is such that it can be fully used in periods 1,…, *T*−1. Let *q*
_{
t
}≥0 be an order in period *t* and let *α*
_{
t
}∈{0,1} satisfy *α*
_{
t
}=1 if an order is made in period *t*. Then a firm solves the minimization program

subject to

The objective function (2) is the sum of discounted purchasing cost, discounted fixed ordering cost, and discounted cost of holding inventory. (Taking into account (1), it is well-defined and continuous). We cannot omit purchasing cost from the objective function because cost is discounted and unit purchasing cost of the input can be different in different periods. Constraint (3) ensures that demand is satisfied in each period. Constraint (4) ensures that ordered quantities are non-negative and (together with the assumption on the order of using parts of a stock and the assumption on *x*
_{1}) that in each period a firm purchases only an amount of the input that can be used before its durability expires. It also ensures that an order is made in period *t* only if *α*
_{
t
}=1. (Clearly, in each optimal solution of program (2)-(6) an order is made in period *t* if *α*
_{
t
}=1). Eq. (5) describes dynamics of stock of the input.

A strategy is a sequence \(s=\left \{ \left (\alpha _{t},q_{t}\right) \right \} _{t\in \mathbb {N} }\). It is feasible if it satisfies constraints (3)-(6). It is optimal if it solves program (2)-(6).

Clearly, the set of feasible strategies is non-empty. (It is enough to set, for each \(t\in \mathbb {N} \), *q*
_{
t
}= max{*d*
_{
t
}−*x*
_{
t
},0} and *α*
_{
t
}=1 if and only if *q*
_{
t
}>0). It is closed because constraints (3) and (4) are expressed by weak inequalities and (5) by equality between terms continuous in components of a strategy. It is also compact because it is a subset of space \(\left (\left \{ 0,1\right \} \times \left [ 0,T\sup _{t\in \mathbb {N} }d_{t}\right ] \right)^{\infty }\) that is compact by Tychonoff theorem. Thus, as the objective function is continuous, program (2)-(6) has an optimal solution. In the following subsection we propose an algorithm for its solution.

###
**Remark 2**

Following the tradition established in operational research literature by *[*
6
*]* and *[*
7
*]*, we analyze purchasing of one input in a deterministic model. Of course, there are inventory models of multi-echelon supply chains (e.g. *[*
4
*]*). These include also production of several inputs. Since production units are part of a modelled system, there is no fixed ordering cost. Such models are certainly very useful. Nevertheless, they can be applied only to firms that produce inputs for themselves (e.g. telecommunication firms producing electronic components) or associations of firms that include both producers and users of inputs. (In the latter case, however, if such association includes several producers and/or several users of an input, it includes several firms operating on the same side of a market - i.e. potential competitors. Therefore, it can face objections from anti-trust authorities). A model of purchase of one input is useful for firms that buy inputs in separated markets and cannot (significantly) effect their prices because their demand is small relative to the size of the market. Such firms can but need not be small with respect to the market for their output. (For example, a firm producing washing machines can be one of a few oligopolists in its output market but its demand for steel can be small relative to the size of the market). Despite this, ordering of input requires some administrative procedure, so a special kind of transaction cost, called fixed ordering cost, has to be included in the objective function of these models.

### 3.2 Algorithm

For each \(t\in \mathbb {N} \) let

*W*
_{
t
} is the set of periods with the property that it is not cheaper to satisfy demand in them from an order in them than from an order in period *t*. *V*
_{
t
} is the set of elements *j*∈*W*
_{
t
} with an additional property that it is not more expensive to satisfy demands in any set of successive periods belonging to {*t*+1,…,*j*} from an order in period *t* than from an order in some period in {*t*+1,…,*j*−1}. We call *r*
_{
t
} the critical period of period *t*. If *V*
_{
t
} is nonempty, *r*
_{
t
} is its maximal element. If *V*
_{
t
} is empty but *W*
_{
t
} contains *t*+1, then *r*
_{
t
}=*t*+1. If *V*
_{
t
} is empty and *W*
_{
t
} does not contain *t*+1, we formally set *r*
_{
t
}=*t*. Thus, *r*
_{
t
}≠*t* is the critical period of period *t* if satisfying demands in any subset of the set of periods between *t* and *j*, including *j* and excluding *t*, from an order in *t* is not more expensive than satisfying it from an order in a later period and *j* is the last period with this property. (See also Remarks 2 and 3 below).

###
**Remark 3**

It is not hard to see from (8) that, if *j*∈*W*
_{
t
}∖(*V*
_{
t
}∪{*t*+1}), then *k*∉*V*
_{
t
} for each *k*>*j*. Thus, (taking into account Remark 4) in order to determine *r*
_{
t
} when *t*+2∈*V*
_{
t
}, it is enough to find the first period *i* with *i*>*t*+2 and *i*∉*V*
_{
t
} and set *r*
_{
t
}=*i*−1.

###
**Remark 4**

If *j*∈*V*
_{
t
} then *i*∈*V*
_{
t
} for each *i*∈{*t*+2,…,*j*−1} and *t*+1∈*W*
_{
t
}. Take (arbitrary) *j*∈*V*
_{
t
} and *i*∈{*t*+1,…,*j*−1}. With respect to Remark 2, if *i*∈*W*
_{
t
} and *i*>*t*+1, then *i*∈*V*
_{
t
}. Thus, it is enough to show that *i*∈*W*
_{
t
}. Suppose that *i*∉*W*
_{
t
}. Then, using (7),

Since *K*
_{
i
}≥0 and *δ*>0, the above inequality implies that *d*
_{
i
}>0 and \(C_{t}+{\sum \nolimits }_{k=t}^{i-1}\delta ^{k-t}h_{k}-\delta ^{i-t}C_{i}>0\). From this and *d*
_{
i+1}≥0 it follows that

Comparing this with definition of *V*
_{
t
} in (8), we conclude that *j*∉*V*
_{
t
}, which is a contradiction. Hence, *i*∈*W*
_{
t
}.

We derived the critical period as follows. Clearly, if for period

we have *j*∉*W*
_{
t
} (i.e., if it is cheaper to satisfy demand in period *j* from an order in this period than from an order in period *t*), then demand in period *j* will not be satisfied from an order in period *t* (it will be satisfied from an order in some period from the set {*t*+1,…,*j*}). Thus, only a period belonging to *W*
_{
t
} can be the critical period of period *t*. Nevertheless, for some period *j*∈*W*
_{
t
}∖{*t*+1}, if the fixed ordering cost in some period *i*∈{*t*+2,…,*j*−1} is incurred in order to satisfy demands in periods *i*,…,*i*+*n* for some *n*∈{1,…,*j*−*i*}, then (with respect to holding cost in periods *t*,…, *i*−1) it can be cheaper to cover demands in periods *i*,…,*i*+*n* from an order in *i* than from an order in *t*. If this happens, then demands in periods *i*,…,*i*+*n* will not be satisfied from an order in *t*. Thus, period *j* cannot be the latest period following *t* with the property that satisfying demands in any subset of the set of periods between *t* and *j*, including *j* and excluding *t*, from an order in *t* is not more expensive than satisfying it from an order in a later period. That is, *j* cannot be the critical period of period *t*. In the algorithm, this situation is formally expressed as *j*∉*V*
_{
t
}. Hence, (if *r*
_{
t
}≠*t*) only a period belonging to *V*
_{
t
}∪{*t*+1} can be the critical period of period *t*. Since *r*
_{
t
} is the latest period following or equal to *t* with the property that satisfying demands in any subset of the set of periods between *t* and *j*, including *j* and excluding *t*, from an order in *t* is not more expensive than satisfying it from an order in a later period, if *V*
_{
t
} is nonempty, we set *r*
_{
t
}= max*V*
_{
t
}. It remains to determine *r*
_{
t
} in the case when *V*
_{
t
} is empty. Clearly, if *t*+1∈*W*
_{
t
}, then *t*+1∈*V*
_{
t
}. (For *j*=*t*+1 there does not exist period *i* with *t*+1≤*i*≤*j*−1. This is the reason why we excluded period *t*+1 in computation of *V*
_{
t
}). Thus, if *V*
_{
t
} is empty but *t*+1∈*W*
_{
t
}, then *r*
_{
t
}=*t*+1. If *V*
_{
t
} is empty and *t*+1∉*W*
_{
t
} (i.e., it cannot be optimal to cover demand in *t*+1 from an order in *t*), we formally set *r*
_{
t
}=*t*.

The practical meaning of the critical period of period *t* lies in the fact that it is the last period that can affect optimality of an ordering decision in period *t*. That is, in deciding demands in which periods will be satisfied from an order in period *t*, we need not consider periods following the critical period of period *t*. The same holds for each period *t*+1,…,*r*
_{
t
}. Thus, in order to compute a quantity of the input ordered in period *t*, we need to know only demands and cost in each period *j*∈{*t*,…, max{*r*
_{
k
}∣*k*∈{*t*,…,*r*
_{
t
}}}} and demands and cost needed to compute *r*
_{
k
}, *k*∈{*t*,…,*r*
_{
t
}}. We can obtain other data when we need them for computations.

Symbol *m*
_{
t
} stands for the first period following *t* in which an order is made. In the algorithm, in order to shorten its description, we formally allow for the case *m*
_{
t
}=*t*. In the description of the algorithm below, values without asterisk are preliminary (they can be changed by later computations and decisions) and values with asterisk are final. Arrow (→) stands for assignment command (e.g., *a*→*b* means that a is assigned to symbol b); we use it when the equality sign (=) is false from the mathematical point of view or it could lead to a confusion.

Since minimization program (2)-(6) has infinite horizon, the algorithm for solving it is open-ended. Nevertheless, when it determines values \(\alpha _{t}^{\ast }\) and \(q_{t}^{\ast }\) for some \(t\in \mathbb {N} \), we already know optimal purchased quantities for all periods 1,…,*t*. Thus, in period \(k\in \mathbb {N} \) a firm can compute optimal values till period *k*+*n* for some \(n\in \mathbb {N} \), use them in its purchases, and continue with inventory optimization for another finite set of successive periods later on.

The algorithm identifies a sequence of periods \(\left \{ t_{n}\right \}_{n\in \mathbb {N} }\) such that *t*
_{1}=1 and \(\phantom {\dot {i}\!}t_{n+1}\geq r_{t_{n}}+1\) for each \(n\in \mathbb {N} \) (*t*
_{1}=1 is set in step 1 and switching from *t*
_{
n
} to *t*
_{
n+1} takes place in steps 7, 8, and 9). Each iteration of the algorithm starts with setting a new value of *t*. The *n*-th iteration starts with setting *t*=*t*
_{
n
} and ends with setting *t*=*t*
_{
n+1}. (In the example below we compute results for the first two iterations). Iteration *n* is non-trivial if *t*
_{
n+1}>*t*
_{
n
}+1. (Iteration *n* is trivial if demand in period *t*
_{
n
} is satisfied from the stock of the input in period *t*
_{
n
}, or *r*
_{
t
}=*t*, i.e. satisfying demands in any finite set of successive periods after *t*
_{
n
} from an order in *t*
_{
n
} is more expensive than satisfying them from an order in a later period. See steps 2 and 3). For iteration *n*, which is non-trivial, the symbol *m*
_{
t
} either equals *t* or it denotes the first period after *t*=*t*
_{
n
} (but no later than \(r_{t_{n}}\)) in which an order is made. (In order to simplify notation, we use in this explanation symbol *m*
_{
t
} instead of \(m_{t_{n}}\)). It changes in the process of computations. We successively determine the cost minimizing way of satisfying demands since period *t*
_{
n
} up to period *r*
_{
ℓ
} for \(\ell =t_{n}+1,\ldots,r_{t_{n}}\phantom {\dot {i}\!}\). In doing so, we omit values of *ℓ* for which \(\phantom {\dot {i}\!}r_{\ell }\leq r_{m_{t}}\) (i.e., periods *ℓ* such that demands in periods *ℓ*,…,*r*
_{
ℓ
} can be satisfied with lower or the same cost from an order in period *m*
_{
t
} than from an order in period *ℓ* - see step 4). If it is cheaper to satisfy demands since period *t*
_{
n
} up to period *r*
_{
ℓ
} from orders in periods *t*
_{
n
} and *ℓ* than from orders in periods *t*
_{
n
}, *m*
_{
t
}, and \(r_{m_{t}}+1\), then we set *m*
_{
t
}=*ℓ*, otherwise *m*
_{
t
} is unchanged. If \(\phantom {\dot {i}\!}m_{t}<r_{t_{n}}\) is unchanged when we examine all periods \(\phantom {\dot {i}\!}m_{t}+1,\ldots {r}_{t_{n}}\), we continue with periods \( r_{t_{n}}+1,\ldots,r_{m_{t}}\). (See step 5, step 7 when \(\ell >r_{m_{t}}\phantom {\dot {i}\!}\), and step 9 when *ℓ*=*r*
_{
t
}+1). If *m*
_{
t
} is not replaced by any of these periods, we start a new iteration in period \(\phantom {\dot {i}\!}r_{m_{t}}+1\) (see step 7). Thus, when we start the iteration *n*+1 in period *t*
_{
n+1}, values of \( \alpha _{j}^{\ast }\) and \(q_{j}^{\ast }\) for *j*∈{*t*
_{
n
},…,*t*
_{
n+1}−1} computed in iteration *n* minimize the sum of discounted total cost of satisfying demands in periods *j*=*t*
_{
n
},…,*t*
_{
n+1}−1. Since this holds also for all previous iterations, for each \(n\in \mathbb {N} \), values \(\alpha _{j}^{\ast }\) and \(q_{j}^{\ast }\) for *j*∈{1,…,*t*
_{
n+1}−1} computed in iterations 1,…,*n*, minimize the sum of discounted total cost of satisfying demands in periods *j*=1,…,*t*
_{
n+1}−1.

The strategy *s*
^{∗} generated by the algorithm solves program (2)-(6). This can be seen as follows. Suppose that there exists a feasible strategy *s* that gives a lower value of objective function (2). Then, taking into account discounting of cost and (1), there exists \(n\in \mathbb {N} \) such that the sum of discounted total cost of satisfying demands in periods 1,…,*t*
_{
n+1}−1 (where *t*
_{
n+1} is the period in which iteration *n*+1 starts under *s*
^{∗}) under *s* is lower than under *s*
^{∗}. This contradicts the observation in the last sentence of the preceding paragraph.

###
**Remark 5**

Although our model is deterministic, it is useful to comment on possibility to take uncertainty about its parameters into account. First (as already noted), we need parameters only for the current iteration of the algorithm. The number of periods, for which we need parameters of the model in order to complete one iteration of the algorithm, is bounded from above by 2*T*−1. Thus, when making computations for an iteration of the algorithm starting in period *t*, we need not worry about parameters for periods after *t*+2(*T*−1). Assume that actual values of uncertain parameters in any period *i* will be known only in period *i*. Consider making computation for an iteration starting in period *t*, actual demand in which is known and it exceeds the stock of input at the beginning of period *t*. If we are uncertain about parameters for (some of) the periods *t*+1,…,*t*+2(*T*−1), we can work with probability distributions for the uncertain parameters. In (7) and (8) we replace both sides of inequalities by their expected values. Let the current iteration start in period *t* and let *τ*∈{*t*+1,…,*t*+2*T*−2} be the first period after *t* for which we are uncertain about some parameter of the model. Then we end the current iteration (as in the deterministic case) when ordered quantities in periods *t*,…,*r*
_{
t
} are determined, we order in each period *k*∈{*t*,…, min{*r*
_{
t
},*τ*−1}} computed quantity \(q_{k}^{\ast }\), and we start a new iteration in period *j*, which is the first period after min{*r*
_{
t
},*τ*−1}, in which demand is not covered by the order in any of the periods *t*,…, min{*r*
_{
t
},*τ*−1}. Ordered quantities \(q_{k}^{\ast }\), *k*∈{*t*,…, min{*r*
_{
t
},*τ*−1}}, are optimal from the ex ante point of view (with respect to expected values of uncertain parameters) but they can fail to be optimal from the ex post point of view (with respect to actual values of uncertain parameters). Their ex ante optimality stems from the fact that (i) for each period *i*, *r*
_{
i
} is the last period that can affect optimality of an order decision in period *i* and (ii) an iteration of the algorithm starting in period *t* does not end until we compute an ordering decision for each period *i*∈{*t*,…,*r*
_{
t
}}, taking into account demands in periods *i*,…,*r*
_{
i
}.

###
**Example 1**

Let *δ*=0.7,*T*=5, *x*
_{1}=0,

*d*
_{1}=10, *d*
_{2}=20, *d*
_{3}=15, *d*
_{4}=25, *d*
_{5}=12, *d*
_{6}=14, *d*
_{7}=9, *d*
_{8}=11, *d*
_{9}=27,*d*
_{10}=25,*d*
_{11}=28,

*h*
_{1}=1, *h*
_{2}=2, *h*
_{3}=5, *h*
_{4}=2, *h*
_{5}=3, *h*
_{6}=2, *h*
_{7}=1, *h*
_{8}=6, *h*
_{9}=4, *h*
_{10}=6,*h*
_{11}=7,

*K*
_{1}=100, *K*
_{2}=110, *K*
_{3}=90, *K*
_{4}=50, *K*
_{5}=120, *K*
_{6}=150, *K*
_{7}=320, *K*
_{8}=115, *K*
_{9}=80,*K*
_{10}=160,*K*
_{11}=60,

*C*
_{1}=6, *C*
_{2}=15, *C*
_{3}=12, *C*
_{4}=7, *C*
_{5}=11, *C*
_{6}=14, *C*
_{7}=13, *C*
_{8}=6, *C*
_{9}=8, *C*
_{10}=9, *C*
_{11}=8.

**Iteration 1.**

**Step 1.** We set *t*=1 and go to step 2.

**Step 2**. Since *d*
_{1}=10>*x*
_{1}=0, we go to step 3.

**Step 3.** We set \(\alpha _{1}^{\ast }=1\) and compute \( W_{1}=\left \{ 2,3\right \} \neq \varnothing \), \(V_{1}=\left \{ 3\right \} \neq \varnothing \), and *r*
_{1}= max*V*
_{1}=3. Since *r*
_{1}>1, we set *q*
_{1}=*d*
_{1}−*x*
_{1}=10, *ℓ*=2, *m*
_{1}=1, and go to step 4.

**Step 4.** Since *ℓ*=2<*r*
_{1}=3, we compute *W*
_{2}=\(\varnothing \), so we set \(\alpha _{2}^{\ast }=0\), \(q_{2}^{\ast }=0\), *q*
_{1}=30, *ℓ*=3, and return to step 4.

**Step 4 again.** Since *ℓ*=3=*r*
_{1}, we compute \( W_{3}=\varnothing \), so we set \(\alpha _{3}^{\ast }=0\), \(q_{3}^{\ast }=0\), *q*
_{1}=45, *ℓ*=4, and return to step 4.

**Step 4 again.** Since *ℓ*=4>*r*
_{1}=3, we go to step 7.

**Step 7.** Since *ℓ*>*r*
_{1}, we set \(\alpha _{1}^{\ast }=1\), \( q_{1}^{\ast }=q_{1}=45\), *t*=*r*
_{1}+1=4, *x*
_{4}=0, and go to step 3.

**Iteration 2.**

**Step 3.** We set \(\alpha _{4}^{\ast }=1\) and compute *W*
_{4}={5,6}, *V*
_{4}={6}, and *r*
_{4}=6. Since *r*
_{4}>4, we set *q*
_{4}=*d*
_{4}−*x*
_{4}=25, *ℓ*=5, *m*
_{4}=4, and go to step 4.

**Step 4.** Since *ℓ*=5<*r*
_{4}=6, we compute *W*
_{5}={6,7}, *V*
_{5}={7}, and *r*
_{5}=7. Since *r*
_{5}>*r*
_{4}=6, we go to step 5.

**Step 5.** Since *ℓ*=5<*r*
_{4}=6, we go to step 6.

**Step 6.** Since *m*
_{4}=4 and

we set *q*
_{4}=*d*
_{4}=25 and go to step 9.

**Step 9.** Since *ℓ*=5<*r*
_{4}+1=7, we set *α*
_{5}=1, \( q_{5}={\sum \nolimits }_{k=5}^{7}d_{k}=35\), *m*
_{4}=5, *ℓ*=6, and go to step 4.

**Step 4.** Since *ℓ*=*r*
_{4}=6, we compute *W*
_{6}={7}, \(V_{6}=\varnothing \), and *r*
_{6}=7. Since *m*
_{4}=5>4 and *r*
_{6}=*r*
_{5}=7, we set \(\alpha _{6}^{\ast }=0\), \(q_{6}^{\ast }=0\), *ℓ*=7, and return to step 4.

**Step 4 again.** Since *ℓ*=*r*
_{5}=7, we compute \( W_{7}=\varnothing \). Since *m*
_{4}=5>4, we set \(\alpha _{7}^{\ast }=0\), \( q_{7}^{\ast }=0\), *ℓ*=8, and return to step 4.

**Step 4 again.** Since *ℓ*=8>*r*
_{5}=7, we go to step 7.

**Step 7.** Since *ℓ*=8>*r*
_{5}=7, we set \(\alpha _{5}^{\ast }=1\), \(q_{5}^{\ast }=q_{5}=35\), \(q_{4}^{\ast }=q_{4}=25\), *t*=8, *x*
_{8}=0, and go to step 3. This starts the third iteration.

###
**Remark 6**

The usefulness of the algorithm stems from the fact that - to our best knowledge - there does not exist another algorithm that can solve problem (2)-(6) by decomposing it to a countable set of steps, without knowing its parameters for each period in the same time. (Parameters of the problem for each period could be known in the same time only if they exhibited some cycle or trend. Our algorithm solves (2)-(6) for general parameters satisfying only (1) and non-negativity constraints). Perhaps, at the first glance, it may seem that model predictive control method, which is capable of solving a wide variety of infinite horizon problems by decomposing them into finite horizon problems and is suitable for managing of multi-echelon supply chains (see *[*
4
*]*) could solve (2)-(6). (See, for example, *[*
2
*]* for survey of model predictive control method). Therefore, we show here that this is not the case. Model predictive control method would, in general, lead to a suboptimal ordered quantities in our deterministic model. The reason is that it replaces an infinite horizon problem with a sequence of finite horizon problems, in which the current state of the plant is used as the initial state. From the solution of the latter only the current period control is applied. Suppose that, in our model, this approach leads to solving the finite horizon problem with periods *t*,..,*t*+*τ*, \(\tau \in \mathbb {N} \). Let *j*∈{*t*,…,*t*+*τ*} be the last period in which the solution prescribes making an order. Then the quantity ordered in period *j* covers demand in periods *j*,…,*t*+*τ*. Nevertheless, it can happen that there does not exist an optimal solution to problem (2)-(6) prescribing such an order in period *j*. Moreover, if we replaced the finite horizon problem with periods *t*,..,*t*+*τ* with the finite horizon problem with periods *t*,..,*t*+*τ*,*t*+*τ*+1, it could happen that (each) optimal solution of the latter prescribes ordering in period *j* the quantity covering demand in periods *j*,…,*t*+*τ*,*t*+*τ*+1 (for example, if *K*
_{
t+τ+1} and/or *C*
_{
t+τ+1} is high and *h*
_{
k
}, *k*∈{*j*,…,*t*+*τ*} is low). Thus, although model predictive control, especially in the form of scenario-based model predictive control (*[*
4
*]*), is a quite efficient method for solving some inventory problems with uncertainty, it is not suitable for solving (2)-(6). Furthermore, even in the stochastic case, the model predictive control method can give ex ante suboptimal results if a finite horizon problem starting in period *t* has a time horizon too short for computing ordered quantities in all periods *t*,…,*r*
_{
t
}. (Compare the last sentence in the first paragraph of Remark 5).

Moreover, there are some technical reasons why model predictive control cannot be applied to problem (2)-(6). In its basic form it assumes that finite horizon problems are time invariant (*[*
2
*]*, p. *790*). This is not the case in our model. (On the contrary, the advantage of our model is that it does not impose any restriction on parameters except for their non-negativity and (1)). Schildbach and Morari *[*
4
*]* do not make such assumption but they assume that the resulting optimization problem would become convex if all uncertain variables were known and fixed (*[*
4
*]*, Assumption 1, p. *543*). This assumption is not satisfied for problem (2)-(6) because variable *α* can take only value 0 or 1.

## Conclusions

We have developed an algorithm for solving an infinite horizon lot sizing problem with deterministic non-stationary demand that does not follow any regular pattern. Of course, a complete solution (for the whole infinite horizon) of such problem can never be obtained. Nevertheless, our algorithm enables us to obtain solution for a finite number of periods (a finite number of iterations of the algorithm), using data for these and several following periods. (In the example in the preceding section, we computed implications of the optimal strategy for first seven periods, using data for four additional periods). The number of periods, for which we need parameters of the model in order to complete one iteration of the algorithm, is bounded from above by 2*T*−1. We can compute implications of optimal strategy for any \(n\in \mathbb {N} \) periods by carrying out the number of iterations of the algorithm, for which the sum of their lengths is not shorter than *n*.

The algorithm allows firms to set an inventory strategy for any chosen finite number of periods that is consistent with inventory strategies chosen optimally in the future. It can be useful also in the analysis of more complex models in which demands for inputs depend on strategic interaction between producers of inputs and their customers (as in [5]).

## References

- 1
Horniaček, M: An algorithm for infinite horizon lot sizing with deterministic demand. Appl. Math. 5, 217–225 (2014).

- 2
Mayne, DQ, Rawlings, JB, Rao, CV, Scokaert, POM: Constrained model predictive control: Stability and optimality. Automatica. 36, 789–814 (2000).

- 3
Muckstadt, JA, Sapra, A: Principles of Inventory Management. Springer, New York (2010).

- 4
Schildbach, G, Morari, M: Scenario-based model predictive control for multi-echelon supply chain management. Eur. J. Oper. Res. 252, 540–549 (2016).

- 5
Šimková, Ľ: Impact of cooperation of firms on both sides of the market on innovation. In: Talášová, J, Stoklasa, J, Talášek, T (eds.)

*Mathematical Methods in Economics (MME 2014), Olomouc, September 2014*, pp. 885–889. Palack ý University in Olomouc, Olomouc (2014). - 6
Wagelmans, A, Hoesel, SV, Kolen, A: Economic lot sizing: An O(

*n*log*n*) algorithm that runs in linear time in Wagner-Whitin case. Oper. Res. 40, S145–S156 (1992). - 7
Wagner, HM, Whitin, TM: Dynamic version of the economic lot size model. Manag. Sci. 5, 89–96 (1958).

### Funding

The research reported in the present paper was financially supported by grant APVV-14-0020 from the Association for Support of Research and Development (APVV) of the Slovak Republic. APVV did not play any role in the design of the study, or development of the algorithm, or writing the manuscript.

### Author’s information

MH is an Associate Professor of Quantitative Methods in Economics at the Faculty of Social and Economic Sciences of Comenius University in Bratislava. He currently serves as a Vice-Dean for study affairs.

### Competing interests

The author declares that he has neither financial nor non-financial competing interests.

### Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Author information

### Affiliations

### Corresponding author

## Rights and permissions

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided 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.

## About this article

### Cite this article

Horniaček, M. An algorithm for general infinite horizon lot sizing with deterministic demand.
*Pac. J. Math. Ind.* **9, **6 (2017). https://doi.org/10.1186/s40736-017-0031-6

Received:

Accepted:

Published:

### Keywords

- Inventory
- Lot sizing
- Non-cyclical deterministic demand
- Discounting of future cost
- Forward induction
- Critical period