Wagner Whitin Algorithm
Wagner Whitin Algorithm
Vol. 50, No. 12 Supplement, December 2004, pp. 1770–1774 doi 10.1287/mnsc.1040.0262
issn 0025-1909 eissn 1526-5501 04 5012S 1770 © 2004 INFORMS
Thomson M. Whitin
Massachusetts Institute of Technology, Cambridge, Massachusetts
A forward algorithm for a solution to the following dynamic version of the economic lot size model is given:
allowing the possibility of demands for a single item, inventory holding charges, and setup costs to vary
over N periods, we desire a minimum total cost inventory management scheme which satisfies known demand
in every period. Disjoint planning horizons are shown to be possible which eliminate the necessity of having
data for the full N periods.
History: Received February 1958.
1770
Wagner and Whitin: Dynamic Version of the Economic Lot Size Model
Management Science 50(12S), pp. 1770–1774, © 2004 INFORMS 1771
assume an order is placed in the first period).4 A more mental proposition underlying our approach asserts
efficient algorithm evolves from a dynamic program- that it is sufficient to consider programs in which at
ming characterization of an optimal policy (Bellman period t one does not both place an order and bring
1957, Dvoretsky et al. 1952, Karlin 1955). in inventory.
Let I denote the inventory entering a period and I0
initial inventory; for period t Theorem 1. There exists an optimal program such that
Ixt = 0 for all t (where I is inventory entering period t).
t−1
t−1
I = I0 + xj − dj 0 (1)
j=1 j=1 Proof. Suppose an optimal program suggests both
to place an order in period t and to bring in I (i.e.,
We may write the functional equation (Bellman 1957,
Ixt > 0). Then it is no more costly to reschedule the
Karlin 1955) representing the minimal cost policy for
purchase of I by including the quantity in xt , for this
periods t through N , given incoming inventory I, as
alteration does not incur any additional ordering cost
ft I = min it−1 I + xt st + ft+1 I + xt − dt (2) and does save the cost it−1 I 0.
xt 0
I+xt dt Note that the theorem does not hold if our model
where includes buying or production costs which are not
0 if xt = 0 constant and identical for all periods. In the latter
xt = (3) case, economies of scale might very well call for the
1 if xt > 0
carrying of inventory into period t even when an
In period N we have
order or setup takes place in t (Wagner and Whitin
fN I = min iN −1 I + xN sN (4) 1958).
xN 0
I+xN =dN Two corollaries follow from the theorem.
Consequently we compute ft , starting at t = N , as a Theorem 2. There exists an optimal program such that
function of I; ultimately we derive f1 , thereby obtain- for all t
ing an optimal solution as I for period 1 is specified.
Theorem 2 below establishes that it is permissible to
k
confine consideration to only N + 2 − t t > 1, values xt = 0 or dj for some k t k N
of I at period t. j=t
By taking cognizance of the special properties of
our model, we may formulate an alternative func- Proof. Since all demands must be met, any other
tional equation which has the advantage of poten- value for xt implies there exists a period t ∗ t such
tially requiring less than N periods’ data to obtain an that Ixt∗ > 0; but Theorem 1 assures that it is sufficient
optimal program; that is, it may be possible without to consider programs in which such a condition does
any loss of optimality to narrow our program com- not arise.
mitment to a shorter “planning horizon” than N peri- The implication of Theorem 2 is that we can limit
ods on the sole basis of data for this horizon. Just as the values of I in (2) for period t to zero and the
one may prove that in a linear programming model cumulative sums of demand for periods t up to N . If
it suffices to investigate only basic sets of variables in initial inventory is zero, then only N N + 1/2 differ-
search of an optimal solution, we shall demonstrate
ent values of I in toto over the entire N periods need
that in our model an optimal solution exists among a
be examined.
very simple class of policies.
It is necessary to postulate that d1 0 is demand Theorem 3. There exists an optimal program such that
in period 1 net of starting inventory.5 Then the funda- if dt∗ is satisfied by some xt∗∗ t ∗∗ < t ∗ , then dt t = t ∗∗ + 1
4
t ∗ − 1, is also satisfied by xt∗∗ .
Formally the model may also be posed as a fixed charge linear
programming problem; see W. M. Hirsch and G. B. Dantzig, “The Proof. In a program not satisfying the theorem,
Fixed Charge Problem,” RAND Corporation RM-1383, December
1954.
either I for period t ∗∗ is positive or I for period t ∗ is
5
In other words, we let I0 = 0 by netting out starting inventory from
brought into some period t t ∗∗ < t < t ∗ , where xt > 0;
demand in period 1. If the level of starting inventory in fact exceeds but again by Theorem 1, it is sufficient to consider
the total demand in period 1, then the “forward” algorithm to be programs in which such conditions do not arise.
suggested may not be correct. In particular, Theorem 1 below may We next investigate a condition under which we
not hold for period 1; in such a case (2) still remains applicable.
may divide our problem into two smaller subprob-
A sufficient condition for the existence of a forward solution is that
st is monotonically non-increasing. An optimal solution is found lems.
then by using up initial inventory period by period until, at some
t, the inventory remaining does not meet the demand; at this point, Theorem 4. Given that I = 0 for period t, it is optimal
our suggested algorithm is commenced. to consider periods 1 through t − 1 by themselves.
Wagner and Whitin: Dynamic Version of the Economic Lot Size Model
1772 Management Science 50(12S), pp. 1770–1774, © 2004 INFORMS
Proof. By hypothesis, (2) in period t − 1 for the N The Planning Horizon Theorem states in part that
period model is if it is optimal to incur a setup cost in period t ∗ when
periods 1 through t ∗ are considered by themselves,
ft−1 I = min it−2 I + xt−1 st−1 + ft 0 (5)
xt−1 0 then we may let xt∗ > 0 in the N period model without
I+xt−1 =dt−1
foregoing optimality. By Theorems 1 and 4 it follows
and for the t − 1 period model is correspondingly further that we may adopt an optimal program for
periods 1 through t ∗ − 1 considered separately.
gt−1 I = min it−2 I + xt−1 st−1 (6)
xt−1 0
I+xt−1 =dt−1
3. The Algorithm
But the functional relations (5) and (6) differ only by a The algorithm at period t ∗ t ∗ = 1 2 N , may be
constant ft 0. Consequently what is optimal for (6) is generally stated as
optimal for (5), and by the recursive structure of the 1. Consider the policies of ordering at period
model, the latter conclusion continues to hold for all t ∗∗ , t ∗∗ = 1 2 t ∗ , and filling demands dt t = t ∗∗ ,
the earlier periods. t ∗∗ + 1 t ∗ , by this order.
We may now offer an alternative formulation to (2). 2. Determine the total cost of these t ∗ different poli-
Let F t denote the minimal cost program for peri- cies by adding the ordering and holding costs associ-
ods 1 through t. Then ated with placing an order at period t ∗∗ , and the cost
t−1 t of acting optimally for periods 1 through t ∗∗ − 1 con-
F t = min min sj + ih dk + F j − 1 (7) sidered by themselves. The latter cost has been deter-
1j<t
h=j k=h+1 mined previously in the computations for periods t =
st + F t − 1 1 2 t ∗ − 1.
3. From these t ∗ alternatives, select the minimum
where F 1 = s1 and F 0 = 0. That is, the minimum cost policy for periods 1 through t ∗ considered inde-
cost for the first t periods comprises a setup cost in pendently.
period j, plus charges for filling demand dk , k = j + 1 4. Proceed to period t ∗ + 1 (or stop if t ∗ = N ).
t, by carrying inventory from period j, plus the Table 1 portrays the symbolic scheme for the algo-
cost of adopting an optimal policy in periods 1 rithm. The notation 1 2 t ∗∗ t ∗∗ + 1 t ∗∗ + 2 t ∗
through j − 1 taken by themselves. Theorems 2, 3, and
in Table 1 indicates that an order is placed in period
4 guarantee that at period t we shall find an optimum
t ∗∗ + 1 to cover the demands of dt t = t ∗∗ + 1,
program of this type. With the present formulation,
t ∗∗ + 2 t ∗ , and the optimal policy is adopted for
(7) is computed, starting at t = 1. At any period t,
periods 1 through t ∗∗ considered separately. At the
(7) implies that only t policies need to be considered.
bottom of the table we record the minimum cost plan
The minimum in (7) need not be unique, so that there
for periods 1 through t ∗ .
may be alternative optimal solutions. When we derive
In general, it may be necessary to test N policies
F N , we shall have solved the problem for N is the
at the N -th period, implying a table of N N + 1/2
last period to be considered.
entries (versus 2N −1 for all possibilities). Thus the for-
Finally we come to what is perhaps the most inter-
ward algorithm (7) is at least as efficient as (2). As
esting property of our model.
we shall see, the number of entries usually is much
The Planning Horizon Theorem.6 If at period t ∗ smaller than this number if we make full use of the
the minimum in (7) occurs for j = t ∗∗ t ∗ , then in periods planning horizon theorem.
t > t ∗ it is sufficient to consider only t ∗∗ j t. In partic-
ular, if t ∗ = t ∗∗ , then it is sufficient to consider programs
such that xt∗ > 0. 4. An Example
Table 2 presents a sample set of data for a 12 month
Proof. Without loss of optimality we restrict our period; to simplify computations we have let it = 1 for
attention to programs of the form specified in all t; Table 3 contains the specific calculations.
Theorems 1–4. Suppose a program suggests that dt is To illustrate, the optimal plan for period 1 alone is
satisfied by xt∗∗∗ , where t ∗∗∗ < t ∗∗ t ∗ < t. Then by The- to order (entailing an ordering cost of 85), Table 3.
orem 3 dt∗ is also satisfied by xt∗∗∗ . But by hypothesis Two possibilities must be evaluated for period 2:
we know that costs are not increased by rescheduling order in period 2, and use the best policy for period 1
the program to let dt∗ be satisfied by xt∗∗ > 0.
considered alone (at a cost of 102 + 85 = 187); or order
6
in period 1 for both periods, and carry inventory into
The reader may wish to prove the corresponding theorem for
period 2 (at a cost of 85+29 = 114). The better policy is
(2): Let I ∗∗ be the value of incoming inventory associated with
minI ft∗ I; then in period t < t ∗ it is sufficient to consider only the latter one. In period 3 there are three alternatives:
∗
0 I I ∗∗ + tj=t−1 dj . In particular, if I ∗∗ = 0, then it is sufficient to order in period 3, and use the best policy for periods
consider programs such that I = 0 at period t ∗ . 1 and 2 considered alone (at a cost of 102 + 114 = 216);
Wagner and Whitin: Dynamic Version of the Economic Lot Size Model
Management Science 50(12S), pp. 1770–1774, © 2004 INFORMS 1773
Table 1
Month t 1 2 3 4 N
or order in period 2 for the latter two periods and use 2. Order at period 10, x10 = 67, and use the optimal
the best policy for period 1 considered alone (at a cost policy for periods 1 through 9, implying
of 102 + 36 + 85 = 223); or order in period 1 for the 3. Order at period 8, x8 = 67 + 45 = 112, and use the
entire three periods (at a cost of 85 + 29 + 36 + 36 = optimal policy for periods 1 through 7, implying
186). 4. Order at period 5, x5 = 61+26+34 = 121, and use
In our example, it is clear that it would never pay to the optimal policy for periods 1 through 4, implying
carry inventory from periods 1 or 2 to meet d4 , since 5. Order at period 3, x3 = 36 + 61 = 97, and use the
the carrying charges would exceed the ordering cost optimal policy for periods 1 through 2, implying
in period 4. A fortiori it would never pay to carry 6. Order at period 1, x1 = 69 + 29 = 98.
inventory from periods 1 or 2 to meet d5 d6 dN , The total cost of the optimal policy is 864.
because to do so would also imply that inventory was By use of the suggested tabular form, it is also rel-
being carried to period 4 (Theorem 3). atively easy to make sensitivity analyses of the solu-
Note that periods 1 through 8, and 8 through 10 tion. For example, the ordering cost in period 2 would
comprise planning horizons. Whenever a time hori- have to decrease by more than 73 in order to make it
zon (or a simplification of the type mentioned in the less costly to setup in period 2 than carry inventory
previous paragraph) arises, the entries in the table can from period 1; ordering cost in period 11 would have
be truncated below the south-east diagonal through to increase by more than 37 in order to make it less
the entry for 1 2 t ∗ − lt ∗ , as we have done in costly to order in period 10 for the last three periods.
Table 3.
For our set of data the optimal policy is 5. A Steady State Example
1. Order at period 11, x11 = 79 + 56 = 135, and use In the case of steady state demand and constant order-
the optimal policy for periods 1 through 10, implying ing and holding costs, our algorithm yields the same
result as the standard “square root formula.” Assume
that throughout the entire year monthly demand
Table 2
d = 525, ordering (setup) cost s = 10280, and interest
Month t dt st it charge i = 1. The square root formula for the order
quantity gives
1 69 85 1
2 29 102 1
Q= 2 ds/i = 2 × 525 × 1028/1 = 104 (8)
3 36 102 1
4 61 101 1
Since this is approximately two months’ demand, we
5 61 98 1
round Q to 105 units for comparison purposes.
6 26 114 1
Applying our algorithm yields that for the first two
7 34 105 1
and three periods, the optimal policies are 12 and
8 67 86 1
(1, 2)3, indicating that the first two periods comprise
9 45 119 1
a planning horizon. In the steady state case, all plan-
10 67 110 1
ning horizons are the same, i.e., orders will be placed
11 79 98 1
every two months. Therefore annual costs are easily
12 56 114 1
obtained as six times the costs for one planning hori-
Average 525 1028 1
zon, amounting to 931.80.
Wagner and Whitin: Dynamic Version of the Economic Lot Size Model
1774 Management Science 50(12S), pp. 1770–1774, © 2004 INFORMS
Table 3
Month t 1 2 3 4 5 6 7 8 9 10 11 12
Ordering cost 85 102 102 101 98 114 105 86 119 110 98 114
Demand 69 29 36 61 61 26 34 67 45 67 79 56
85 187 216 287 375 462 505 555 674 710 808 903
114 223 277 348 401 496 572 600 741 789 864
186 400 469 734 901
502
Minimum cost 85 114 186 277 348 400 469 555 600 710 789 864
Optimal policy∗ 1 12 123 34 45 456 567 8 89 10 10 11 11 12
∗
Only the last order period is shown; 567 indicates that the optimal policy for periods 1 through 7 is to order in period 5 to satisfy d5 d6 ,
and d7 , and adopt an optimal policy for periods 1 through 4 considered separately.