Polynomial Time Algorithms for Stochastic Uncapacitated Lot-Sizing Problems Yongpei Guan School of Industrial Engineering, University of Oklahoma, Norman, OK 73019, U.S.A, [email protected] Andrew J. Miller Department of Industrial and Systems Engineering, University of Wisconsin, Madison, WI 53706, U.S.A, [email protected] Submitted: June 2006; Revised: January 2007 and June 2007 Abstract In 1958, Wagner and Whitin published a seminal paper on the deterministic uncapacitated lot-sizing problem, a fundamental model that is embedded in many practical production planning problems. In this paper we consider a basic version of this model in which demands (and other problem parameters) are stochastic: the stochastic uncapacitated lot-sizing problem (SULS). We define the production path property of an optimal solution for our model and use this property to develop a backward dynamic programming recursion. This approach allows us to show that the value function is piecewise linear and right continuous. We then use these results to show that a full characterization of the optimal value function can be obtained by a dynamic programming algorithm in polynomial time for the case that each non-leaf node contains at least two children. Moreover, we show that our approach leads to a polynomial time algorithm to obtain an optimal solution to any instance of SULS, regardless of the structure of the scenario tree. We also show that the value function for the problem without setup costs is continuous, piecewise linear, and convex, and therefore an even more efficient dynamic programming algorithm can be developed for this special case. Key words: Lot-sizing; stochastic programming; dynamic programming. Subject classification: Production/scheduling: Planning; Programming: Integer, stochastic. Area of review: Optimization. 1 1 Introduction The deterministic uncapacitated lot-sizing problem (ULS) is the problem of determining the amount to produce in each time period over a finite discrete horizon so as to satisfy the demand for each period while minimizing the summation of setup, production, and inventory holding costs (Nemhauser and Wolsey (1988), Wolsey (1998), Pochet and Wolsey (2006)). This fundamental model, first introduced by Wagner and Whitin (1958), is embedded within many practical production planning problems. It is easily seen to be fixed-charge flow problem in a network composed of a directed path and a dummy production node, and understanding and exploiting this structure has been essential in developing approaches to complicated, real-world problems (see, for example, Tempelmeier and Derstroff (1996), Belvaux and Wolsey (2000), Belvaux and Wolsey (2001), Stadtler (2003), and many others). Polynomial time algorithms for the deterministic ULS are based on the Wagner-Whitin property, i.e., no production is undertaken if inventory is available. A simple dynamic programming algorithm based on this property runs in O(T 2 ) time, where T is the number of time periods; this was improved later to O(T log T ) or linear time for the case in which the costs exclude speculative motives (for details see Aggarwal and Park (1993), Federgruen and Tzur (1991), and Wagelmans et al. (1992)). Polynomial time algorithms have also been developed for variants of the deterministic ULS. A partial list of examples includes an O(T 4 ) time algorithm for the constant capacity problem by Florian and Klein (1971) and an improved version that runs in O(T 3 ) time by van Hoesel and Wagelmans (1996), an O(T log T ) time algorithm for the uncapacitated problem with backlogging by Federgruen and Tzur (1993), and a polynomial time algorithm for the uncapacitated problem with demand time windows by Lee et al. (2001). In many situations the assumption of known, deterministic data (such as demand) is not necessarily realistic. Recently, Halman et al. (2006) studied a stochastic version of the deterministic ULS problem in which demand for each time period is uncertain. There are several possible demand values for each time period with certain probabilities. They showed that the simplest stochastic version of the deterministic ULS problem with no setup cost, two possible demand values for each time period and uncorrelated demand from period to period is N P-complete in T . Thus, they developed an approximation scheme that is fully polynomial in T and the error term for the problem. Other 2 dynamic programming and approximate dynamic programming approaches for related problems are explored in Papadaki and Powell (2002, 2003) and Topaloglu and Powell (2006) (among others). These approaches have proven capable of generating high quality plans for practical problems in the transportation industry, including multi-commodity transportation planning with integrality restrictions and batch dispatching problems with setup costs. While these approaches are approximate, the authors have demonstrated that they converge to optimal solutions; and they also seem to scale well for large problems. In this paper we investigate a formulation of the stochastic version of the deterministic ULS which allows demand dependance; in particular, we study the extension of the deterministic ULS in which a stochastic programming approach (Ruszczyński and Shapiro (2003)) is adopted to address demand and other uncertain problem parameters. We refer to the resulting model as the stochastic uncapacitated lot-sizing problem (SULS). The model SULS is the most basic lot-sizing model with production, setup, and inventory costs that can be stated as a stochastic programming problem. Thus, investigation of how to solve production planning problems using a scenario tree to model demand and other parameters should start with the analysis of this model, just as investigation of how to solve deterministic production planning problems begins with analysis of the deterministic ULS. Examples of problems that contain submodels of the form SULS embedded within them include stochastic capacity expansion problems (Ahmed and Sahinidis (2003)), stochastic batchsizing problems (Lulli and Sen (2004)), and stochastic production planning problems (Beraldi and Ruszczyński (2002)). Since a special case of our problem is shown N P-complete in Halman et al. (2006), it is unlikely to develop a polynomial time algorithm for the problem in terms of the number of time periods T . In this paper, we derive a polynomial time algorithm for the problem in terms of input size, i.e., the number of nodes in the stochastic programming scenario tree. Ahmed et al. (2003) showed that the Wagner-Whitin optimality conditions do not hold for SULS, which makes it nontrivial to derive a polynomial time algorithm similar to the deterministic case. In the remaining part of the paper, we first introduce the notation and a mathematical formulation of SULS in Section 2. Then, in Section 3, we state the production path property for SULS, a fundamental optimality condition that is analogous to the Wagner-Whitin property for the de- 3 terministic case. We use this property to develop a characterization of the dynamic programming value function in terms of breakpoints, breakpoint evaluations, and slopes. This property allows us to show that a full characterization of the optimal value function that contains breakpoint values, evaluations of breakpoints, and the right slope of each breakpoint can be obtained in O(n3 log C) time, where n is the number of nodes in the scenario tree and C is the maximum number of children for each node in the tree. In Section 4, we show that these results can be extended to develop polynomial time algorithms for more generalized tree structures and a couple of special cost structured SULS. Especially, we show that the optimal solution for the general SULS can be obtained in O(n2 max{C, log n}) time and the value function for SULS without setup costs is continuous, piecewise linear and convex, which leads to an O(n2 ) algorithm. (For the latter case, Huang and Ahmed (2004, 2005) have presented an O(n2 ) primal-dual algorithm for a slightly more restricted version.) We finally offer concluding remarks. 2 Notation and mathematical formulation In this paper we assume that the uncertain demands and problem parameters evolve as a discrete time stochastic process with finite probability space. The resulting information structure can be interpreted as a scenario tree with T levels (stages) as shown in Figure 1, where node i in stage t P(i) i 1 L j V Stage 1 V(j) Stage 2 Stage T Figure 1: Multi-stage stochastic scenario tree formulation of the tree gives the state of the system that can be distinguished by information available up to stage t. Each node i of the scenario tree, except the root node (indexed as i = 1), has a unique parent a(i). Note that the resulting problem, while highly structured, will no longer be properly 4 called a flow problem (as it is in the deterministic case). The reason is that the same inventory that “flows” out of a given node i must flow to each of i’s children. Decisions made at node i must be made before having certain information about how the future unfolds from node i. Let V(i) represent the set of all descendants of node i (including i itself), L denote the set of leaf nodes and P(i, `) denote the set of nodes on the path from node i to node `. For notational brevity, define V = V(1) and P(i) = P(1, i). If i ∈ L, then P(i) corresponds to a scenario and represents a joint realization of the problem parameters over all periods 1, . . . , T . Let pi denote the probability associated with the state represented by node i and C(i) denote the children of node i (i.e., C(i) = {j ∈ V : a(j) = i} and C = maxi∈V {|C(i)|}). Since there are several children explored P from node i, the probability pi = j∈C(i) pj . Finally, let t(i) denote the time stage or level of node i in the tree (i.e., t(i) = |P(i)|). Using this notation, a multi-stage stochastic MIP formulation of the single-item, uncapacitated, stochastic lot-sizing problem as shown in Guan et al. (2006b) is (SULS) : min X (αi xi + βi yi + hi si ) i∈V s.t. sa(i) + xi = di + si ∀ i ∈ V, (1) xi ≤ M y i ∀ i ∈ V, (2) xi , si ≥ 0, yi ∈ {0, 1} ∀ i ∈ V, (3) where M is a very big number, decision variables xi and si represent the production and the inventory at the end of time period t(i) corresponding to the state defined by node i, and yi is the indicator variable for a production setup in time period t(i) for node i. Problem parameters αi , βi , and hi represent the nonnegative production, setup and holding costs and di represents the demand in node i. For notational brevity, probability pi is included in problem parameters αi , βi and hi . Constraint (1) represents the inventory flow balance and constraint (2) indicates the relationship between production and setup for each node i. 3 A polynomial time algorithm We develop a polynomial time dynamic programming algorithm to provide a full characterization of the value function for SULS. To facilitate the development of this algorithm, we first introduce the 5 production path property, which characterizes conditions that at least one optimal solution of every instance of SULS must satisfy. This will allow us to define a backward recursion for which the value function of each node i is piecewise linear and right continuous; these value functions can therefore be analyzed in terms of breakpoints (i.e., discontinuities), functional evaluations of breakpoints, and the slopes of the segments to the right of the breakpoints. We achieve the complexity bound by analyzing the number of breakpoints whose evaluations and right slopes must be stored and computed at each node, and by analyzing how long these computations take. For both of these calculations the production path property will be essential. 3.1 An optimality condition Proposition 1 (Production Path Property) For any instance of SULS, there exists an optimal solution (x∗ , y ∗ , s∗ ) such that for each node i ∈ V, if x∗i > 0, then x∗i = dij − s∗a(i) for some j ∈ V(i), where dij = P k∈P(i,j) dk . (4) In other words, there always exists an optimal solution such that if we produce at a node i, then we produce exactly enough to satisfy demand along the path from node i to some descendant of node i. Proof: By contradiction; we will show that any optimal solution that contains a node that violates (4) is a convex combination of optimal solutions, at least one of which contains one less node that violates (4). Assume the claim is not correct. That is, for any optimal solution (x∗ , y ∗ , s∗ ), there exists some i ∈ V such that x∗i > 0 and x∗i 6= dij − s∗a(i) for any j ∈ V(i). Let Ψ(i) be those descendants of node i that are the first nodes with positive production quantities along some path from node i to a leaf node. That is, Ψ(i) = ∪`∈L∩V(i) min {k ∈ P(i, `) \ {i} and x∗k > 0} . Correspondingly, let Φ(i) be the set of nodes in the subpaths from node i to each node in Ψ(i); that is, Φ(i) = ∪k∈Ψ(i) P(i, k). Define the cost corresponding to the remaining part of the tree as G(x∗ , y ∗ , s∗ ) = X (αk x∗k + βk yk∗ + hk s∗k ). k∈V\Φ(i) 6 Thus the objective function value of the optimal solution (x∗ , y ∗ , s∗ ) is X F(x∗ , y ∗ , s∗ ) = G(x∗ , y ∗ , s∗ ) + αi x∗i + βi yi∗ + hi s∗i + hk s∗k + k∈Φ(i)\({i}∪Ψ(i)) X (αk x∗k + βk yk∗ + hk s∗k ). k∈Ψ(i) Now consider two alternative solutions (x̄∗ , ȳ ∗ , s̄∗ ) and (x̂∗ , ŷ ∗ , ŝ∗ ) such that • x̄∗i = x∗i − ², s̄∗k = s∗k − ² for each k ∈ Φ(i) \ Ψ(i) and x̄∗k = x∗k + ² for each k ∈ Ψ(i) • x̂∗i = x∗i + ², ŝ∗k = s∗k + ² for each k ∈ Φ(i) \ Ψ(i) and x̂∗k = x∗k − ² for each k ∈ Ψ(i) and other components are the same as (x∗ , y ∗ , s∗ ). It is easy to observe that these two solutions satisfy constraints (1)– (3). Thus, they are feasible for SULS and correspondingly F(x̄∗ , ȳ ∗ , s̄∗ ) = G(x∗ , y ∗ , s∗ ) + (αi (x∗i − ²) + βi yi∗ + hi (s∗i − ²)) + X + X hk (s∗k − ²) k∈Φ(i)\({i}∪Ψ(i)) (αk (x∗k + ²) + k∈Ψ(i) βk yk∗ + hk s∗k ) X = F(x∗ , y ∗ , s∗ ) − αi ² − hk ² + X αk ² k∈Ψ(i) k∈Φ(i)\Ψ(i) and F(x̂∗ , ŷ ∗ , ŝ∗ ) = G(x∗ , y ∗ , s∗ ) + (αi (x∗i + ²) + βi yi∗ + hi (s∗i + ²)) + X + hk (s∗k + ²) k∈Φ(i)\({i}∪Ψ(i)) (αk (x∗k − ²) + k∈Ψ(i) = F(x∗ , y ∗ , s∗ ) + αi ² + βk yk∗ + hk s∗k ) X k∈Φ(i)\Ψ(i) P X hk ² − X αk ². k∈Ψ(i) P 6= 0, then min{F(x̄∗ , ȳ ∗ , s̄∗ ), F(x̂∗ , ŷ ∗ , ŝ∗ )} < F(x∗ , y ∗ , s∗ ), conP tradicting the assumption that (x∗ , y ∗ , s∗ ) is an optimal solution. Otherwise, if αi + k∈Φ(i)\Ψ(i) hk − P ∗ ∗ k∈Ψ(i) αk = 0, then ² can be increased such that x̄i = dij − sa(i) or x̂i = dij − sa(i) for some If αi + k∈Φ(i)\Ψ(i) hk − k∈Ψ(i) αk j ∈ {i} ∪ Ψ(i). Without loss of generality, assume x̄∗i = dij − sa(i) for some j ∈ {i} ∪ Ψ(i). Then (x̄∗ , ȳ ∗ , s̄∗ ) is also an optimal solution. A similar argument can be applied to (x̄∗ , ȳ ∗ , s̄∗ ) if there exists a node k ∈ V such that x̄∗k 6= dkj − sa(k) for any j ∈ V(k) and consecutively the following ones. We will eventually either obtain a solution (x, y, s) such that xi = dij − sa(i) for some j ∈ V(i) if xi > 0 corresponding to each node i ∈ V or find a solution with a smaller objective function value, contradicting the 7 original assumption. Therefore, the original conclusion holds. 2 The production path property clearly implies there are n candidates for x1 (the production at the root node) in an optimal solution and therefore we have immediately Proposition 2 There exists an algorithm that runs in linear time for the two-period SULS. 3.2 Value functions For the multi-period SULS, let H(i, s) represent the optimal value function for node i ∈ V when the inventory left from previous period is s (for notational brevity, use s rather than sa(i) for the second argument of this function). There are two options for each node i ∈ V: production and non-production. If production occurs, then the value function for this node contains 1) setup, production and inventory costs corresponding to this node and 2) the cost for later periods. We will call this function the production value function HP (i, s). From the production path property, the production quantity at node i is xi = dij − s for some j ∈ V(i) such that dij > s. Therefore X HP (i, s) = βi + min αi (dij − s) + hi (dij − di ) + H(`, dij − di ) . j∈V(i):dij >s (5) `∈C(i) Otherwise, if non-production option occurs, then the value function for this node contains only 1) inventory holding costs corresponding to this node and 2) the cost for later periods. We will call this function the non-production value function HNP (i, s). We only need to define it for the case in which s ≥ di , and it can be expressed as HNP (i, s) = hi (s − di ) + X H(`, s − di ). (6) `∈C(i) For the value function H(i, s) at node i, there are three cases: (1) If s < di , then setup and production is required. Since s < di ≤ dij for any j ∈ V(i), the value function can be simplified as X H(`, dij − di ) . H(i, s) = HP1 (i, s) = βi + min αi (dij − s) + hi (dij − di ) + j∈V(i) `∈C(i) 8 (7) (2) If s ≥ maxj∈V(i) dij , then no setup and production is required since current inventory is enough to cover the demands of all descendants of node i. The value function for this case can be defined as H(i, s) = HNP (i, s) = hi (s − di ) + X H(`, s − di ). (8) `∈C(i) (3) If di ≤ s < maxj∈V(i) dij , then either production or non-production will occur for node i, and the backward recursion function can be described as H(i, s) = min {HP (i, s), HNP (i, s)} . (9) Let [1], . . . , [|V(i)|] be an ordering of the descendants of node i, including i itself, such that di = di[1] ≤ di[2] ≤ . . . ≤ di[|V(i)|] . In the remaining part of this section, we study the optimal value function of a general T period scenario tree case in which there are at least two possible outcomes for each node in the tree (i.e., C(i) ≥ 2, ∀i ∈ V \ L). We describe an important property after making two observations. Observation 1 The summation of piecewise linear and right continuous functions is still a piecewise linear and right continuous function. Observation 2 The minimum of two piecewise linear and right continuous functions is still a piecewise linear and right continuous function. Proposition 3 The value function H(i, s) for each node i ∈ V is piecewise linear and right continuous in s. Moreover, for each positive discontinuous point s∗ , the value H(i, s∗ ) ≤ lims→s∗− H(i, s). Proof: By induction. Base case: In period T , the value function for each node i is ½ H(i, s) = αi (di − s) + βi hi (s − di ) if 0 ≤ s < di , otherwise. As shown in Figure 2, this value function is piecewise linear and right continuous. Moreover, at the single discontinuous point s = di , we have H(i, di ) ≤ lims→d− H(i, s). i Inductive step: Assume, for each node i ∈ V such that t(i) ≥ t + 1, the value function H(i, s) 9 H(i, s) α i di + βi −αi hi 0 s di Figure 2: Value function H(i, s) for node i at time period T is piecewise linear and right continuous, and that for each discontinuous point s∗ , H(i, s∗ ) ≤ lims→s∗− H(i, s). We prove that the claim holds for all i ∈ V such that t(i) = t. From (5), we can observe the number of candidate optimal production values for xi decreases as s increases. For instance, when s < di , all values dij −s for each j ∈ V(i) are candidates. In general, for the interval di[r−1] ≤ s < di[r] with di[0] = 0, values dij − s for each j = [r], [r + 1], . . . , [|V(i)|] are candidates and accordingly, we can define X HPr (i, s) = βi + min H(`, dij − di ) . αi (dij − s) + hi (dij − di ) + j∈{[r],...,[|V(i)|]} (10) `∈C(i) From (5), we can also observe that for each node i ∈ V, the value functions βi + αi (dij − s) + hi (dij − di ) + X H(`, dij − di ) `∈C(i) corresponding to all j ∈ V(i) such that dij > s have the same slope −αi . Therefore, there exists a set of nodes {[rj ] : 1 ≤ j ≤ K} such that di ≤ di[r1 ] ≤ di[r2 ] ≤ . . . ≤ di[rK ] = di[|V(i)|] and each X H(`, dik − di ) [rj ] = argmin{k∈V(i):dik >s} βi + αi (dik − s) + hi (dik − di ) + `∈C(i) for a range of inventory level s. Accordingly, we have r HPr (i, s) = HPj (i, s) for all rj−1 < r ≤ rj and 1 ≤ j ≤ K with r0 = 0. (11) Then based on (7), (8), (9) and (11), the value function H(i, s) for each node i can be expressed as follows: 1 HP (i, © s),rj ª if 0 ≤ s < di ; min HP (i, s), HNP (i, s) , if max{di , di[rj−1 ] } ≤ s < di[rj ] , for 1 ≤ j ≤ K; H(i, s) = HNP (i, s), if s ≥ di[|V(i)|] . 10 r In this formulation, the production value function HPj (i, s) for each 1 ≤ j ≤ K is a linear function of s and right continuous. From the induction assumption, the non-production value function HNP (i, s) is the summation of piecewise linear and right continuous functions, as shown in (6). From Observation 1, this function is also piecewise linear and right continuous. Thus the value function H(i, s) is the minimum of two piecewise linear, right continuous functions, and from Observation 2 it is therefore also piecewise linear and right continuous. Similarly, since H(`, s∗ ) ≤ lims→s∗− H(`, s) holds at each discontinuous point s∗ for each node ` ∈ C(i) and HNP (i, s) is the summation of right continuous functions, we have H(i, s∗ ) ≤ lims→s∗− H(i, s) at each discontinuous point s∗ of HNP (i, s). Thus, it can be observed that H(i, s∗ ) ≤ lims→s∗− H(i, s) holds at each discontinuous point s∗ in the intervals max{di , di[rj−1 ] } ≤ s < di[rj ] for each 1 ≤ j ≤ K. At each discontinuous point s = di[rj ] , we have from (10) and (6) that lim s→di[rj ] − X HP (i, s) = βi + hi (di[rj ] − di ) + H(`, di[rj ] − di ) `∈C(i) and X HNP (i, di[rj ] ) = hi (di[rj ] − di ) + H(`, di[rj ] − di ). `∈C(i) Then, due to the fact that βi ≥ 0, we have lim s→di[rj ] − If lims→di[r j] − HNP (i, s) ≤ lims→di[r j] lim s→di[rj ] − H(i, s) = − HP (i, s) ≥ HNP (i, di[rj ] ). (12) HP (i, s), then lim s→di[rj ] − HNP (i, s) ≥ HNP (i, di[rj ] ) ≥ H(i, di[rj ] ) where the first inequality follows from the induction argument and the second inequality follows from (9). Otherwise if lims→di[r lim j] s→di[rj ] − − HNP (i, s) > lims→di[r H(i, s) = lim s→di[rj ] − j] − HP (i, s), then, based on (12), HP (i, s) ≥ HNP (i, di[rj ] ) ≥ H(i, di[rj ] ). 2 Therefore, the conclusion holds. From the above proof, we can easily obtain the following Corollary. 11 Corollary 1 The non-production value function HNP (i, s) is piecewise linear and right continuous; and at each positive discontinuous point s∗ , the value HNP (i, s∗ ) ≤ lims→s∗− HNP (i, s). The value functions H(i, s) are discontinuous. In general the minimum of a discontinuous function may not exist if the infimum is not actually attained. However, in our case, because the set up cost is assumed to be nonnegative and the value of the function on the right of each point of discontinuity is smaller than the limit value on the left as shown in Proposition 3, the minimum is always achieved. Then, based on the value function H(i, s), we can also observe the following Proposition (i.e., obtain the optimal initial inventory) as a by-product. Proposition 4 For each i ∈ V, there exists a minimizer s∗ ≥ 0 of H(i, s), and therefore the value mins≥0 H(i, s) = H(i, s∗ ) exists. The claim in Proposition 4 can also be extended to SULS with some negative set up costs βi . In this case, it suffices to fix yi to 1 in case βi < 0, and to solve SULS by using the positive part of the set up costs βi for all nodes. Since the value function H(i, s) for each node i ∈ V is piecewise linear and right continuous, we can let breakpoints represent the s values such that the value function jumps and/or the slope changes. The value function H(i, s) can be then computed and stored in terms of breakpoints, evaluations of breakpoints, and slopes corresponding to breakpoints. Let B(i) represent the set of breakpoints for the value function H(i, s) at node i. The complexity of the problem depends on the number of breakpoints. Proposition 5 The number of breakpoints corresponding to the value function H(i, s) for each node i ∈ V is bounded by O(|V(i)|2 ). Proof: We calculate the number of breakpoints |B(i)| for each node i ∈ V backwards from time period T to time period 1. First, as shown in Figure 2, there are two breakpoints for the value function corresponding to each leaf node. For instance, B(i) = {0, di } and |B(i)| = 2 for each leaf node i at time period T . Now we calculate the number of breakpoints |B(i)| for each node i ∈ V in terms of three intervals: 12 For the interval 0 ≤ s < di , from formulation (7), we see that the value function H(i, s) is linear with slope −αi . For the interval s ≥ di[|V(i)|] , no production is required and equation (8) applies for each node P k ∈ V(i). The value function H(i, s) is thus linear with slope k∈V(i) hk in this interval. Therefore, the two breakpoints s = 0 and di[|V(i)|] are the only breakpoints for H(i, s) in the intervals 0 ≤ s < di and s ≥ di[|V(i)|] . For the interval di ≤ s < di[|V(i)|] , as shown in Proposition 3, the value function © r ª H(i, s) = min HPj (i, s), HNP (i, s) for each 1 ≤ j ≤ K and max{di , di[rj−1 ] } ≤ s < di[rj ] . (13) Now we consider the number of breakpoints generated by HNP (i, s) and HP (i, s), respectively. Number of breakpoints generated by HNP (i, s): From (6) and the fact that adding piecewise linear functions does not generate new breakpoints, the number of breakpoints for HNP (i, s) is no more than the total number of breakpoints generated by H(`, s) for each ` ∈ C(i). Thus, in the interval di ≤ s < di[|V(i)|] , the number of breakpoints for HNP (i, s) is |BNP (i)| ≤ X |B(`)| − 1 (14) `∈C(i) since di[|V(i)|] is a breakpoint in B(`) for some ` ∈ C(i) and not in the interval di ≤ s < di[|V(i)|] . Number of breakpoints generated by HP (i, s): From (10) we see that the value function r HPj (i, s) is linear in the interval max{di , di[rj−1 ] } ≤ s < di[rj ] . Therefore, all possible breakpoints for HP (i, s) in the interval di ≤ s < di[|V(i)|] are di[1] , di[2] , . . . , di[|V(i)|−1] . Note here each breakpoint di[r] , 1 < r ≤ |V(i)| originates from the breakpoint d[r] corresponding to value function H([r], s) and it evolves as the breakpoint da([r])[r] in BNP (a([r])) and so on the breakpoint dk[r] in BNP (k) for each node k ∈ P([r]). Then the breakpoint di[r] is in BNP (i) since r i ∈ P([r]). Therefore, all breakpoints for HPj (i, s) are also breakpoints in BNP (i). We may denote these breakpoints in BNP (i) as old breakpoints for this iteration. Now, we consider the number of new breakpoints generated, which is the last step necessary to characterize the value function H(i, s). First note the following factors: (1) Breakpoints di[1] , di[2] , . . . , di[|V(i)|−1] are also breakpoints for HNP (i, s). r (2) The production value function HPj (i, s) in the interval max{di , di[rj−1 ] } ≤ s < di[rj ] is linear, as shown in (10). 13 (3) The non-production value function HNP (i, s) is piecewise linear, as shown in Corollary 1. Given these three observations, the expression (13) shows that the value function H(i, s) between two old breakpoints in HNP (i, s) can be viewed as the minimum of two linear functions. Therefore, between any two old breakpoints, there is at most one new breakpoint. Whether there is a breakpoint depends on the evaluations of the two functions at the breakpoints, which can be computed easily based on previously stored information. Essentially, if one of the two functions dominates the other between the two old breakpoints, there will not be a new breakpoint. Otherwise there will be one new breakpoint between two old breakpoints. Therefore, we have that |B(i)| ≤ 2|BNP (i)| + 2 (15) since the number of breakpoints is at most double the size of the old breakpoints in the interval di ≤ s < di[|V(i)|] and two more breakpoints in the intervals 0 ≤ s < di and s ≥ di[|V(i)|] . Combining (14) and (15), we have that |B(i)| ≤ 2|BNP (i)| + 2 ≤ 2 X |B(`)|. (16) `∈C(i) Since |B(j)| = 2 = 2|V(j)| for each leaf node j at time period T , we have that |B(i)| ≤ 2T −t(i)+1 |V(i)|. Since every non-leaf node has at least two children, we have |V(i)| ≥ 1 + 21 + . . . + 2T −t(i) = 2T −t(i)+1 − 1. (17) Then, combining (16) and (17), the number of breakpoints |B(i)| ≤ 2T −t(i)+1 |V(i)| ≤ |V(i)|2 + |V(i)|. Thus, the number of breakpoints is bounded by O(|V(i)|2 ). 3.3 2 Algorithm analysis We are now ready to analyze the dynamic programming algorithm, which is a construction of H(i, s), the value function for each node i ∈ V. 14 Theorem 1 For the case that C(i) ≥ 2 for each i ∈ V \ L, the value functions H(i, s) for all i ∈ V can be defined by a dynamic programming algorithm that runs in O(n3 log C) time. Proof: For each node i ∈ V, the value function H(i, s) is piecewise linear and therefore can be stored in terms of breakpoint values, evaluations of breakpoints, and the right slope of each breakpoint. In our approach, breakpoints are stored in a non-decreasing order of their inventory levels using a Linked-List data structure. We construct the value functions H(i, s) by induction starting from each leaf node at time period T . The value function of each leaf node is shown in Figure 2 and it can be stored in terms of two breakpoints: (1) two breakpoints: s = 0 and s = di . (2) the evaluations at these two breakpoints: H(i, 0) = αi di + βi and H(i, di ) = 0. (3) the right slope of each breakpoint: r(i, 0) = −αi and r(i, di ) = hi . For the general case to store the value function H(i, s) for each node i ∈ V, we need to perform the following several steps: (1) Generate the list of breakpoints of P `∈C(i) H(`, s) in non-decreasing order: First of all, we notice that, by induction, the O(|V(`)|2 ) breakpoints in B(`) corresponding to H(`, s) for each ` ∈ C(i) have already been stored in non-decreasing order of their inventory levels. In our construction process, the basic idea is to pick the smallest inventory level S breakpoint in `∈C(i) B(`) and add it to the end of the non-decreasing order breakpoint list P for `∈C(i) H(`, s). (i) We initially construct a list κ that collects the first breakpoint in B(`) for all ` ∈ C(i). We next sort the |C(i)| breakpoints in κ in non-decreasing order of their inventory levels, which takes O(|C(i)| log |C(i)|) time. (ii) We remove the first element, the smallest inventory level breakpoint, in κ and add it P to the end of the non-decreasing order breakpoint list for `∈C(i) H(`, s). Without loss of generality, denote this breakpoint as node ω ∗ , the first element in B(`1 ) for some node `1 ∈ C(i). Then, node ω ∗ ’s next breakpoint (i.e., node u) in B(`1 ) becomes the 15 first breakpoint in B(`1 ). We insert this node (i.e., node u) at the right place in list κ such that the non-decreasing order still holds in κ. This can be done by binary search in O(log |C(i)|) time since all existing nodes in κ are in non-decreasing order. We P repeat this process until all breakpoints in `∈C(i) H(`, s) have been generated. It takes P O(|V(i)|2 log |C(i)|) time since the number of breakpoints in `∈C(i) H(`, s) is bounded by O(|V(i)|2 ). (iii) It can be observed that the generated breakpoints for P `∈C(i) H(`, s) are in non-decreasing order. Since O(|C(i)| log |C(i)|) ≤ O(|V(i)|2 log |C(i)|), this entire step can be completed in O(|V(i)|2 log |C(i)|) time. (2) Calculate and store P `∈C(i) H(`, s): Note here at each breakpoint, only one of the func- tions in the summation jumps and/or changes slope (duplicated breakpoints are considP ered separately). Starting from the initial value `∈C(i) H(`, 0) and the initial right slope P ∂H(`,s) `∈C(i) lims→0+ ∂s , we spend O(1) time to calculate and store each breakpoint, and therefore this step can be completed in O(|V(i)|2 ) time, since the number of breakpoints is bounded by O(|V(i)|2 ) (from Proposition 5). (3) Calculate and store the breakpoints, evaluations of breakpoints, and slopes for HNP (i, s): Recall that HNP (i, s) depends on H(`, s − di ) for each ` ∈ C(i). This step can therefore be completed in O(|V(i)|2 ) time based on (2), since the number of breakpoints is bounded by O(|V(i)|2 ) (from Proposition 5). (4) Calculate ρ(j) = αi dij + hi (dij − di ) + P `∈C(i) H(`, dij Based on the result in (2), the value of the function P − di ) and store it for each j ∈ V(i): `∈C(i) H(`, dij −di ) with a given j can be obtained by binary search in O(log |V(i)|2 ) time, since the number of breakpoints is bounded by O(|V(i)|2 ). Therefore, this entire step can be completed in O(|V(i)| log |V(i)|) time. (5) Calculate and store the breakpoints, evaluations of breakpoints, and slopes for HP (i, s): The slope for each piece is fixed (i.e., −αi ). Sort ρ(j) in non-decreasing order such that ρ([1]) ≤ ρ([2]) ≤ . . . ≤ ρ([|V(i)|]). Following this order, select the node index [r1 ], [r2 ], . . . , [rK ], corresponding to each of the K pieces of the value function HP (i, s). This can be done by choosing r1 = 1 and [rt ] = argminj∈V(i) {ρ(j) : dij > di[rt−1 ] } for all t : 2 ≤ t ≤ K. This step 16 can be completed in O(|V(i)| log |V(i)|) time. (6) Calculate and store the breakpoints, evaluations of breakpoints, and slopes for H(i, s): Here we must check each linear piece of HP (i, s) with the corresponding one or several pieces of HNP (i, s), take the minimum of the two functions based on their slopes and evaluations of breakpoints, and store the new breakpoints, the evaluations of the new breakpoints and the slopes for the new pieces. This step can be completed in O(|V(i)|2 ) time since the number of breakpoints is bounded by O(|V(i)|2 ) (from Proposition 5). The maximum complexity for each step is O(|V(i)|2 log |C(i)|). Since the above operations are required for each node i ∈ V, the optimal value function for SULS can be obtained and stored in O(n3 log C) time. 2 If the scenario tree is balanced, for instance, |C(i)| = C for all i ∈ V \ L, the algorithm yields an improved complexity result. Corollary 2 If C(i) = C ≥ 2 for each i ∈ V \ L, then the value functions H(i, s) for all i ∈ V can be defined by a dynamic programming algorithm that runs in O(n3 ) time. Proof: It can be observed that the number of breakpoints for this case is the same as shown in Proposition 5. The computational complexity of Steps (2)-(6) is also the same as the unbalanced tree case. In Step (1), the calculation in (ii) for the balanced tree case can be completed in O(C|V(`)|2 log C) ≤ O(|V(i)|2 ) time, since |V(i)| = C|V(`)| + 1. Therefore, the value function can be obtained in O(n3 ) time. 3.4 2 An example Consider a three period SULS example shown in Figure 3 and the corresponding problem parameters are shown in Table 1. As described in Figure 2, for time period T , the value function H(4, s) is right continuous and piecewise linear with two pieces. For this function, we store the two breakpoints s = 0 and s = d4 = 15, the evaluations for these two breakpoints H(4, 0) = α4 d4 + β4 = 35 and H(4, 15) = 0, and the slopes for each piece −α4 = −1 and h4 = 1. The value function H(5, s) can be obtained in the same way. Then the function H(4, s) + H(5, s) can be calculated accordingly and 17 4 2 5 1 6 3 7 Figure 3: An example Table 1: Problem parameters for the example βi αi hi di 1 15 3 0.5 10 2 18 1 1 25 3 10 4 0.5 40 4 20 1 1 15 5 10 2 2 10 6 8 3 1 8 7 15 1 0.5 13 the results are shown in Figure 4. Note here, the value function H(4, s) + H(5, s) is still piecewise linear and right continuous and will be used later to calculate H(2, s) for node 2. Similarly, the value functions H(6, s), H(7, s) and H(6, s) + H(7, s) are shown in Figure 5. H(4, s) H(4, s) + H(5, s) H(5, s) 35 65 30 60 −1 −3 20 40 −2 35 25 10 1 30 25 20 3 2 10 0 10 15 0 s 10 15 20 s Figure 4: Value functions H(4, s), H(5, s) and H(4, s) + H(5, s) Then, to obtain the value function H(2, s), we first calculate ρ(2) = α2 d2 + H(4, 0) + H(5, 0) = 90, ρ(5) = α2 d25 + h2 (d25 − d2 ) + H(4, d25 − d2 ) + H(5, d25 − d2 ) = 70, and ρ(4) = α2 d24 + h2 (d24 − d2 ) + H(4, d24 − d2 ) + H(5, d24 − d2 ) = 65, where the value H(4, s) + H(5, s) can be obtained from Figure 4 directly. Thus [r1 ] = [rK ] = 4 and there is only one piece for the production value function HP (2, s). As shown in Figure 6, the slope for the production value function HP (2, s) is −α2 = −1 in the interval 0 ≤ s < 40. 18 32 H(6, s) H(7, s) H(6, s) + H(7, s) 28 24 60 −1 −4 16 −3 40 15 28 8 8 20 20 20 1 5 1.5 0.5 0 8 13 16 s 0 8 13 16 s Figure 5: Value functions H(6, s), H(7, s) and H(6, s) + H(7, s) The non-production value function HNP (2, s) can be described easily by moving the function H(4, s) + H(5, s) introduced in Figure 4 to the right by d2 = 25 and increasing the slope by h2 = 1. It is shown in Figure 6 the three pieces in the intervals 25 ≤ s < 35, 35 ≤ s < 40 and s ≥ 40. Then the value function H(2, s) is the minimum of two value functions HP (2, s) and HNP (2, s) as shown the solid line in the Figure. In this case, two new breakpoints are generated in the intervals 25 ≤ s < 35 and 35 ≤ s < 40 respectively during the minimization operation. The value function H(3, s) can be calculated in a similar way. In this case, there are two pieces for HP (3, s) and only one new breakpoint generated as shown in Figure 6. Finally, for the value function expression of H(1, s), we only calculate H(1, 0). We have ρ(1) = α1 d1 + H(2, 0) + H(3, 0) = 339, ρ(2) = α1 d12 + h1 (d12 − d1 ) + H(2, d12 − d1 ) + H(3, d12 − d1 ) = 301.5, ρ(3) = ρ(4) = α1 d14 + h1 (d14 − d1 ) + H(2, d14 − d1 ) + H(3, d14 − d1 ) = 255, ρ(5) = α1 d15 + h1 (d15 − d1 ) + H(2, d15 − d1 ) + H(3, d15 − d1 ) = 273.6, ρ(6) = α1 d16 + h1 (d16 − d1 ) + H(2, d16 − d1 ) + H(3, d16 − d1 ) = 273, ρ(7) = α1 d17 + h1 (d17 − d1 ) + H(2, d17 − d1 ) + H(3, d17 − d1 ) = 304, where ρ(3) = ρ(4) holds due to the fact that d13 = d14 . Then, following (7), we obtain the optimal objective value for this problem with zero initial inventory H(1, 0) = HP (1, 0) = β1 + mink∈V(1) ρ(k) = 15 + 255 = 270. 19 226 H(3, s) 83 H(2, s) 80 200 −1 65 60 58 −2 −1 150 −4 48 45 −1 45 2 40 4 43 100 35 66 25 −4 50 20 60 −3.5 32 24 21.5 2 11.5 0 25 35 0 40 s 15 30 40 48 53 60 s Figure 6: Value functions H(2, s) and H(3, s) 4 Extensions In the previous section, we derived a polynomial time algorithm for the full characterization of H(i, s) in which C(i) ≥ 2 for each i ∈ V \ L. Since the full characterization of H(i, s) contains breakpoint values, evaluations of breakpoints, and the right slope of each breakpoint, it can provide insights of the problem that include sensitivity analysis at any inventory level for each node i ∈ V. It is not known if a polynomial time algorithm exists for deriving the full characterization of H(i, s) for the cases in which C(i) may be equal 1 for some i ∈ V \ L. In this section, we extend our analysis to the cases that allow C(i) = 1 for some i ∈ V \ L. In one direction, we derive polynomial time algorithms to solve the more general case to obtain the optimal solution instead of fully characterizing the value function H(i, s) for each i ∈ V. For instance, the general SULS case in Section 4.1 and the two-stage case in Section 4.2. In the other direction, we study the polynomial time algorithms to provide the full characterization of H(i, s) for the more general case under certain cost restrictions. For instance, SULS without speculative motives in Section 4.3 and SULS without setup costs in Section 4.4. 4.1 The general SULS In this section, we consider the general SULS problem (i.e., C(i) ≥ 1 for each node i ∈ V \ L). For this case, it is not known if the full characterization of the value function H(i, s) for each i ∈ V can be obtained in polynomial time. However, an optimal solution of the general SULS can be obtained in polynomial time. Without loss of generality, we assume zero initial inventory. We also notice that the general SULS problem for which the initial inventory level is unknown and is itself a 20 decision variable can be transformed into another general SULS problem with zero initial inventory by adding a dummy root node 0 as the parent node of node 1 with zero production, setup and inventory costs as well as zero demand. Theorem 2 The general SULS can be solved in O(n2 max{C, log n}) time. Proof: With zero initial inventory, according to Proposition 1, we have x1 = d1j and s1 = d1j − d1 for some j ∈ V in an optimal solution. Then, corresponding to the value function H(`, s) for each ` ∈ C(1), we only need to store the breakpoints s = d1j − d1 for all j ∈ V and their evaluations. In general, based on (8) and (9), the breakpoints for the value function H(i, s) are obtained by moving the breakpoints for the value function H(`, s) for all ` ∈ C(i) to the right by di plus new breakpoints generated by minimizing two piecewise linear functions. Thus, in order to store the breakpoints s = d1j − d1a(i) for all j ∈ V : d1j − d1a(i) ≥ 0 for node i, in the calculation of the value functions H(`, s) for all ` ∈ C(i), we only need to store the breakpoints s = d1j − d1i = d1j − d1a(`) for all j ∈ V : d1j − d1a(`) ≥ 0. Therefore, in the algorithm of Theorem 1 to calculate the value function H(i, s) for each node i ∈ V backwards starting from leaf nodes, we store the breakpoints s = d1j − d1a(i) for all j ∈ V : d1j − d1a(i) ≥ 0 and their evaluations. There are at most O(n) breakpoints for each value function H(i, s). This reduction in the number of breakpoints means that, at each step calculating the value function H(i, s), we can bound the time the algorithm will take as follows: • Step (1): Since we have stored the same set of O(n) breakpoints s = d1j − d1a(`) = d1j − d1i for all j ∈ V : d1j − d1a(`) ≥ 0 corresponding to each value function H(`, s), ` ∈ C(i), the list P of breakpoints of `∈C(i) H(`, s) has the same set of O(n) breakpoints. This step takes O(n) time; • Step (2): Based on (1), we have the same set of O(n) breakpoints for each H(`, s), ` ∈ C(i) as P well as `∈C(i) H(`, s). This step takes O(Cn) time since the maximum number of children is C; • Step (3): Based on (2), this step can be completed in O(n) time since the number of breakpoints is bounded by O(n); 21 P • Step (4): Based on (2), the function values `∈C(i) H(`, dij − di ) for each j ∈ V are stored in P `∈C(i) H(`, s) since dij − di = d1j − d1i = d1j − d1a(`) for each ` ∈ C(i). There are |V(i)| ≤ n candidates for ρ(k) and the value of each ρ(k) can be obtained by binary search in O(log n) time since the number of breakpoints is bounded by O(n). Therefore, this entire step can be completed in O(n log n) time; • Step (5): This step can be completed in O(n log n) time since the number of breakpoints is bounded by O(n); • Step (6): To calculate and store the breakpoints of H(i, s), we have H(i, s) = HP (i, s) for the breakpoints s = d1j − d1a(i) for each j ∈ V such that d1a(i) ≤ d1j < d1i and H(i, s) = min{HP (i, s), HNP (i, s)} for the breakpoints s = d1j −d1a(i) for each j ∈ V such that d1j ≥ d1i . To obtain the minimum in this expression, we compare each linear piece of the production value function HP (i, s) with several breakpoint values of the corresponding non-production value function. This step can be completed in O(n) time since the number of breakpoints is bounded by O(n). Therefore, the total amount of work required at each node is bounded by O(n max{C, log n}). The result follows by multiplying this by the number of nodes. 4.2 2 The two-stage SULS For a T period planning problem, a two-stage SULS has known demands for the first t periods, which are usually considered as defining the first-stage problem. The uncertainty for the secondstage is explored in time period t+1. Demands for time periods t+1 to T perform as a deterministic case corresponding to each scenario explored in time period t + 1. For instance, assuming there are K scenarios explored in time period t + 1, we have C(i) = K if t(i) = t and C(i) = 1 for other non-leaf nodes. Proposition 6 The two-stage SULS can be solved in O(n2 log n) time. Proof: From Proposition 1, assuming t(i∗ ) = t, we have si∗ = di∗ k − di∗ for some k ∈ V(i∗ ) in the optimal solution, which contains K(T − t) + 1 ≤ n candidates. Corresponding to each candi22 date, the first t period problem is a deterministic ULS with a given final inventory level, which is equivalent to another ULS without final inventory by updating the demand at time period t. Thus, the optimal solution can be obtained in O(n log n) time as studied by Aggarwal and Park (1993). Similarly, the second T − t period problem corresponding to each scenario is a deterministic ULS with a given initial inventory level. Thus, the optimal solution for the second-stage problems can be obtained in O(K(T − t) log(T − t)) ≤ O(n log n) time. Finally, the minimum value among all candidates can be achieved in O(n2 log n) time and the conclusion holds. 4.3 2 SULS without speculative motives For the deterministic ULS, researchers and practitioners have long recognized that, in many situations, the costs will never encourage us to produce before we have to. For instance, If we are planning to set up in time periods both t and t + 1, it will never be cheaper to produce in period t to satisfy demand in t + 1 than it is to produce in period t + 1 to satisfy demand in t + 1. Cost structures satisfying this condition are referred to as without speculative motives orWagner-Whitin costs in the literature (see Wagelmans et al. (1992) and Pochet and Wolsey (1994, 2006), among others). We consider a similar cost structure for SULS. Assume that for each i ∈ V \ L, αi + hi ≥ X j∈C(i) αj and βi ≥ X βj . (18) j∈C(i) This condition states that the sum of the unit production and inventory holding costs at node i is not less than the sum of unit production costs of its children. It also states that the setup cost βi at node i is not less than the sum of setup costs of its children. Thus, we need never consider producing at a node i if the inventory entering i is sufficient to satisfy the demand at i (i.e., if sa(i) ≥ di ) since we can set up and produce at each node j ∈ C(i) instead of node i with a non-larger cost. For this case we can show that our algorithm runs faster than in the general case described in Section 3. In terms of the value functions of Section 3, (18) implies that we can assume that H(i, s) = HP (i, s) if and only if 0 ≤ s < di , and that H(i, s) = HNP (i, s) if s ≥ di . Because of this, there will never be new breakpoints at node i that occur between old breakpoints defined by the 23 value functions H(`, s), ` ∈ C(i). Therefore the number of breakpoints required to define the value function H(i, s) will be O(|V(i)|), for every i ∈ V. In terms of the algorithm of Theorem 1, this reduction in the number of breakpoints means that we can bound the time that each step will take as follows: • Step (1) is not needed since the breakpoints can be pre-determined and they correspond to each node k ∈ V(i); • Step (2) now takes O(|V(i)|) time; • Step (3) now takes O(|V(i)|) time; • Step (4) now takes O(|V(i)|) time since there are only |V(i)| candidates corresponding to |V(i)| breakpoints; • Step (5) can now be done in O(|V(i)|) time, since we are now only interested in the choice of k that minimizes ρ(k); • Step (6) now takes O(|V(i)|) time, and consists simply of setting H(i, s) = HP (i, s) if 0 ≤ s < di , and H(i, s) = HNP (i, s) if s ≥ di . We can now state Proposition 7 Without speculative motives, the value functions H(i, s), i ∈ V, can be defined by a dynamic programming algorithm that runs in O(n2 ) time. Proof: From the above argument, the total amount of work done at each node is bounded by O(|V(i)|) = O(n). The result follows by multiplying this by the number of nodes. 4.4 2 SULS without setup costs As described in Zipkin (2000), in many applications setup costs can be neglected in production planning. The deterministic version in this case is easily solved by using a greedy algorithm described in Johnson (1957). In this case the formulation of the stochastic problem (which we call 24 SULS-W) simplifies to (SULS-W) : min X (αi xi + hi si ) i∈V s.t. sa(i) + xi = di + si xi , si ≥ 0 ∀ i ∈ V, ∀ i ∈ V. Primal and dual algorithms with complexity O(n2 ) have been developed recently in Huang and Ahmed (2004, 2005) for the special case of this model in which the tree is balanced with zero initial inventory. In this section, we provide the full characterization of the optimal value function for a general tree structure (i.e., C(i) ≥ 1 for each i ∈ V \ L). The optimal value function can be obtained in O(n2 ) time. As will be seen in the development of this section, this analysis relies on the fact that the value function H(i, s) for SULS-W is not only piecewise linear but also convex. For brevity, we remind the reader here that any function that is convex must also necessarily be continuous (we will omit stating that the value functions are continuous in the development of this section). This is the primary advantage that the absence of setups allows us to exploit in our analysis: Not only do the value functions become continuous (recall that, for SULS, this is not true in general), but they are also convex. This, along with the production path property, allows us to show that the number of breakpoints of H(i, s) is an order of magnitude smaller at each node i than for SULS, yielding the improved complexity result. We write the value function for SULS-W in a slightly different way. For the non-production case we have HNP (i, s) = hi (s − di ) + X H(`, s − di ). (19) `∈C(i) Since the production path property still holds and no setup cost, the production value function can be written as X HPr (i, s) = min αi (dik − s) + hi (dik − di ) + H(`, dik − di ) k∈{[r],...,[|V(i)|]} (20) `∈C(i) in the interval di[r−1] ≤ s < di[r] , for r = 1, . . . , |V(i)| with di[0] = 0. Similar as the case with setup costs, there are several production value function pieces ending with breakpoints s = 25 di[r1 ] , di[r2 ] , . . . , di[rK ] such that di = di[1] ≤ di[r1 ] ≤ . . . ≤ di[rK ] = di[|V(i)|] and r HPr (i, s) = HPj (i, s) for all rj−1 < r ≤ rj and 1 ≤ j ≤ K with r0 = 0. Then, 1 HP (i, © s),rj ª if 0 ≤ s < di ; min HP (i, s), HNP (i, s) , if max{di , di[rj−1 ] } ≤ s < di[rj ] , for 1 ≤ j ≤ K; H(i, s) = HNP (i, s), if s ≥ di[|V(i)|] . We can observe from (20) that r HPj (i, s) = αi (di[rj ] − s) + hi (di[rj ] − di ) + X H(`, di[rj ] − di ). `∈C(i) Thus, we have r HPj (i, di[rj ] ) = HNP (i, di[rj ] ) for each 1 ≤ j ≤ K. (21) Before we prove that the value function H(i, s) is piecewise linear and convex, we define X H(`, dik − di ) [r∗ ] = [r1 ] = argmink∈{[1],...,[|V(i)|]} αi dik + hi (dik − di ) + (22) `∈C(i) and introduce an important Lemma. Lemma 1 If HNP (i, s) as defined in (19) is piecewise linear and convex, and contains |V(i)| breakpoints s = di[1] , . . . , di[|V(i)|] , then −αi ≤ lims→d+ ∗ i[r ] ∂HNP (i,s) ∂s and lims→d− ∗ i[r ] ∂HNP (i,s) ∂s ≤ −αi if r∗ > 1. Proof: We first show −αi ≤ lims→d+ ∗ i[r ] ∂HNP (i,s) . ∂s Let H̃1 (i, s) = αi (di[r∗ +1] − s) + hi (di[r∗ +1] − di ) + P `∈C(i) H(`, di[r∗ +1] − di ) and we can observe that H̃1 (i, di[r∗ +1] ) = HNP (i, di[r∗ +1] ) = HNP (i, di[r∗ ] ) + lim s→d+ i[r ∗ ] ∂HNP (i, s) (di[r∗ +1] − di[r∗ ] ), ∂s (23) where the second equation follows from the fact that s = di[r∗ ] and s = di[r∗ +1] are two consecutive breakpoints of a piecewise linear and convex function HNP (i, s). We can also observe that, according to the definition of HPr (i, s) shown in (20) and r∗ shown in (22), ∗ ∗ HPr (i, di[r∗ +1] ) = HPr (i, di[r∗ ] ) − αi (di[r∗ +1] − di[r∗ ] ) 26 (24) and ∗ HPr (i, di[r∗ +1] ) ≤ H̃1 (i, di[r∗ +1] ). Then, comparing (23) and (24), we have −αi ≤ lims→d+ ∗ i[r ] ∂HNP (i,s) ∂s (25) ∗ since HPr (i, di[r∗ ] ) = HNP (i, di[r∗ ] ) ∗ based on (21) and HPr (i, di[r∗ +1] ) ≤ H̃1 (i, di[r∗ +1] ) as shown in (25). Similarly, to prove lims→d− ∗ i[r ] ∂HNP (i,s) ∂s ≤ −αi for the case r∗ > 1, define H̃2 (i, s) = αi (di[r∗ −1] − s) + hi (di[r∗ −1] − di ) + X H(`, di[r∗ −1] − di ). `∈C(i) We have ∗ ∗ HPr (i, di[r∗ −1] ) = HPr (i, di[r∗ ] ) + αi (di[r∗ ] − di[r∗ −1] ) (26) and HNP (i, di[r∗ −1] ) = HNP (i, di[r∗ ] ) − lim s→d− i[r ∗ ] ∂HNP (i, s) (di[r∗ ] − di[r∗ −1] ). ∂s Then, comparing (26) and (27), we have lims→d− ∗ i[r ] ∗ ∂HNP (i,s) ∂s (27) ≤ −αi since HNP (i, di[r∗ −1] ) = ∗ H̃2 (i, di[r∗ −1] ) ≥ HPr (i, di[r∗ −1] ) and HPr (i, di[r∗ ] ) = HNP (i, di[r∗ ] ). Therefore the conclusion holds. 2 Proposition 8 The value function H(i, s) is a piecewise linear and convex function of s. Moreover, there are |V(i)| nonzero breakpoints: s = di , di[2] , . . . , and di[|V(i)|] . Proof: By induction. Base case: For the time period t = T , the value function for a node i is shown in Figure 7, which is a piecewise linear and convex function with breakpoints s = di and s = 0. Inductive step: Assume the claim is true for each function H(i, s) : t ≤ t(i) ≤ T . Now we prove that, for each node i : t(i) = t − 1, the value function H(i, s) is piecewise linear and convex, and it has |V(i)| nonzero breakpoints. We derive this conclusion from the following main steps: (i) Non-production value function HNP (i, s): From the induction assumption, the value function H(`, s) is piecewise linear and convex for each ` ∈ C(i) containing |V(`)| nonzero breakpoints. Then, the non-production value function HNP (i, s) defined in (19) is piecewise linear and convex since it is the summation of piecewise linear and convex functions. It is easy to verify 27 that it contains at most P `∈C(i) |V(`)|+1 = |V(i)| breakpoints, which are s = di[1] , . . . , di[|V(i)|] . Details are shown in Figure 8, where the function is shown as the dotted line in the interval 0 ≤ s ≤ di[r∗ ] and the solid line in the interval di[r∗ ] ≤ s. (ii) Production value function HP (i, s): As shown in the analysis for the cases with setup costs, the production value function HP (i, s) is piecewise linear and discontinuous with the same slope −αi in the intervals ending with breakpoints s = di[r1 ] , di[r2 ] , . . . , di[rK ] with r1 = r∗ as defined in (22). Details are shown in Figure 8, where the function is shown as the solid line in the interval 0 ≤ s ≤ di[r∗ ] and the dotted lines in the interval di[r∗ ] ≤ s ≤ di[|V(i)|] . (iii) Value function H(i, s): We compare HP (i, s) and HNP (i, s). First, we have ∗ HPr (i, di[r∗ ] ) = HNP (i, di[r∗ ] ) (28) according to (21) and lim s→d+ i[r] ∂HNP (i, s) is non-decreasing as r increases ∂s (29) since HNP (i, s) analyzed in (i) is piecewise linear and convex. Note that HNP (i, s) satisfies the assumption in Lemma 1, we have −αi ≤ lim s→d+ i[r ∗ ] ∂HNP (i, s) and ∂s lim s→d− i[r ∗ ] ∂HNP (i, s) ≤ −αi if r∗ > 1. ∂s (30) Then, combining (28), (29) and (30), HNP (i, s) ≤ HP (i, s) in the interval s < di[r∗ ] . In the r interval s ≥ di[r∗ ] , we have HPj (i, di[rj ] ) = HNP (i, di[rj ] ) for each 2 ≤ j ≤ K according to (21) and lims→d+ i[r] ∂HNP (i,s) ∂s ≥ −αi for each r ≥ r∗ due to (29) and (30). Then, HNP (i, s) ≤ HP (i, s) in the interval s ≥ di[r∗ ] . Therefore, we have ½ H(i, s) = HP (i, s), if 0 ≤ s < di[r∗ ] ; HNP (i, s), otherwise. That is, H(i, s) is a piecewise linear and convex function with the nonzero breakpoints s = di[r∗ ] , di[r∗ +1] , . . . , di[|V(i)|] as shown with the solid line in Figure 8. 2 Theorem 3 Without setup costs, the value functions H(i, s), i ∈ V, can be defined by a dynamic programming algorithm that runs in O(n2 ) time. 28 H(i, s) αi di −αi hi 0 s di Figure 7: Value function H(i, s) for node i at time period T H(i, s) ∗ HPr (i, s) r HPj (i, s) HNP (i, s) 0 di di[r∗ ] di[|V(i)|] s Figure 8: Value function H(i, s) Proof: The value function can be obtained by the following briefly described steps: (1) Initialization: First, we calculate d1i for each i ∈ V and sort them in non-decreasing order (i.e., s0 = d1[1] , . . . , d1[n] ). These are enough to serve as the breakpoints of the value function H(i, s) for each node i ∈ V. For instance, corresponding to each node i ∈ V, we set s = 0 at the breakpoint s0 = d1a(i) and H(i, s) can be stored at the breakpoints corresponding to each node k ∈ V : d1k ≥ d1a(i) . Second, for each node i ∈ V, we set correspondence between node i and each node k ∈ V(i). This entire step can be completed in O(n2 ) time. (2) Store the value function H(i, s) for each node i ∈ V: This can be done backwards starting from time period T . For each H(`, s), ` ∈ L, we set s = 0 at the breakpoint s0 = d1a(`) . Then, each value function H(`, s), ` ∈ L can be represented by storing the evaluation at s = 0 and the right slope for each point s = d1k − d1a(`) for each k ∈ V and d1k ≥ d1a(`) . That is, this is stored at the breakpoints s0 = d1k for each k ∈ V such that d1k ≥ d1a(`) . The following steps 29 are required corresponding to each node i ∈ V \ L: (i) Calculate and store P `∈C(i) H(`, s): We set s = 0 at the breakpoint s0 = d1i , which is the same as s0 = d1a(`) for each ` ∈ C(i). By induction, the value function H(`, s) for each ` ∈ C(i) is convex, piecewise linear and stored at the points s = d1k −d1a(`) for each k ∈ V and d1k ≥ d1a(`) (i.e., at the breakpoints s0 = d1k for each k ∈ V such that d1k ≥ d1a(`) = P d1i ). Then, the value function `∈C(i) H(`, s) is continuous and piecewise linear. It can P be stored in terms of initial value `∈C(i) H(`, 0) and the right slopes at breakpoints k ∈ V : d1k ≥ d1i . Following the order defined in (1). We initialize the right slope P value to be `∈C(i) lims→0+ ∂H(`,s) ∂s . At each breakpoint k, based on the correspondence information set up in (1), if k ∈ V(`) for some ` ∈ C(i), the right slope at this breakpoint P for `∈C(i) H(`, s) will be increased by lims→(d1k −d1i )+ ∂H(`,s) − lims→(d1k −d1i )− ∂H(`,s) ∂s ∂s from the right slope of the previous breakpoint. Otherwise, the right slope for this breakpoint is kept the same as the right slope of the previous breakpoint. At each breakpoint, we consider at most one value function H(`, s) among all ` ∈ C(i) in which the slope changes (duplicated breakpoints are considered separately). Therefore, this step can be completed in O(n) time. (ii) Calculate P `∈C(i) H(`, dik − di ) for each node k ∈ V : d1k ≥ d1i and HNP (i, s) shown in (19): Based on (i), this can be completed in O(n) time. (iii) Calculate [r∗ ] defined in (22): Since P `∈C(i) H(`, dik − di ) for each k ∈ V(i) has been calculated in (ii), this step can be completed by binary search in O(log n) time. (iv) Obtain H(i, s): Update HNP (i, s) to HP (i, s) in the interval 0 ≤ s ≤ di[r∗ ] that includes the slopes of the breakpoints within this interval and the evaluation of the breakpoint s = 0. This step can be completed in O(n) time. Therefore, an optimal value function can be obtained in O(n2 ) time. 4.5 2 Example (continued) In this section, we consider an example with the same data as the one mentioned in section 3.4, except for the absence of setup costs. 30 We first consider leaf node 4 at time period 3. The value function H(4, s) is continuous and piecewise linear with two pieces as described in Figure 7. The slopes for the two pieces are −1 and 1, which correspond to −α4 and h4 respectively. There is one nonzero breakpoint s = d4 = 15. The slopes and the breakpoint for the value function H(5, s) can be obtained in a similar way. Then, the function H(4, s) + H(5, s) can be calculated accordingly, which will be used later to describe HNP (2, s). The details are shown in Figure 9. The same operations can be applied to leaf nodes 6 and 7 and the details are shown in Figure 10. H(4, s) + H(5, s) H(4, s) 35 H(5, s) 20 −3 15 3 2 −2 10 −1 1 1 5 0 10 15 10 0 s 15 s Figure 9: Value functions H(4, s), H(5, s) and H(4, s) + H(5, s) H(6, s) H(6, s) + H(7, s) 37 H(7, s) 24 −4 13 −3 1.5 1 −1 5 0.5 0 8 13 s 0 8 13 s Figure 10: Value functions H(6, s), H(7, s) and H(6, s) + H(7, s) Then, consider the value function H(2, s). The non-production value function HNP (2, s) can be described easily by moving the function H(4, s) + H(5, s) to the right by d2 = 25 and increasing the 31 slope by h2 = 1. It is shown in Figure 11 with the dotted line in the interval 25 ≤ s ≤ 35 and with the solid line in the interval s ≥ 35. The production value function HP (2, s) contains two pieces as shown with the solid line in the interval 0 ≤ s ≤ 35 and with the dotted line in the interval 35 ≤ s ≤ 40. Note here we only need to consider the first piece. Following (22), X [r∗ ] = argmink∈{2,5,4} α2 d2k + h2 (d2k − d2 ) + H(`, d2k − d2 ) `∈C(2) = argmin {25 + 0 + 35, 35 + 10 + 10, 40 + 15 + 10} = 5. Therefore, ½ H(2, s) = HP (2, s), if 0 ≤ s ≤ d25 = 35; HNP (2, s), Otherwise as shown with the solid line in Figure 11. The same logic applies to calculating the value function H(3, s) and the only difference is that [r∗ ] = 3 for this case, which leads to the case that no intervals in HNP (3, s) are updated to HP (3, s). Finally, we can perform a procedure similar to that described above to calculate the value function H(1, s). In this iteration, [r∗ ] = 5 and the corresponding value function H(1, s) as well as H(2, s) + H(3, s) are shown in Figure 12. H(2, s) H(3, s) 50 197 4 −1 −4 35 30 30 25 −2 2 15 15 40 30 0 25 35 40 s 10 0 41 −4 −3.5 40 31.5 −4 2 9 0.5 11.5 48 53 s Figure 11: Value functions H(2, s) and H(3, s) 5 Conclusions In this paper, we first studied that the value function H(i, s) for each i ∈ V for SULS is piecewise linear and right continuous. Correspondingly, for the case C(i) ≥ 2 for each i ∈ V \ L, we developed 32 247 H(2, s) + H(3, s) 247 224.5 H(1, s) −4.5 −5 −3 6.5 115 115 6 89.5 88.5 90 72 60 0 −2 62 0.5 35 40 48 53 82 80 66 4.5 s 0 −1.5 10 45 50 90 5 1 58 63 s Figure 12: Value functions H(2, s) + H(3, s) and H(1, s) a polynomial time algorithm that runs in O(n3 log C) time for obtaining the full characterization of the value function, which was further improved to be O(n3 ) time for the balanced tree case (i.e., C(i) = C, ∀i ∈ V \ L). Then, we extended our analysis to a more general tree structure. For instance, there are several nodes i ∈ V \ L such that C(i) = 1. In this case, the number of nodes in the tree can be polynomial to the number of time periods. We studied this more general tree structure in two categories. For the first category, we developed polynomial time algorithms for SULS to obtain the optimal solutions. It includes a polynomial time algorithm that runs in O(n2 max{C, log n}) time for the general tree case and a polynomial time algorithm that runs in O(n2 log n) time for the two-stage SULS. For the second category, we developed polynomial time algorithms that run in O(n2 ) time to obtain the full characterization of the value functions for two special cases: SULS without speculative motives and SULS without setup costs. Since SULS is a fundamental stochastic integer programming structure, our studies on SULS and its variants will help solve many large complicated stochastic integer programming problems. Valid inequalities for SULS and its variant with constant production capacities have been proposed in Guan et al. (2006b) and Summa and Wolsey (2006). These papers demonstrate computationally that these inequalities form very tight approximations of the convex hull. Moreover, in Guan et al. (2006a) it is shown that they define the convex hull of SULS with two periods; but this is not true for the general case of SULS. Thus, an interesting open question is the definition of a complete description of the convex hull of SULS (either explicit—by valid inequalities—or implicit—by extended formulation). This seems to be difficult. While one can transform the dynamic programming approach presented here into a linear programming formulation, we have not 33 yet been able to do this in such a way that the variables in this LP formulation relate to the x, y, and s variables. (This is in contrast to the deterministic case, in which, for example, the shortest path reformulation of Eppen and Martin (1987) is directly related to the dynamic programming approach of Wagner and Whitin). It is shown in Bitran and Yanasse (1982) that the singe item deterministic capacitated lot-sizing problem (CLSP) is N P-hard. This implies that the stochastic CLSP with the general tree structure (i.e., C(i) ≥ 1 for each i ∈ V) is N P-hard, since the deterministic CLSP is a special case of this problem containing only one scenario. However, the deterministic problem with constant capacity is polynomial time solvable, and it may be possible to solve the stochastic version in polynomial time, also. This is an area of future research. In the future we also intend to combine our approaches, polynomial time algorithms and polyhedral studies, into decomposition frameworks for large size stochastic integer programming problems, such as those studied by Carøe (1998) and Sen and Sherali (2006) (among others). Acknowledgments The authors thank the associate editor and the referees for their detailed and helpful comments. Support of this research has been provided by Oklahoma Transportation Center and National Science Foundation under Award CMMI-0700868 for the first author and by the Air Force Office of Scientific Research under Award FA9550-04-1-0192 and National Science Foundation under Award DMI-0323299 for the second author. References Aggarwal, A., J. K. Park. 1993. Improved algorithms for economic lot size problems. Operations Research 41 549–571. Ahmed, S., A. J. King, G. Parija. 2003. A multi-stage stochastic integer programming approach for capacity expansion under uncertainty. Journal of Global Optimization 26 3–24. Ahmed, S., N. V. Sahinidis. 2003. An approximation scheme for stochastic integer programs arising in capacity expansion. Operations Research 51 461–471. 34 Belvaux, G., L. A. Wolsey. 2000. bc − prod: a specialized branch–and–cut system for lot-sizing problems. Management Science 46 724–738. Belvaux, G., L. A. Wolsey. 2001. Modelling practical lot–sizing problems as mixed integer programs. Management Science 47 993–1007. Beraldi, P., A. Ruszczyński. 2002. A branch and bound method for stochastic integer problems under probabilistic constraints. Optimization Methods and Software 17 359–382. Bitran, G. R., H. H. Yanasse. 1982. Computational-complexity of the capacitated lot size problem. Management Science 28 1174–1186. Carøe, C. C. 1998. Decomposition in stochastic integer programming. Ph.D. thesis, University of Copenhagen. Eppen, G. D., R. K. Martin. 1987. Solving multi–item lot–sizing problems using variable redefinition. Operations Research 35 832–848. Federgruen, A., M. Tzur. 1991. A simple forward algorithm to solve general dynamic lot sizing models with n periods in O(n log n) or O(n) time. Management Science 37 909–925. Federgruen, A., M. Tzur. 1993. The dynamic lot-sizing model with backlogging-a simple O(n log n) algorithm and minimal forecast horizon procedure. Naval Research Logistics 40 459–478. Florian, M., M. Klein. 1971. Deterministic production planning with concave costs and capacity constraints. Management Science 18 12–20. Guan, Y., S. Ahmed, A. J. Miller, G. L. Nemhauser. 2006a. On formulations of the stochastic uncapacitated lot-sizing problem. Operations Research Letters 34 241–250. Guan, Y., S. Ahmed, G. L. Nemhauser, A. J. Miller. 2006b. A branch-and-cut algorithm for the stochastic uncapacitated lot-sizing problem. Mathematical Programming 105 55–84. Halman, N., D. Klabjan, M. Mostagir, J. Orlin, D. Simchi-Levi. 2006. A fully polynomial time approximation scheme for single-item stochastic lot-sizing problems with discrete demand. Tech. rep., MIT. 35 Huang, K., S. Ahmed. 2004. On a stochastic programming model for inventory planning. Tech. rep., Georgia Institute of Technology. Huang, K., S. Ahmed. 2005. The value of multi-stage stochastic programming in capacity planning under uncertainty. Tech. rep., Georgia Institute of Technology. Johnson, S. M. 1957. Sequential production planning over time at minimum cost. Management Science 3 435–437. Lee, C. Y., S. Cetinkaya, A. Wagelmans. 2001. A dynamic lot-sizing model with demand time windows. Management Science 47 1384–1395. Lulli, G., S. Sen. 2004. A branch-and-price algorithm for multi-stage stochastic integer programming with application to stochastic batch-sizing problems. Management Science 50 786–796. Nemhauser, G. L., L. A. Wolsey. 1988. Integer and Combinatorial Optimization. Wiley, New York. Papadaki, K., W. B. Powell. 2002. Exploiting structure in adaptive dynamic programming algorithms for a stochastic batch service problem. European Journal of Operational Research 142 108–127. Papadaki, K., W. B. Powell. 2003. An adaptive dynamic programming algorithm for a stochastic multiproduct batch dispatch problem. Naval Research Logistics 50 742–769. Pochet, Y., L. A. Wolsey. 1994. Polyhedra for lot–sizing with Wagner–Whitin costs. Mathematical Programming 67 297–323. Pochet, Y., L. A. Wolsey. 2006. Production Planning by Mixed Integer Programming. Springer, New York. Ruszczyński, A., A. Shapiro, eds. 2003. Stochastic Programming. Handbooks in Operations Research and Management Science, vol. 10. Elsevier Science B. V. Sen, S., H. D. Sherali. 2006. Decomposition with branch-and-cut approaches for two-stage stochastic mixed-integer programming. Mathematical Programming 106 203 – 223. 36 Stadtler, H. 2003. Multi-level lot-sizing with setup times and multiple constrained resources: Internally rolling schedules with lot-sizing windows. Operations Research 51 487–502. Summa, M. Di, L. A. Wolsey. 2006. Lot-sizing on a tree. Tech. rep., CORE, UCL, Louvain-la-Neuve, Belgium. Tempelmeier, H., M. Derstroff. 1996. A Lagrangean–based heuristic for dynamic multilevel multiitem constrained lotsizing with setup times. Management Science 42 738–757. Topaloglu, H., W. B. Powell. 2006. Dynamic programming approximations for stochastic, timestaged integer multicommodity flow problems. INFORMS Journal on Computing 18 31–42. van Hoesel, C. P. M., A. Wagelmans. 1996. An O(T 3 ) algorithm for the economic lot-sizing problem with constant capacities. Management Science 42 142–150. Wagelmans, A., A. van Hoesel, A. Kolen. 1992. Economic lot sizing: An O(n log n) algorithm that runs in linear time in the Wagner–Whitin case. Operations Research 40 145–156. Wagner, H. M., T. M. Whitin. 1958. Dynamic version of the economic lot size model. Management Science 5 89–96. Wolsey, L. A. 1998. Integer Programming. Wiley, New York. Zipkin, P. H. 2000. Foundations of Inventory Management. McGraw-Hill. 37
© Copyright 2026 Paperzz