Available online at www.sciencedirect.com
Computers & Industrial Engineering 54 (2008) 110–117 www.elsevier.com/locate/dsw
A pattern generation-integer programming based formulation for the carpet loading problem Mert C. Demir Marmara University, Industrial Engineering Department, 34722 Kadiko¨y, Istanbul, Turkey Received 6 July 2006; received in revised form 24 June 2007; accepted 24 June 2007 Available online 29 June 2007
Abstract In this work, an optimization problem related to the carpet weaving industry is introduced, modeled and solved using an enumeration algorithm and integer programming. The problem is to schedule orders of carpets with known widths, lengths and ordered amounts to looms with fixed widths. Although, it is a two-dimensional stock cutting problem with the objective being to fulfill the orders with minimum total scrap (empty area woven) and using the least number of setups, the problem exhibits some unique characteristics. Our approach consists of preprocessing the problem to find all reasonable two-dimensional patterns and then formulating and solving a pure integer problem. The whole procedure can be completed in a reasonable amount of time by the current computer technology and integer programming solvers. 2007 Elsevier Ltd. All rights reserved. Keywords: Two-dimensional trim loss; Integer programming; Carpet weaving
1. Introduction In the carpet industry, carpets of given widths and lengths are woven on make-to-order basis according to customer demand. An order from a customer consists of a set of internal codes of carpets (which determines the dimensions among other details) and the amounts demanded from each type. Excluding the wall-to-wall (continuous) types of carpets, planning the production of open orders is a real burden and usually relies on expert planners in the company. Currently, planners assign sets of carpet orders to looms considering their compatibility, due date, customer, and suitability to the loom width. A set of carpets are compatible if they have the same yarn type, the same knot density and similar – if not the same – set of colors. To aid the reader in visualising the production process, we should mention that looms in carpet industry are computer controlled machines around 4 m wide and 4–5 m high. Vertical yarns are running continuously along the height of the loom and knots are created on these yarns.
E-mail address:
[email protected] 0360-8352/$ - see front matter 2007 Elsevier Ltd. All rights reserved. doi:10.1016/j.cie.2007.06.039
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
111
Fig. 1. A sample stock with three strips and five different types of carpets.
We use the term ‘‘stock’’ for an uninterrupted stream of carpets produced on a single loom (with a pre-specified width) in one setup and handled as a whole. The continuous vertical yarns, which build the skeleton for carpets, are only cut at the end of a stock. A stock typically consists of compatible carpets with varying lengths and widths. On the other hand, a ‘‘schedule’’ includes several stocks – possibly woven on looms with different widths – and it describes the production plan of one outstanding order. The composition of carpets in stocks are entered into the computer, which drives electronically controlled looms. With these definitions, a stock comprises the smallest production unit whereas a schedule is the smallest planning unit. Assigning carpets to looms widthwise in a stock is the classical trim loss problem. On the other hand, carpets in a stock must be woven in strips, i.e. two or more carpets with different lengths can be woven in one continuous strip, provided that they have the same width. Carpets assigned to a stock on a certain loom span the loom width and the stock length as much as possible, but usually there are empty areas (scrap) generated in the stock. Naturally, the main objective is to minimize these empty areas. Fig. 1 illustrates a sample stock with three strips but with five different types of carpets labeled from A to E. It should be noted that carpets A–B and carpets D–E have the same width and therefore could be scheduled in the same strip. In this illustration, the scrap is the shaded area between the carpets and the dashed rectangle. Although there are many details in carpet production, we will only focus on the problem of assigning a given set of compatible carpets to stocks so as to minimize the total scrap and the number of stocks (setups) in a schedule. The trim loss problem has been introduced in the classical paper of Gilmore and Gomory (1961). In this paper, the authors defined the problem and solved it using linear programming. They have then improved the solution to this single dimensional problem using the column generation algorithm (Gilmore & Gomory, 1963). In a later paper they have extended the column generation algorithm to two dimensions, and to two (and higher) stage cutting processes for stocks with known lengths and widths (Gilmore & Gomory, 1965). Here, two-stage means cutting the main rectangular block with known width and length to strips along its length and then slitting the resulting strips to final lengths. However, as stated, our problem mostly resembles one of the types of problems mentioned – but not tackled – in Gilmore and Gomory (1965) (two stage problem with continuous length). The example mentioned there was taken from the glass industry and deals with cutting final products from a continuous glass ribbon. Gilmore and Gomory state the problem as ‘‘. . .a very difficult problem requiring the solutions of |L0| + 1 knapsack problems, where L0 is the limiting length and where |L0| is the number of distinguishable lengths that need be considered.’’ More recently, Westerlund, Isaksson, and Harjunkoski (1998) considered the two stage problem in paper industry where both the width and length of the raw paper and the length of the produced paper are considered variables. In this setup, product paper rolls with required lengths are cut from raw paper rolls with a variable length but multiple orders that have the same width are not considered.
112
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
Demir et al. (2004) considered the carpet loading problem but allowing at most two different carpet types sharing the same width. The problem with a single loom width has been studied in Demir and Kulak (2005). The current paper shows NP-completeness of the problem, generalizes the work of Demir and Kulak (2005) and Demir et al. (2004) to all possible types of orders and multiple loom widths. Although there are two-dimensional trim loss problems dealing with similar settings, the carpet problem is interesting and unique in its own sense. First, the carpets must be cut at full length because the cost of disposing a half-woven carpet is prohibitive. Second, since there is no ‘‘roll’’ to cut the carpets from, the length of stock is not fixed and is determined by the current stock. Third, multiple orders with the same width but different lengths could be mixed in one strip. Finally, an order may be fulfilled using multiple stocks scheduled on different types of looms with non-identical widths. For a complete survey of cutting and packing problems, the reader is referred to Sweeney and Paternoster (1992) and Lodi et al. (2002). The rest of the paper is organized as follows: in Section 2 we define the problem in mathematical terms and show the NP-completeness. In Sections 3 and 4 the enumeration and the integer programming formulation for the solution of the problem are explained. Numerical results with actual orders are presented in Sections 5 and 6 concludes the paper. 2. The carpet loading problem Consider producing |I| different carpets with (wi, li, ni), i 2 I, where (wi, li) are the width and length of carpet type i and ni is the ordered amount. There is usually a tolerance, p, in the amounts delivered, hence any number of carpets between [ni(1 p),ni(1 + p)] are acceptable and bought by the customer at full price. For practical purposes, p is taken to be 5% in our calculations. Let there be R different types of looms with Wr being the width of loom type r. Although there are different widths of looms depending on the manufacturer and type of carpet they are suitable for, typical loom widths considered in this work are around 4 m. There is a limit, Nmax, on the maximum number of strips assigned to a loom since the number of knife settings is limited. After the stock is woven, it is transferred to the cutting station by means of carts. Therefore, a too heavy (too long) stock becomes impossible to handle. To deal with this logistic problem, we impose a maximum length on the stock, Lmax. Since the weight depends on the density of the carpet woven, this limit is assignable by the planner. Typical values for Lmax lie between 90 and 100 m. A stock is considered ‘‘reasonable’’ on loom type r if the widthwise emptiness is within the limits [Wr dW, Wr] and the difference between the longest and shortest lengths of strips in the stock is less than or equal to dL. The determination of dW and dL are managerial decisions and any stock beyond these limits is considered unprofitable to manufacture. Typical values for dW and dL are 10 and 40 cm, respectively. The carpet loading problem can be formulated as manufacturing the pre-specified number of carpets on looms with known widths by producing minimum sidewise and lengthwise scrap area. Theorem 2.1. Carpet loading problem is NP-complete. Proof. We prove this by restricting the problem to a special case. This special case happens to be a Partition problem which is NP-complete (Garey & Johnson, 1979). Consider a set ofPorders where widths, wi = W/2 (half width of the single loom length), ni = 1, and li 2 Rþ for all i 2 I, with i2I li =2 6 Lmax . Then, definitely there is no sidewise scrap since the two strips with widths W/2 will span the whole width of the loom. On the 0 other hand, P P minimizing the lengthwise scrap reduces to finding a set I I, which minimizes j i2I 0 li i2II 0 li j. This is the Partition problem, hence the carpet loading problem is NP-complete. h Our solution approach generates all ‘‘reasonable’’ patterns on all loom widths and then solves an integer linear program to find how many times each pattern should be used given the amounts of orders. We will assume that the number of reasonable patterns on loom type r is Jr, r = 1 , . . . , R. In our approach, a pattern represents a two-dimensional arrangement of carpets and hence describes types and amounts of carpets assigned to the loom widthwise and lengthwise. Since the loom width is also known in advance, there is a known area of scrap associated with each pattern.
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
113
3. The enumeration algorithm We perform a two-dimensional enumeration of all (widthwise and lengthwise) patterns in two stages. First, we enumerate all widthwise patterns for all loom widths using the algorithm described in Westerlund et al. (1998), which is originally designed for this purpose. This algorithm considers limits [Wr dW, Wr], Lmax, and also accommodates for the maximum number of knife settings. After finding all widthwise arrangements, for the lengthwise pattern generation, we proceed as follows: for each widthwise pattern, we take the first strip of carpets and find all possible lengthwise patterns within the limits [0, Lmax], with no restriction in the number of knifes. This enumeration generates all possible lengths for the first strip between 0 and Lmax, with a total of J 0r different stock lengths. For all of these lengths Lj ; j 2 f1 . . . J 0r g, and for each other strip in the widthwise pattern, we let the algorithm run again to find the lengths within [Lj dL/2, Lj + dL/2]. After all possibilities are determined for each strip in the stock with length Lj, we take the cross products of all alternatives to generate the final stock patterns for length Lj. As a result of this iterative combinatorial process, Jr possible patterns are generated on loom width r. The exact enumeration algorithm is given in Appendix A. This approach finds all recognizable patterns that are also reasonable and is somewhat similar to the approach mentioned in Gilmore and Gomory (1965) in the sense that it considers all distinguishable pattern lengths. Hence, a pattern denotes a two-dimensional arrangement of carpets on the loom. Since the created patterns have the exact information about the empty areas and the number of carpets of each type produced in the pattern, the rest of the problem is formulated as a pure integer programming problem. 4. The integer programming formulation The enumeration algorithm of Section 3 generates matrices Qr 2 ZJ r jIj describing the number of carpets of each type produced in patterns of loom width r, and vectors sr 2 RJ r describing the total empty area in the patterns, r = 1 , . . . , R. Then the integer program consisting of the objective (1) and constraints (2) minimizes total empty area (scrap) subject to demand constraints. In this formulation xr 2 ZJ r denotes the number of times patterns of loom width r are used. min EmptyArea ¼
R X
< sr ; x r >
ð1Þ
r¼1
s:t: dð1 pÞne 6
R X
ðxr ÞT Qr 6 bð1 þ pÞnc;
ð2Þ
r¼1
xr P 0 and integer;
r ¼ 1; . . . ; R
The <Æ,Æ> in (1) denotes the inner product of two vectors, and n is the vector of order quantities. The dÆe and bÆc in (2) are ceiling and floor functions, respectively. These functions do not affect the solution but increase the efficiency of the integer solver in many cases since (xr)TQr is an integer valued quantity. Furthermore, the sumT mation in (2) should be interpreted as vector addition since ðxr Þ Qr 2 ZjIj gives the amounts of carpet types produced using loom width Wr; hence, the vector summation over r gives the overall total of each carpet type produced. Another objective of interest is to minimize total number of stocks (i.e. total number of setups) to fulfill the order, and it is given in (3). The er here represent vectors of ones with size Jr. Since setting up a loom requires a lot of work attaching yarns, this approach might be desirable in some cases. min NumSetups ¼
R X
T
ðer Þ xr
ð3Þ
r¼1
Although different strategies are available with these two objective functions, our experiments showed that a preemptive approach gives the best combination of empty area and setups in the least amount of time. We solved two integer programs where the first one is in the form of (1) and (2) to minimize total scrap (IP1). Then
114
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
we added (1) as a constraint with an upper bound value found in this problem and solved a second IP using (3) as the objective function (IP2). Since the problem had multiple optimum solutions in almost all cases, this approach favored the one with the minimum number of setups. 5. Numerical results In this section, we present results of experiments performed on a microcomputer with a 3.0-GHz Pentium hyper-threading processor and 512 MB of random access memory. The orders and other data are taken from a major carpet manufacturer in Turkey. We report wall-clock times required to enumerate all patterns and to solve the integer linear programs. There are two types of looms available in the company with the widths 400 and 410 cm, i.e. R = 2. The maximum number of strips that can be woven in a loom, Nmax, is 7. The permitted fluctuation in the ordered numbers, p, is 5% and the maximum stock length is 9000 cm. MATLAB software is used to generate the patterns and GAMS with CPLEX (ILOG:CPLEX, 2006) has been used to solve the integer programs. The MATLAB and GAMS interface by Ferris (1998) has been used to integrate the two systems. In all order groups, a widthwise allowance of 10 cm and a lengthwise allowance of 40 cm has been adopted since these are the numbers used by the company. Table 1 lists the widths, lengths and the ordered amounts for the orders. The solution summary for these problems is given in Table 2. Columns two and three give the number of patterns generated by the pattern generation algorithm and its performance. Fourth and sixth columns list the solution to the integer linear programs, IP1 and IP2. The first integer formulation minimizes the scrap area and the second one minimizes the number of setups (stocks) to produce. The performance of both IPs is given in the last column (in wall-clock
Table 1 Sample orders i
1
2
3
4
5
6
7
8
9
10
11
Order No. 1
wi li ni
300 408 2
250 358 10
200 308 16
170 248 21
140 208 33
80 358 6
80 258 7
80 158 30
70 348 4
70 148 20
50 88 50
Order No. 2
wi li ni
300 508 17
250 358 72
240 328 52
200 298 116
170 263 132
125 208 451
100 208 410
80 208 615
70 158 800
67 128 663
Order No. 3
wi li ni
300 508 8
300 408 10
240 328 52
200 298 116
170 263 132
125 208 451
100 208 408
80 208 533
70 158 692
67 128 596
Order No. 4
wi li ni
300 508 17
250 358 72
240 328 52
200 298 116
125 238 216
125 208 242
100 208 367
80 208 490
70 158 692
67 128 591
Order No. 5
wi li ni
200 308 125
170 264 100
150 238 200
125 208 75
100 308 75
100 208 75
80 308 125
80 158 250
50 88 75
Order No. 6
wi li ni
200 308 36
200 298 36
200 208 52
175 258 99
170 263 132
125 208 487
100 208 407
80 208 531
70 158 742
67 128 658
Order No. 7
wi li ni
200 408 50
200 308 50
200 208 50
200 158 50
170 263 50
125 208 50
100 208 50
80 208 50
70 158 50
67 128 50
Order No. 8
wi li ni
300 508 8
300 408 10
240 328 52
200 298 116
125 208 242
125 188 274
100 208 365
80 208 408
70 158 584
67 128 529
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
115
Table 2 Performance of the generation and solution methodology Order set
Total number of patterns generated
Generation time (s)
Empty area (m2)
Empty area/ total area (%)
Number of setups
Solver time IP1 + IP2 (s)
1 2 3 4 5 6 7 8
2044 1234 1262 4938 15,224 36,240 205,072 6017
173.4 4.8 4.7 15.9 27.1 204.1 9157.5 18.9
0.9120 8.6008 4.8952 7.6432 0.0480 4.8868 1.0240 3.8264
0.325 0.119 0.080 0.127 0.001 0.079 0.060 0.075
10 25 20 22 12 20 7 16
2.7 + 9.9 = 12.6 0.1 + 0.2 = 0.3 0.2 + 0.8 = 1.0 0.4 + 3.4 = 3.8 184.5 + 0.9 = 185.6 4.7 + 738.6 = 743.3 44.5 + 65.6 = 110.1 0.5 + 2.8 = 3.3
seconds). All IPs are solved with a relative tolerance of 10%, hence the IP solutions are at most 10% worse than their best relaxed node, though the solver has found the optimal solution in most of the IP2 problems. The average scrap ratio (empty area/total area woven) for the eight order sets is less than 0.1% which is almost perfect for orders of these sizes, noting the manual scheduling by the experts results in around 1.5– 2% scrap ratios on average. Specifically, order 5 resulted in a little more than 2% scrap ratio by manual scheduling. The complete solution to this sample problem is given in Appendix B. Another problem of interest is order 7 which resulted in a very large number of patterns, and the pattern generation algorithm took more than 2 h.
6. Conclusion In this work, a solution to a practical problem for the carpet weaving industry has been developed and implemented. After the generation of stocks, number of times a stock is woven is determined by solving two relatively simple integer programming problems. The performance of the algorithm on eight real life problems has been illustrated. In general, the whole system can run unattended and the solutions can be obtained in a short period of time (i.e. in the order of seconds) with the current computer and integer programming solver technologies. Moreover, since producing a 100 m stock takes between 8 and 12 h, in general, planning times are fairly small compared to production times. Since the integer linear programs are fairly simple, the performance of the whole procedure depends on the complexity of the order set. In general there is a relationship between the number of patterns generated and generation time, hence the number of patterns can be taken as the complexity of the order set. Due to the combinatorial nature of the pattern generation algorithm, the performance of the generation is adversely affected by the number of carpet types sharing the same width. In addition, since the lengthwise allocation requires combinations of carpet lengths, the algorithm generates a large number of patterns, especially when the maximum stock length is large and the lengths of carpets are small (see for example, Table 2 sample order 7). The procedure can be sped up slightly by making use of the order quantities and by not pursuing patterns that generate more carpets than required, but in general it is a computer intensive approach. On the other hand, it runs very fast on cases where the number of orders for each width is one or two. This should be the case for most real life problems and the algorithm therefore has practical value for a company in the sector and for the whole industry altogether. Since the enumeration algorithm finds all reasonable patterns for a typical order, the resulting schedule can be considered the best among the feasible (and hence the optimal) schedules. It is of course a fact that a too restrictive set of parameters (especially for dW and dL, and partially for Lmax) may turn an order to be infeasible to produce but even in that case, relaxing these numbers and running the enumeration again would not be impractical in many cases. A possible extension to this work would be to be able to predict the complexity of the problem (number of stocks generated and possibly their generation time) when a set of orders is given. This would enable the ana-
116
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
lyst to attack a big problem (e.g. an order with several hundred types of carpets) in chunks of reasonable complexity, which then can be solved using the procedure mentioned in this work. Another improvement would be to allow the generation algorithm to stop without generating all possible patterns, but still sample a good portion of them. If tailored well, this approach can improve the generation times tremendously. Appendix A. Pattern generation algorithm Since different loom widths are processed sequentially, the algorithm is explained for a single width, W. In this illustration, bold figures represent vectors, regular ones represent scalars and capital letters represent matrices. The algorithm relies on the widthwise pattern finding algorithm described in Westerlund et al. (1998); namely, matrices N1, N2, and N3 are generated using that algorithm. Read widthwise and lengthwise allowable emptiness, dW, dL; the loom width, W; the maximum possible length of the stock, Lmax; maximum number of vertical knives, Nmax. Generate N1 = all cutting patterns whose widths are within [W dW, W], honouring Nmax. For each (widthwise) cutting pattern k = 1 to number of rows in N1 Let wk = all non-zero widths in cutting pattern k Let l1 = lengths of orders with width wk(1), O1= order index of l1 Let N2 = all lengthwise patterns with l1, where the length is in [0, Lmax] For j = 1 to number of rows in N2 Let Lj = length of schedule j For i = 2 to length(wk) let li = lengths of orders with width wk(i), Oi = order index of li let N3(i) = all lengthwise patterns with li, in the interval [Lj ± dL/2] if N3(i) is empty break loop (i) and continue with next (j) end if If i == length(wk) (a new schedule is found) Generate the schedule by taking cross products of N3(i)’s using Oi’s, i = 1,. . .,length(wk), and save the schedule End If i End For i End For j End for each cutting pattern k
Appendix B. Solution to sample order 5 In the following solution, each table represents a stock, each column represents a strip in the stock. The numbers to the left of the table show how many times a stock is repeated. The parenthesized numbers in the table denote the dimensions of the carpet (width · length) and the numbers next to them denote how many times it has been repeated lengthwise in the strip. On 400-cm looms: 1·
(100 · 208) · 14
(100 · 208) · 14
(100 · 208) · 14
3·
(150 · 238) · 32
(150 · 238) · 32
(100 · 308) · 20 (100 · 208) · 7
1·
(170 · 264) · 21
(100 · 308) · 18
(80 · 308) · 18
2·
(200 · 308) · 29
(200 · 308) · 29
(100 · 208) · 14
(50 · 88) · 63
M.C. Demir / Computers & Industrial Engineering 54 (2008) 110–117
117
On 410-cm looms: 1·
(125 · 208) · 36
(125 · 208) · 36
(80 · 308) · 24
(80 · 158) · 48
1·
(170 · 264) · 14
(80 · 308) · 12
(80 · 308) · 12
(80 · 308) · 12
1·
(170 · 264) · 29
(80 · 308) · 11 (80 · 158) · 27
(80 · 308) · 11 (80 · 158) · 27
(80 · 308) · 11 (80 · 158) · 27
1·
(170 · 264) · 31
(80 · 308) · 4 (80 · 158) · 44
(80 · 308) · 4 (80 · 158) · 44
(80 · 308) · 4 (80 · 158) · 44
1·
(200 · 308) · 4
(80 · 308) · 4
(80 · 308) · 4
(50 · 88) · 14
References Demir, M. C., Sencar, I., Ergen, I., Serli, U., Kaya, M., & Yiicel, F. (2004). Usage of heuristics and ILP on carpet loom loading (in Turkish). In OR/IE international conference, Gaziantep, Turkey. Demir, M. C., & Kulak, O. (2005). An enumeration-ILP based approach to the carpet assignment problem. In Proceedings of the 35th international conference on computers and industrial engineering. Turkey: Istanbul. Ferris, M. C. (1998). MATLAB and GAMS: Interfacing optimization and visualization software. Technical Report 98-19. USA: University of Wisconsin-Madison, Mathematical Programming Group. Garey, M. R., & Johnson, D. S. (1979). Computers and intractability, a guide to the theory of NP-completeness. Bell Telephone Laboratories, Incorporated. Gilmore, P. C., & Gomory, R. E. (1961). A linear programming approach to the cutting stock problem. Operations Research, 9, 849–859. Gilmore, P. C., & Gomory, R. E. (1963). A linear programming approach to the cutting stock problem – part II. Operations Research, 11, 863–888. Gilmore, P. C., & Gomory, R. E. (1965). Multistage cutting stock problems of two and more dimension. Operations Research, 13, 94–120. ILOG:CPLEX (2006). CPLEX 10.0 User’s manual and reference manual. ILOG Inc. Lodi, A., Martello, S., & Monaci, M. (2002). Two-dimensional packing problems: A survey. European Journal of Operational Research, 141, 241–252. Sweeney, P. E., & Paternoster, E. R. (1992). Cutting and packing problems. a categorized, application-oriented research bibliography. Journal of Operational Research Society, 43, 691–706. Westerlund, T., Isaksson, J., & Harjunkoski, I. (1998). Solving a two-dimensional trim-loss problem with MILP. European Journal of Operational Research, 104, 572–581.