Вы находитесь на странице: 1из 13

Economic Lot Sizing: An O(n log n) Algorithm That Runs in Linear Time in the WagnerWhitin Case Author(s): Albert

Wagelmans, Stan Van Hoesel, Antoon Kolen Source: Operations Research, Vol. 40, Supplement 1: Optimization (Jan. - Feb., 1992), pp. S145S156 Published by: INFORMS Stable URL: http://www.jstor.org/stable/3840844 . Accessed: 12/05/2011 16:58
Your use of the JSTOR archive indicates your acceptance of JSTOR's Terms and Conditions of Use, available at . http://www.jstor.org/page/info/about/policies/terms.jsp. JSTOR's Terms and Conditions of Use provides, in part, that unless you have obtained prior permission, you may not download an entire issue of a journal or multiple copies of articles, and you may use content in the JSTOR archive only for your personal, non-commercial use. Please contact the publisher regarding any further use of this work. Publisher contact information may be obtained at . http://www.jstor.org/action/showPublisher?publisherCode=informs. . Each copy of any part of a JSTOR transmission must contain the same copyright notice that appears on the screen or printed page of such transmission. JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms of scholarship. For more information about JSTOR, please contact support@jstor.org.

INFORMS is collaborating with JSTOR to digitize, preserve and extend access to Operations Research.

http://www.jstor.org

THAT RUNS ECONOMIC LOT SIZING:AN O(n log n) ALGORITHM IN LINEARTIME IN THE WAGNER-WHITIN CASE
ALBERTWAGELMANS and STAN VAN HOESEL
Erasmus University, Rotterdam, The Netherlands

ANTOON KOLEN
Limburg University, Maastricht, The Netherlands (Received October 1989; revision received October 1990; accepted November 1990) We consider the n-period economic lot sizing problem, where the cost coefficients are not restricted in sign. In their

seminalpaper,H. M. Wagnerand T. M. Whitinproposedan 0(n2) algorithmfor the specialcase of this problem,where the marginal productioncosts are equal in all periodsand the unit holdingcosts are nonnegative.It is well known that theirapproachcan also be used to solve the generalproblem,withoutaffectingthe complexityof the algorithm.In this paper,we present an algorithmto solve the economic lot sizing problemin 0(n log n) time, and we show how the case can even be solved in linear time. Our algorithm can easily be explained by a geometrical Wagner-Whitin we and interpretation the time bounds are obtainedwithout the use of any complicateddata structure.Furthermore, show how Wagnerand Whitin'sand our algorithmare relatedto algorithmsthat solve the dual of the simple plant locationformulationof the economiclot sizingproblem.

and theirseminal 1958,Wagner Whitinpublished Versionof the EconomicLot paper,"Dynamic Size Model."Their approach solve the economic to lot sizingproblem standsas a classical still application of dynamicprogramming it is frequently and usedin forinstance,in MRPpackages algorithm the practice; is oftenusedto solvesubproblems occurin comthat structures. plex production In this paper,we considerthe economiclot sizing for costsmay problem whichthe marginal production differ betweenperiods and all cost coefficientsare unrestricted sign.Theproblem in treated originally by and Whitinis a specialcase of this problem Wagner becausethey assumedidenticalmarginal production costsand nonnegative holdingcosts.However, unit it is well knownthat the Wagner-Whitin can algorithm easilybe modifiedto deal with the generalcase. For both casesthe algorithm runsin O(n2)time, wheren is the numberof periodsof the probleminstance; for an efficient see implementation, Evans(1985).Intheir and Whitinsuggested way to lower a paper,Wagner the computationalburden; related results can be found in Zabel(1964), Eppen,Gould and Pashigian (1969), and Lundin and Morton (1975). However, althoughpossiblyusefulin practice,these resultsdo not affectthe complexityof the algorithm.

In

to Wewill present algorithm solvethe economic an


lot sizing problem that runs in O(n log n) time and

show how a special case-including the WagnerWhitin case- can be solved in O(n) time. The algo-

rithmis basedon a wellknowndynamic programming Assumwhichusesa backward recursion. formulation in a given period,the recursionforing production mula prescribes optimalnext productionperiod. an Our algorithmidentifiesperiodsthat will never be chosenas production periodsin an optimalproduction plan.The crucialidea is thatfromthe remaining periodsit is relatively easy to selectan optimalnext production period. and Aggarwaland Park (1990), and Federgruen resultssimilarto Tzur(1991)independently obtained in our thosepresented thispaper.However, approach is significantly differentfrom theirs and the main of advantage our methodis that it can be explained interpretation. easilyby givingan insightful geometric In Section 1, we discuss the economic lot sizing remarks.Our problemand make some preliminary in is algorithm explained Section2 and the necessary case in modificationsto solve the Wagner-Whitin in lineartime are discussed Section3. The algorithm wasdiscovered solvingthe dualof the simpleplant by location formulation of the economic lot sizing

economiclot sizingproblem.Dynamicprogramming, economic Subjectclassifications: Analysisof algorithms, computational complexity: applications: lot sizingby dynamicprogramming. Inventory/production: complexityof economiclot sizing. Areaof review:OPTIMIZATION Research Operations Vol. 40, Supp.No. 1, January-February 1992 S145 0030-364X/92/4001-S145$01.25 ? 1992Operations Research Societyof America

S146

AND KOLEN HOESEL WAGELMANS,

problem, and in Section 4 we show how the structure of this dual enables us to solve it by inspection. Two algorithms are given: a greedy forwardalgorithm that corresponds to the Wagner-Whitin approach and a nongreedy backward algorithm that is essentially the algorithm of Section 2. Concluding remarks can be found in Section 5. 1. THE ECONOMICLOT SIZING PROBLEM In the economic lot sizing problem (ELS) one is asked to satisfy at minimum cost the known nonnegative demands for a specific commodity in a number of consecutive periods (the "planning horizon"). It is possible to store units of the commodity to satisfy future demands, but backlogging is not allowed. For every period, the production costs consist of two components: a cost per unit produced and a fixed setup cost that is incurred whenever production occurs in the period. In addition to the production costs, there are holding costs which are linear in the inventory level at the end of the period. Both the inventory at the beginning and at the end of the planning horizon are assumed to be zero. We can always assume that the demand in the last period is positive, because otherwise we could delete this period without really changing the problem. Note that we do not make any assumption about the sign of the cost coefficients. This is motivated by the fact that instances of ELS often occur as subproblems while solving complex production problems. When, for instance, Langrangian relaxation is used, these subproblemsmay have negativecost coefficients. It is useful to consider some mathematical formulations of ELS. Let n be the length of the planning horizon and di, pi, f, hi denote, respectively, the demand, marginal production cost, setup cost and unit holding cost in period i, i = 1, ..., n. Given the problem description above, the most natural way to formulate ELS as a mixed-integerprogramis by using the following variables: xi: the number of units produced in period i; si: the number of units in stock at the end of period i; Y I_ if a setup occurs in period i lo0 otherwise.

subject to
Xi + Si_- - Si = di dinyi - Xi
SO = Sn =

for i = 1,..., fori = 1,...,

n n

0
0

xi

O, si 3 0, yi E {0, 1} for i = 1, ...,

n.

Because Si = Et=i xi - S=ldt, i = 1, ..., n, we can eliminate these variables from the formulation. This results in the next formulation. Formulation II
n n

Minimize subject to
n

E
i=l

(cixi + fiyi) i=l

hi dli

xt = dln
t=l

Z Xt 2 dii t=l

for i = 1,...,
>

n- 1

dinyi- xi

fori=

1,...,n n.

xi > 0, yi E {0, 1} for i = 1,...,

Define dij = Ej=i dt, 1 < i < j < n, then a correct formulation of ELS is as follows. Formulation I Minimize
E (pixi + fYi + hisi)
i=l

pi + ,=iht, i= 1, ... n.. Note that the Hereci last summation in the objective function is a constant and can therefore be omitted. This reformulation is useful because it shows us that we can restrict our analysis to instance of ELS where the holding costs are zero. From now on, we shall work with the marginal production costs ci, i = 1, ..., n. As mentioned before, we do not make any assumption about the sign of these costs. The fact that such an assumption is unnecessary follows from the first constraint of II, which implies that adding the same amount to all marginalproduction costs shifts the objective function of all feasible solutions by the same amount. Hence, not the values, but rather the differences between marginal production costs play a role in determining the optimal solution. The algorithm that we present in the next section assumes nonnegative setup costs. However, this does not mean that instances with negative setup costs cannot be solved. Iff, < 0, then it will always be profitable to set up in period i (even if there is no production in that period). By redefining the setup costs for those periods to be zero, we obtain a problem instance with nonnegative setup costs. Solving this instance and adding all negative setup costs to the obtained solution value gives the optimal value of the original instance.

Economic Lot Sizing Algorithm / A third formulation played an important role in discoveringthe algorithm that we are going to present. In this formulation the xi-variables are disaggregated into variablesxit: xit: the number of units produced in period i to satisfy demand of period t > i. The formulation is as follows. Formulation III
n n

S 147

ming algorithm.For the sake of completeness, we note here that a similar algorithm based on a forward recursion can be derived. However, the latter algorithm uses a somewhat more complicated data structure than the one given below; for details we refer to Van Hoesel (1991). 2. AN O(n log n) ALGORITHM SOLVE ELS TO In this section, we assume that all setup costs are nonnegative. We define G(t) to be the cost of an optimal solution to the instance of ELS with a planning horizon consisting of periods t to n, t = 1,..., n. Furthermore,G (n + 1) is defined to be zero. Because of the zero-inventory property the following recursion holds:
i<tSn+I

Minimize subject to

E
1i=

(fiyi + ci E xit)
t=i

t
xit = dt
i=1

fort= 1, ..., n for i = 1, ..., n, for t = i,..., n fori= 1, ..., n, for t = i,..., n.

dtYi- xit > 0 xit >0, yiE{0, 1}

min f + ci di,t- + G(t)

ifdi >

G (i)=

min G(i+ 1), min f +c di,,_-+ G(t) i+ <t<n+ if di= 0. (1)

This formulation is a scaled version of the so-called simple plant location formulation of ELS, in which one uses the variables: zit: the fraction of demand of period t satisfied by production in period i < t; (i.e., zit = xi/tdt if dt > 0). It has been shown in Krarup and Bilde (1977) that the LP-relaxation of that formulation has optimal solution in which the y-variables are integer; of course, this must also hold for the LPrelaxation of III. Although the dual programsof both relaxationsare essentially the same, it is more convenient to solve the dual of the relaxation of III, especially when we want to allow zero-demand in some periods. In Section 4, we shall present algorithms to solve this dual. ELS is traditionally not solved by explicitly using any of the formulations above, but by dynamic programming. The key observation to obtain a dynamic programming formulation of the problem is that it suffices to consider only feasible solutions in which the inventory at the beginning of production periods in is zero (the "zero-inventoryproperty"); other words, production in period i equals 0 or dikfor some k > i. This propertywas stated first by Wagner and Whitin (1958) for their special case. Later, Wagner (1960) showed that the property even holds under the assumption of concave production costs (see also Zangwill 1968). In the next section, we shall present our algorithm which is essentially a backward dynamic program-

The recursion formula states that if di > 0 it is necessary to set up in period i; we produce for a number of consecutive periods and follow an optimal strategyfor the remaining periods. If di = 0 it is also possible to omit the setup and just follow the optimal strategy from period i + 1 onward. Using (1) for calculating G(i) involves the comparison of n - i + 1 expressions. A straightforward application of this recursion leads to an O(n2) algorithm. We shall show that given G(t) for t = i + 1, ..., n + 1, it is possible to determine
mini<t,,+{cid,,_-i

+ G(t)} in O(logn)

time.

Be-

cause of (1), this implies that G(i) can be determined in O(log n) time. To facilitate the exposition we plot the points (dtn, G(t)) for t = i + 1, ..., n + 1, as in Figure 1, where cumulative demand is put on the horizontal axis and the vertical axis corresponds to the minimal costs. Note that one of the plotted points must be the origin because (dn+1,n, G(n + 1) - (0, 0). Let LE denote the lower convex envelope of the plotted points, then we define on [0, di+l,n] the function g by g(z) = w if and only if (z, w) E LE. It follows that g(di+,,n)= G(i + 1), because ifd,i+ = 0 then, according to (1), all plotted points with a coordinate di+l,n on the horizontal axis cannot lie below (di+l ,, G(i + 1)). Furthermore, it is clear that g is a piecewise linear convex function on [0, di+l,n](see Figure 1). A value z E (0, di+,ln)in which g changes slope is called a breakpoint of g. We also define z = 0 and

S148

AND KOLEN HOESEL WAGELMANS,

o (i+dl)

This means that cidij_l + G(j) is dominated by + G(k). For the case, ci < [G(k) - G(l)]/dk,l-_ cidi,kwe can prove that cidij-, + G(j) > cidi,l- + G(/): cidi,j- + G(j)
> cidi,1 - ci dj,_l + g(djn)

c di ~~~~0~~~~~~~~~~~I
I

_-

G(k)- G() d
dk,!-1

+ G(

G(k)-G(l)
dk,l-I

dj,

,-l

= cidi,-1 + G(l). Hence, we have shown that for the determination of mini<t_n+icidi/,,- + G(t)} it suffices to consider only the efficient periods. For a geometric interpretation of the proof of Proposition 1 consider Figure 2, where ci is assumed greater than the slope of g on [din, dkn]. Note that cidi j_- + G (j) is exactly the coordinate on the vertical axis of the intersection point of the vertical line
through (d,n, 0) and the line with slope ci that passes

ds+l,n

Figure 1. Diagram of minimal cost versus cumulative demand. z = di+,, to be breakpoints. It is obvious that if z is a breakpoint, then (z, g(z)) = (d,,, G (t) for some
period t e Ii + 1, ..., n + II. Suppose that there are r breakpoints of g and let i + 1 = t(l) < ...<

t(r) = n + 1 denote the correspondingperiods. These dk,l-i periods will be called efficient, because we shall show that only these periods need to be considered for the determination of minm<<n+ic d,-1 + G (t)).

through (din, G(j)). Of course, the corresponding values for the other periods can be determined analogously. We have proven that (di, cidij-_ + G(j))
never lies below (din, c,di,k+ G(k)).

From the discussion above it is also clear how we


can determine minm p_r{cid,,t(p)l + G(t(p))} geomet-

Proposition 1. Let t(p), p = 1, ..., r, denote the efficientperiods, then dk,l-I min cidi,t-i + G(t) = min c,d,t(p)- + G(t(p)). Proof. Suppose that j, i + 1 <j < n + 1 is not an efficient period and k and / are the two consecutive efficient periods, such that k < j < 1. The slope of g on [din, dknI is equal to [G(k) - G (l)]/dk,,-I, hence
g(djn)

rically (see Figure 3): For every efficient period t we determine the intersection point of the vertical line through (din, 0) and the line with slope ci that passes through (d,, G(t)). The coordinate on the vertical

= G(l) + G,(k)/kk,l-l

() dj1.

idi, j-1

Furthermore, we know that G(j) > g(djn)c,d,-1

Cid, k-l+

First assume that ci ^ [G(k) - G(1)]/dk,-/, then


+ G(j)
+ g(djn)

^ cidi,k-\ + cidk,j-I

n t(r) + 1 denote = th(k)e


Suppose Proof.
Uk,l-I

that j, i + 1 < j < n + 1 is not an

correspondingperiods. These Figure2. Geometric interpretation of proof of Proposition 1.

= cidi,k- + G(k).

Economic Lot Sizing Algorithm / and


cidi,t(p)- + G(t(p))<cidi,t(p+l)_-

S 149

+ G(t(p + 1)) forp= q,...,r1.

i di, t(q) -1+ (t(q))-------------------

G(t(q))-

A crucial observation at this point is that once the efficient periods are known, that is, given the ordered ratios G(t(p)) - G(t(p + 1))

0 d

dt(p),t(p+I)t(q),n d i, n

Figure3. Geometric determination of minimum value. axis of the lowest of these intersection points is equal + G(t(p))}. This means that we to min <_p_r{cidi,t(p)-_ are in fact looking for the line with slope ci that supports the epigraph of g. In Figure 3 it is clear that the slope of g is smaller than ci on [0, dt(q),n]and di+,,n].For a formal proof of greaterthan ci on [dt(q),n, this propertyit is sufficient to prove the following fact. Proposition 2. Let k and 1, k < 1, be two consecutive efficientperiods. If G(k)dk,l-I

we can determine t(q) in O(log n) time by binary search. Note that the choice of t(q) as the next production period after i clearly has a sensible economic interpretation: the ratios G(t(p)) - G(t(p + 1))
1)dt(p),t(p+

p = 1,...,

r-

1,

G( )

<7 j ci

then
cidi,k_-

+ G(k) < cidi,-i, + G();

are marginalcosts per unit of demand, and we produce up to the period where this quantity drops below the marginal production costs of period i. After G(i) has been determined for a certain i > 1, we want to proceed with the analogous calculation of G(i - 1). However, first we must update the set of efficient periods. Geometrically we can apply the following procedure: add the point (din, G(i)) and find the smallest efficient period t(s), such that the slope of the line segment connecting (din, G(i)) to (dt(),n, G(t(s))) is greater than the slope of the line segment connecting (dt(s+l),n,G(t(s + 1))) to
(dt(s),n, G(t(s))).

otherwise,cidi,k-I + G(k) > cidij,-1+ G(I). Proof. Suppose that [G(k) - G(I)]/dk,_l- < ci, then G(k) < Cidk,o-_+ G(l). Adding cidi,k_- on both sides of the inequality sign results in cidi,k-l + G(k) < cidi,- + G(l). In the other case, the proof is completely analogous. From Proposition 2 and the convexity of g on [0, di+,,], it follows that cidi,t(q)_- + G(t(q)) = mini pr{cidi,t(p)-i+ G(t(p)) if we take q:= min r, min p 1 p < r ad G(t(p))- G(t(p + 1)),< i} )dt(p),t(p+ because then
cidi,t(p)- + G(t(p))
>

The new set of efficient periods

consists of period i and the periods t(s) to t(r) (see Figure 4).

G(i

cidi,t(p+)- + G(t(p + 1)) forp= 1, .., q- 1

-in

Figure 4. Updating the lower convex envelope.

S150

AND KOLEN HOESEL WAGELMANS,

To define t(s) formally a few remarks are needed. We adopt the convention that if di = 0, then the efficient period i + 1 is replacedby the efficient period i. It is trivial that in the case where di = 0 and G(i) = G(i - 1), all other efficient periods remain efficient, i.e., we let s := 2. Otherwise, it always holds that s S q. To see this, suppose that q < r. By the definition of t(q) and because G(i) = fi + cidi,t(q)-l+ G (t(q)) the following holds G(i) - G(t(q)) _ c>
dl,t(q)-l

G(t(q)) - G(t(q + 1))


dt(q),t(q+l)-1

and this implies that s < q. We then define s as: s := min q, minp I< p < q, di,(p)_-> 0

- G(t(p)) and G(i)


di,t(p)- l

G(t(p)) - G(t(p + 1))


dt(p),t(p+ )-l

Note that di,(,p)_= 0 can only occur if t(p) = i + 1 and di = 0. Hence, the condition di,t(p)-> 0 guarantees that if di = 0 the period i + 1 is no longer efficient. To find s we simply compare G(i) - G(t(p))
di,t(p)-

The main part of the algorithm consists of n iterations: G(i) is calculated in iteration n - i + 1. The implementation below uses a list ("stack") L that contains the efficient periods at the beginning of iteration n - i + 1 in increasing order. As noted before, we can find the period t(q) by binary searchin L. The total time spent on searching is therefore O(n log n). In every iteration we have to make a few comparisons to determine the period t(s). After every comparison, we either conclude that we have found t(s) or we have to continue by considering the next period in L. The first case occurs exactly once in every iteration, i.e., in total n times. In the second case, we delete a period from L. As every period is deleted from L at most once, this case can occur no more than n times. Thus, the overall complexity of calculating G(1) is O(n log n). At the end of the algorithm an optimal solution is constructed in linear time using information obtained during the iterations. The output is given in terms of the x- and y-variables used in models I and II of Section 1. Initially L is empty and all variablesare equal to zero. The next description should be self-explanatory, except for l(p) which is used to indicate the successor ofp in L. Algorithm (Input:p, hE DR,f; d E RIo Output: x E R, yE B). Initialization
calculate ci and din, i = 1, ..., n

to G(t(p)) - G(t(p + 1))


dt(p),t(p+l)-i

for increasing p, 1 S p < q, and stop as soon as the first expression is greater than the second. Note that if a period is not efficient during the calculation of G(i), it can never be efficient during the calculation of G(j) for all j < i; i.e., a period becomes inefficient at most once. Before giving a complete description of the algorithm a few remarksmay clarify that it can indeed be implemented to run in O(n log n) time. First note that the marginalproduction costs ci, i = 1,..., n, can be calculated from pi and hi, i = 1, ..., n, in O(n) time. Redefining the setup costs is of the same complexity. In the implementation below we assume nonnegative setup costs; the modifications needed otherwise are straightforward.Furthermore, it is not necessary to calculate dij for all pairs i, j with 1 < i j < n. At the startof the algorithmwe only calculate the coefficients di,, i = 1, ..., n (again in linear time). Because dij = di - dj+l,n, 1 < i < j < n, these coefficients can then be obtained in constant time when needed.

add n + 1 to L. Iterations For i := n down to 1 do begin search for q(i) := min n + 1, min EL p< n+ 1 d G(p)- G(l(p))< ci} dpn- dl(p),n G(i) :=f; + ci[dln - dq(i),n] + G(q(i)), if (di = 0 and G(i + 1) < G(i)) then, begin G(i) :=G(i + 1) s:=l(i+ 1) end

Economic Lot Sizing Algorithm / else begin if d > O, thens:= i+ 1 elses:=l(i+ while (i)din-

S 151

1)

G(s)
dsn

G(s) - G(l(s)) ands<q(i)


dsndl(s),n

is only possible if di+, = 0, G(i + 1) = G(i + 2) and q(i + 1) = i + 2. In that case, L has been updated by simply replacing period i + 2 by period i + 1. Hence, l(i + 1) is the same period as the successor of i + 2 in iteration n - i. It follows that G(i + 1) - G(l(i + 1))
/di+l,/(i+l)< Ci+l

G(i + 2) - G(l(i + 1))


/di+2,l(i+l)-l
Ci,

do s := l(s) end delete all p with i + 1 < p < s from L add i to L end. Constructionof an optimal solution i:= 1 while i n do if (di = 0 and G(i) = G(i + 1)), then i := i + 1 else begin
i := dindq(i),n

where the strict inequality follows from the definition of q(i + 1). We conclude that q(i) = i + 1. Now suppose that q(i + 1) E L. Note that as long as q(i + 1) is efficient it has the same successor l(i + 1) in L. Using again the definition of q(i + 1) we obtain G(q(i + 1)) - G(l(q(i + 1))) <
dq(i+l),l(q(i+ 1))-1

Ci+\ < Ci.

i := 1 i := q(i) end. CASE 3. THE WAGNER-WHITIN Wagner and Whitin originally proposed their algorithm for the special case in which pi = p and hi > 0,
i = 1, ..., n. For the marginal production costs

Hence, it follows that in this case q(i) < q(i + 1). We can adapt the implementation of the algorithm as follows: Let m(p) denote the predecessorofp in L. Initialize s and q(n + 1) to n + 1 and replace the "searchfor q(i)" by the following statements: if s > q(i + 1), then q(i) := i + 1 else begin q(i) := m(q(i + 1)) while G(q(i))dq(i),n-

Ci pi + ?=ihi, it follows that ci > ci+1, i = 1,..., n - 1. The discussion of the complexity of our algorithm in the previous section makes clear that apart from the binary searches, the number of elementary operations is O(n). We shall now show that when the marginalproduction costs are nonincreasingover time we can replace the binary searchesby a much simpler search strategy that requires in total O(n) comparisons. Hence, the Wagner-Whitinmodel is an interesting special case of a class of lot sizing problems that can be solved in linear time. In our exposition, we shall use the same notation as in the descripton of the algorithm at the end of the previous section. Consider iteration n - i + 1, 1 < i < n, in which we determine q(i) := min n + 1, min E{ L p < n + 1 and G(p) G(l(p)) < ci}
dpndl(p),n

< G(l(q(i))) < ci c(


dl(q(i)),n

do q(i) := m(q(i)) q(i) := l(q(i)) end. After each comparison in the while-loop we either conclude that q(i) has been found or that we must make at least one more comparison. The first case occurs exactly once per iteration. The second case implies that we found a period p such that q(j) < p for all j < i. For every period p this conclusion is drawn at most once. The total complexity of the algorithm is therefore O(n). Wagnerand Whitin's "PlanningHorizon Theorem" states that if we consider the forward recursion, then the last production period in the optimal solution for periods 1 to i + 1 is not smaller than the last production period in the optimal solution for periods 1 to i. The fact that q(i) < q(i + 1), 1 < i S n, means that a similar result holds with respect to recursion (1). As far as we know, this result has never before been stated explicitly in the literature.

where L is the current list of efficient periods. First suppose that q(i + 1) c L, then it must have occurred in iteration n - i that s > q(i + 1). But this

S152

AND KOLEN HOESEL WAGELMANS,

Table I Data (7=1 hidi = 3860) Input i f din ci


1 2 3 4 5 630 561 532 496 435 85 102 102 101 98 12 11 10 9 8

6 7 8 9 10 11 12

374 348 314 247 202 135 56

114 105 86 119 110 98 114

7 6 5 4 3 2 1

formulation has an integer optimal solution. This fact was first proven in Krarup and Bilde who suggested an O(n2) algorithm to solve this formulation. For convenience, we shall consider a slightly different formulation, viz. the LP-relaxation of model III of Section 1. For the dual the only consequence is that the variablesare scaled differently.Apart from the fact that this facilitatesthe exposition, this dual is easier to treat when zero-demand is allowed. The dual of the LP-relaxationof III is the following program. Program D
n n

Maximize To end this section, we give the results of our algorithm for the example from Wagner and Whitin (1958). The (transformed)input data are displayed in Table I. The output is given in Table II and should be interpretedas follows: Iterations correspond to rows. The first column of every row contains the period i for which we are calculating G(i). In the second column we show the efficient periods at the beginning of the corresponding iteration. For the efficient periods between brackets we have already concluded that q(j) is less than these periods forj < i. The values of q(i) and G(i) are given in the next two columns. The last column contains the ratio G(i) - G(l(i))
di,ndl(i),n

E
t=l

dt,v i=1

xi

subject to
n t=i

dtwit - Xi < fi Ci

for i = 1, ..., n fori= 1, ..., n, fort= i,...,n for = 1, ...,n, for t = i,..., n for t= 1,..., n.

vt-wit, wit, Xi >0 vt free

that is calculated at the end of the iteration. To find q(i) we compare Ci with the ratios of the efficient periods that are not between brackets, starting with the largest one. We stop as soon we find a ratio that is greaterthan ci. The optimal policy is to produce in periods 1, 3, 5, 8, 10 and 11. Because of the transformation of the cost coefficients we should subtract 3,860 from the value 4,724 to obtain the optimal value 864. 4. SOLVINGTHE DUAL OF THE SIMPLE PLANT LOCATIONFORMULATION In this section, we show how our algorithm relates to one that solves the dual of the LP-relaxation of the simple plant location formulation of ELS. In fact the algorithmpresentedin the previous section was developed after an O(n log n) algorithm to solve this dual had been found. As mentioned in Section 1, we know that the LP-relaxation of the simple plant location

In an optimal solution we can always take wit := max{0, v, - ci\. IfJi > 0, then the restrictionyi < 1 in the LP-relaxation of III is superfluous and therefore the correspondingdual variable Xican be taken equal to zero. If f < 0 we can take X, = -fi and solve the remaining problem. This correspondsto the way negative setup costs have been treated before. We therefore show how to solve the following program,where f> 0, i= 1,..., n.

Table II Results of Algorithm


i 12 11 10 9 8 7 6 5 4 3 2 1 EfficientPeriods 13 13,12 13,11 (13)11,10 (13) 11,10,9 (13,11)10,9,8 (13, 11,10,9)8,7 (13,11, 10,9)8,6 (13,11,10,9)8,5 (13,11,10,9,8)5,4 (13, 11, 10,9,8)5,4,3 (13,11,10,9,8,5)4,3,2 q(i) 13 13 11 11 10 8 8 8 5 5 4 3 G(i) 170 368 679 935 1325 1634 1859 2391 3041 3463 3858 4724 Ratio 3.04 2.73 4.64 5.69 5.82 9.09 8.90 8.81 10.66 11.72 13.62 12.87

Economic Lot SizingAlgorithm / Program D'

S153

then
j k-I

Maximize E d,tv
t=l
t=l

dtUt

Ckdj + fk +
j-

E dtvt
t=l

subjectto
n

+ dtmax{0,v, - cil < f for i = 1, ..., n.

L
t=k

d,(v,- max{0,

Vt -

Ck}).

E
t=i

and This program highlystructured can be solved is Onewayof doingthatis by considering by inspection. the variablesin the order of increasingindex: If we value,otherwise dj = 0 we cangive vj, an arbitrary let
+ f Ej :=min c i
j
f

Using the induction hypothesis k-1 dtv = F(k - 1), and the fact that v, > vj > Ck,t <j, we obtain

dtvt = fk +
t=l

Ckdkj +

F(k - 1).

(2)

Because F(j) = min fi + cidi + F(i - 1),


isJ

i dtmax{O, vt- ci
dj

i.e., given vt, t < j, vj is assigneda value as largeas in possible.The solutionconstructed this greedyforwardway is clearlyfeasibleand to prove optimality we first show that if dj $ 0 and dj+1$ 0, then
Vj Uj+l:

Let k < j be suchthat


Ck 'd

Vj =

fk -

tjk dtmax {0, dj


-

Vt -

Ck}

Thus vj >

ck

andfk

Ej=k dtmax{0,

Vt - Ck} = 0.

Because
Uj+l ~

Ck +.

fk-

- Ck jt=kdtmax{0, Vt

dj+i

it follows that vj+1< Ck < vj. Since the variables can to corresponding periodswith zero-demand be we may assume that the an arbitrary value, given solution satisfiesvj > vj+, j = 1, ..., constructed
n - 1.

with (2) impliesthat ZJ=l dtvt> F(j), whichtogether result. j=1ldtvt< F(j) yieldsthe desired From our discussionabove (in particular, equaforward tion(2))it is clearthatsolvingD' in thegreedy an provides optimalsolutionof ELSand waydirectly is closelyrelated the forward to dynamic programming approachof Wagnerand Whitin. In fact this dual and is givenin Krarup Bilde, algorithm the algorithm in whereit waspresented a moregeneralcontext. An alternative to approach solveD' is closelyrelated to the algorithmpresentedin Section 2. It will not works comeasa surprise thisalgorithm that backward, in variables constraints considered order are and i.e., of decreasing index. Contraryto the forwardalgorithm, we cannot follow a greedy strategy:While a determining propervalue for vj we may have to at the same time, valuesof some variables vt, revise, that t > j. It is somewhatsurprising in spite of this, thealgorithm be implemented runin O(nlog n) to can has whilethe greedyforward time, algorithm a complexity of O(n2). The gain in complexity comes from

Now define F(j) to be the cost of an optimal solutionto the ELS with the planninghorizonconsisting of periods 1 to j, j = 1, ..., n. To prove

to of optimality the solutionit is sufficient showthat


dZ=i dtvt = F(j), because by duality and the structure v of (D '), It =l dtt F(j) must hold. The proof is by

certain the factthatwe canagaindetermine important indicesby binarysearchand revisingvaluesof variablescan subsequently done in constanttime. In be our expositionwe shall try to clarifythe correspondenceto the algorithm Section2. of the algorithmthe idea is to keep the Throughout
variablessuch that vj > uj+i, j = i,..., n - 1. Here i

induction on j, startingwith j = 1 for which the is statement trivial. For j > 1 we only have to considerthe case of k < j be suchthat
uj --

dj $ 0, because, otherwise, F(j) = F(j - 1). Let


fk Ck '

that is the indexof the variable the constraint we and At in iteration. the beginareconsidering the current ning of the iterationthe variablesvi+l to Vnsatisfy have the constraints indexedi + 1 to n andwillalways the followingproperty.There are indices i + 1 =
t(l) < ... < t(r) = n + 1, such that t(p) > vt(p+I) and vt = vt(p) all t with t(p) < t < t(p + 1) andp = for 1,..., r - 1. (Here vn+l is defined sufficiently small.)

E-k1 .=

dtmax{O, vt

- Ck

S154

HOESEL AND KOLEN WAGELMANS,

Furthermore, it holds that dt(p),t(p+l)-1 0 and dtvt Etnt(p) = G(t(p)) for all p < r. We shall call this the staircase property.Of course, the indices t(l) to t(r) correspond to the efficient periods of Section 2. Note that v(t(p)) = G(t(p)) - G(t(p + 1))
dt(p),t(p+l)-i

i, ..., n - 1, is now only possible if v[ < v, for some t, i + 1 S t < t(q) - 1. Consider an arbitraryu, 2 < u < q and suppose that we would choose the solution Vt := vt(u), < t < t(u), vt = v,, t(u) < t n, i then the slack in constraint i would be

1 - di(Vi - c,) +

t(u)-1 i dt(vt t=i+l t(u)-

,t)

We are now going to show how to obtain a solution vu',t > i, such that this solution satisfiesthe constraints indexed i to n and the staircasepropertyholds, i.e., in particular tn=i d,vt = G(i). The current slack in constraint i is
n

=bj-di(vt(u)-ci)+
t=i+l

dt(vt-v,t())

t=i+l

:=ffi

E
t=i+l t(q)-1

dtmax(0, v, - ci)

t(u)-

+ci)+ -di(vt(u)
=fi+

t=i+l

dt(vt- v,())
t(q)-i

=f t=i+l

dt(vt- ci),

idi,t(q)- - vt(u)di,t(u)-l
t=t(u)

dtvt

where q := min[r, minp I 1 < p < r and vt < ci}]. We distinguish between three cases. Case 1. di = 0. By taking v' := vt, t > i, and vi := v'+l, we obtain a solution with all the desired properties,because
n n n

=fJ+ cidi,t(q)-- vt(u)dit()-i - G(t(u))+ G(t(q)). (3)


The value of expression (3) must increase for increasing u and it is certainly positive for u = q. Let s be the smallest index, such that (3) is positive if u = s. In other words, s is the smallest index among 1 to q, such that by letting all variables with a smaller index be equal to vt(), while not changing the values of the other variables, constraint i is satisfied. Let 62 be the correspondingslack, i.e.,
62

d,tu =
t=i t=i+l

d,tv =
t=i+

d,v,

= G(i + 1) > G(i) and by duality, I=i dtv'[ < G(i). Case 2. di 0 and divi+1 < cidi + 61. Let v := + 6b/diand vu = vt, t > i, then v'/> vu'+,constraints ci i to n are satisfied and dtv' = cidi + 61 + Y dt,v;
t=i+ t(q)-1 n

'= fi + Cidi,t(q)-- - Ut(s) di,t(s)-

- G(t(s)) + G(t(q)) > 0. The solution vt, t > i, is now defined as:
U := Vt(s) + 62/di,t(s)-l,

t = 1, . . . , t() - 1

t=i

v; := vt, t > t(s). The new solution satisfies constraint i with equality and the constraints i + 1 to n are also satisfiedbecause t' U t > i + 1. Moreover, the staircase property vt, holds because
n
t=i t(s)-1

= cidi +f-

dt(v, - ci) +
t=i+l n t=i+l

dtuv

n
t=t(s)

=fi + Cidi,t(q)- +
=

i
t=t(q)

dtvt

Z dtv = t=i dtv' +


=

dtvt
G(t(s))

f + cid,,t(q)- + G(t(q)) > G(i).

t(s) di,t(s)-I + 62 +

Again, we conclude that t=idiv' = G(i). Case 3. divi+l > cidi + 61. Satisfyingconstraint i with a solution v', t = i, ..., n, such that vK' v '+l, t = >

= fi + cidi,t(q)- + G(t(q)). It follows that t=i dtv' = G(i) = f7 + cidi,t(q)- + G(t(q)). Now the equivalence of the choice of s here and in Section 2 becomes clear: (3) is positive

Economic Lot Sizing Algorithm / if and only if G(i) - vt(u)di,t(,,) - G(t(u)) > 0
4=~G(i)
di,t(u)-i

S 155

- G(t(u)) > Ut(u)

G(t(u)) - G(t(u + 1))


dt(u),t(u+l)-i

mentation of the Wagner-Whitinalgorithm described in Evans (1985), while requiring less storage. The algorithm could also be competitive with various widely used heuristics(see, e.g., Baker 1989), although these may produce solutions that are more attractive from other points of view. For limited computational results we refer to Van Hoesel. ACKNOWLEDGMENT We thank Karen Aardal, Alexander Rinnooy Kan, Luk Van Wassenhove and Laurence Wolsey for their comments on an earlier draft of this paper, and Hein Heuvelmans for his assistance in making the figures. Part of this work was done while the first author was visiting the Center for Operations Research and Econometrics (CORE), Louvain-la-Neuve, Belgium. The research of the second author was supported by the Netherlands Organization for Scientific Research (NWO) under grant 611-304-017. REFERENCES
A., AND J. K. PARK. 1990. Improved AGGARWAL,

This completes the description of an iteration of the backwardalgorithm to solve D' (and at the same time ELS). The reader should have no difficulties in finding an implementation of the algorithm that runs in O(n log n) time. The crucial observation to be made is that the solution is always completely determined by the values vt(p), = 1, . ., r - 1.

5. CONCLUDING REMARKS We have shown that ELS can be solved in O(n log n) time and how this fact is relatedto the special structure of the dual of the simple plant location formulation. Furthermore,we showed that the Wagner-Whitincase can be solved in linear time. The algorithm presented here has some similarities with the algorithm to solve ELS that can be found in Van Hoesel, Kolen and Wagelmans (1991). This last algorithm is based on solving the dual of a complete linear description of the convex hull of feasible solutions of formulation II, which was found by Barany, Van Roy and Wolsey (1984). It also works backward, but instead of considering the periods one by one it can be regardedas only calculatingG (t) for the periods t that are efficient after the last iteration of the algorithm in Section 2. The algorithm is of the greedy type and runs in O(n2) time. A nongreedy O(n log n) algorithm to solve the same dual may well exist. In Van Hoesel (1991), the approach described in Section 2 is generalized and applied to other lot sizing problems. For instance, it turns out that the model in which backlogging is allowed can be solved in O(n log n) time. (Using the different approaches this result has also been obtained by Aggarwal and Park 1990, and Federgruenand Tzur 1991.) In this paper, we have focused on the theoretical propertiesof our algorithm. However, it seems worthwhile to study the performance of the algorithm on practicalproblems. For instance, a proper implementation of the algorithm can be expected to be computationally more efficient than the efficient imple-

Algorithms for Economic Lot-Size Problems. for WorkingPaper, Laboratory ComputerScience, Institute of Technology, Cambridge Massachusetts Mass. and a StandBAKER, K. R. 1989. Lot-SizingProcedures ard Data Set: A Reconciliation of the Literature. Report,The Amos Tuck School of BusinessAdministration,DartmouthCollege,Hanover,N.H.
1984. I., BARANY, T. J. VAN ROY AND L. A. WOLSEY.

The Uncapacitated Lot-Sizing: ConvexHull of Solutions. Math. Prog.Study 22, 32-43.


1969. EPPEN,G. D., F. J. GOULDAND B. P. PASHIGIAN.

Extensionsof the PlanningHorizon Theoremin the Dynamic Lot Size Problem. Mgmt. Sci. 15, 268-277. J. EVANS, R. 1985. An EfficientImplementationof the Algorithmfor Dynamic Lot-Sizing. Wagner-Whitin J. Opns.Mgmt. 5, 229-235. FEDERGRUEN, ANDM. TZUR.1991. A Simple ForA., wardAlgorithmto Solve GeneralDynamic Lot Sizing Models With n Periods in O(n log n) or O(n) Time. Mgmt. Sci. 37, 909-925. A., FEDERGRUEN, ANDM. TZUR.1990. The Dynamic Lot Sizing Model With Backlogging:A Simple O(n log n) Algorithm. Working Paper, Graduate School of Business, Columbia University, New York.
KRARUP,J., AND 0. BILDE. 1977. Plant Location, Set

Covering and Economic Lot Size: An O(mn)Algorithm for Structured Problems. Numerische Band 3: Methoden bei Optimierungsaufgaben,

S156

AND KOLEN WAGELMANS, HOESEL

und GanzOptimierungbei Graph-Theoretischen zahligen Problemen. Birkhauser Verlag, Basel, Switzerland,155-180.


LUNDIN, R. A., AND T. E. MORTON.1975. Planning

Horizons for the Dynamic Lot Size Model: Zabel vs. Protective Procedures and Computational Results.Opns.Res. 23, 711-734.
VAN HOESEL, C. P. M. 1991. Algorithms for Single

nomic Lot-SizingProblem. Eur. J. Opnl. Res. 52, 315-325. H. WAGNER, M. 1960. A Postscriptto Dynamic Problems in the Theory of the Firm. Naval Res. Logist. Quart.7, 7-12.
WAGNER, H. M., AND T. M. WHITIN. 1958. Dynamic

Version of the Economic Lot Size Model. Mgmt. Sci. 5, 89-96.


E. ZABEL, 1964. Some Generalizations of an Inventory

Item Lot-Sizing Problems. Ph.D. Dissertation, Erasmus University Rotterdam, Rotterdam, The Netherlands.
VAN HOESEL,C. P. M., A. W. J. KOLENAND A. P. M. 1991. A Dual Algorithm for the EcoWAGELMANS.

Planning Horizon Theorem. Mgmt. Sci. 10, 465-471.


ZANGWILL, W. I. 1968. Minimum Concave Cost Flows

in CertainNetworks.Mgmt. Sci. 14, 429-450.

Вам также может понравиться