Heuristics Algorithms Based on a Linear Programming for the Three-Dimensional Bin-Packing Problem

Heuristics Algorithms Based on a Linear Programming for the Three-Dimensional Bin-Packing Problem

Heuristics Algorithms Based on a Linear Programming for the Three-Dimensional Bin-Packing Problem Mhand Hifi ∗ Imed Kacem ∗∗ Stephane Negre ∗ Lei Wu ∗...

115KB Sizes 0 Downloads 46 Views

Heuristics Algorithms Based on a Linear Programming for the Three-Dimensional Bin-Packing Problem Mhand Hifi ∗ Imed Kacem ∗∗ Stephane Negre ∗ Lei Wu ∗ ∗

Universite Picardie Jules Vernes, MIS, rue Saint Leu, Amiens, France (e-mail: {hifi, stephane.negre, lei.wu}@ u-picardie.fr). ∗∗ Universite Paul Verlaine - Metz. Address: LITA, UFR M.I.M, Ile du Saulcy 57000, Metz. (e-mail: [email protected]) Abstract: In this paper we consider the three-dimensional bin packing problem (3D-SBSBPP) under the assumption that all the bins are of a single size. Such a problem is a well-known NP-hard problem and consists in packing a set of items in a minimal number of bins. First, we introduce a mixed-integer linear model to formulate the problem (MILP1). Some special valid inequalities are used in order to improve the relaxed lower bound (LB) of MILP1. Then, we introduce some new heuristics to compute upper bounds by solving a sequence of single bin filling problems. Finally, we present our exprimental results to evaluate the proposed algorithms. Keywords: Optimization problems, mathematical programming, heuristics, algorithms. 1. INTRODUCTION In this paper, we consider the three-dimensional binpacking problem when the bins are identical. Such a problem consists in packing a set of items (boxes) in a minimal number of identical bins (containers), where all the items and bins are characterized by three dimensions: width, height and depth. We assume that the orientation of items is fixed, which means that each face of a fitted item is parallel to the corresponding bin face. Furthermore, each item is supposed to be orthogonally packed in the bin. By following the helpful typology developed by Wascher et al (2007), the problem which will be studied in this paper can be named as three-dimensional single bin-size bin packing problem (3D-SBSBPP). The so-called problem is strongly NP-hard due to the fact that it is a generalization of the well-known (one-dimensional) bin packing problem in which two of three dimensions of items and bins are set to 1 (1D-BPP or 1D-SBSBPP), see Martello and Toth (1990). Another famous special case of 3D-SBSBPP is the 2D-SBSBPP (the two-dimensional case). 2D-SBSBPP was widely studied during the last years (Lodi et al, 2002a). Its real problems arise in several areas (textile, logistics, manufacturing...). However, 3D-SBSBPP is generally more close to the real industrial problems. According to the best of our knowledge, few exact algorithms for 3D-SBSBPP have been published. The first review on this topic was published in Martello et al (2000), in which a lower bound and an exact approach for the 3DSBSBPP have been introduced. Then, Fekete and Schepers (2001) proved that their lower bounds dominate Martello et al’s, and in Fekete and Schepers (2007) they introduced an exact algorithm following the outline of Martello et al. Then, Boschetti (2004) introduced some improved lower bounds. Unfortunately, it is not easy to extend these

bounds to some situations we consider in this paper. For this reason, we aim in this study to construct a more adaptive approach based on an integer-linear programming. Contrary to the existing constructive heuristics, such as (next, first, best)-fit and bottom-left-back method, we could integrate the practical issues in such a linear model designed for the 3D-SBSBPP by writing them as inequalities. Note that many different linear models have been designed for this family of problems (see for instance Bekrar and Kacem (2009), Gilmore and Gomory (1961), Puchinger and Raidl (2007), Jin el al (2003), Egeblad and Pisinger (2009) and Valério de Carvalho (2002)). Finding an optimal solution for these models is generally strongly NP-hard, and in most of cases they need to be enhanced by adding valid inequalities. This paper is organized as follows. In section 2, we first present two mixed-integer linear programming (MILP) models to both 3D-SBSBPP and 3D-SKP. Section 3 describes the upper bound we propose. The experimental results are discussed in Section 4. 2. MIXED INTEGER LINEAR PROGRAMMING MODELS Our problem consists in packing a set of n rectangular items into a set of identical bins. Every item i (i = 1, 2, ..., n) is characterized by a width wi , a height hi and a depth di (i = 1, 2, ..., n) while the bins have the same width W , the same height H, and the same depth D. We have to find a feasible packing with the aim of minimizing the number of the used bins. We start with a sufficient number of bins (an upper bound) γ (γ ≤ n). We define the vector (xi , yi , zi , γ i ) as the geometrical location of item i, where xi ≥ 0, yi ≥ 0, zi ≥ 0 and γ i ≥ 1 (i = 1, · · · , n). We use (xi , yi , zi ) to denote the left-bottom-back coordinate of item i while we assume that the coordinate of left-bottom-

back corner of the bin is (0, 0, 0). γ i is defined as the label of the bin to which item i is assigned (i = 1, · · · , n). To find an optimal solution for the 3D-SBSBPP, we have therefore to minimize the largest label of the used bin, that is max{γ 1 , · · · , γ n }.

xi −xj +W (lij −cij −cji ) ≤ W −wi (i = j = 1, · · · , n) (8) yi −yj +H(uij −cij −cji ) ≤ H −hi (i = j = 1, · · · , n) (9)

2.1 Mixed integer linear programming formulation for the 3D-SBSBPP

zi −zj +D(bij −cij −cji ) ≤ D−di (i = j = 1, · · · , n) (10)

In this subsection we will present a linear model of the 3D-SBSBPP. This model is based on the following two observations:

γ i − γ j + γcij ≤ γ − 1 (i = j = 1, · · · , n)

1) no item may exceed the bin; 2) no two packed items overlap. The first property can be obviously ensured by the following inequalities: (xi + wi ≤ W ) ∧ (yi + hi ≤ H) ∧ (zi + di ≤ D) (1) Unfortunately, there is no standard formulation for the second one. In the models of Jin et al (2003) and Egeblad et al (2009), the binary variables were introduced to indicate relative positions between two items. Therefore, to guarantee a feasible packing of items i (i = 1, · · · , n), we need to verify the following equality: lij +lji +uij +uji +bij +bji +cij +cji = 1, ∀i = j = 1, · · · , n (2) where • lij = 1if item i is in the left of item j (i = j = 1, · · · , n) • uij = 1 if item i is under item j (i = j = 1, · · · , n) • bij = 1 if item i is in the back of item j (i = j = 1, · · · , n) • cij = 1 if γ i < γ j (i = j = 1, · · · , n). Consequently, we have the following logical relationships: lij uij bij cij

=1 =1 =1 =1

=⇒ =⇒ =⇒ ⇐⇒

xi + wi ≤ wj yi + hi ≤ hj zi + di ≤ zj γi < γj .

(3) (4) (5) (6)

It is still worthy to notice that one cannot deduce the value of lij (resp. uij , bij ) by means of xi and xj (resp. yi and yj , zi and zj ). This is due to the fact that two items i and j may be assigned to two different bins. Hence, we cannot conclude that item i stays in the left of item j even if the condition xi + wi ≤ wj holds, and the same reasoning for the other dimensions is valid. However, we can deduce the value of cij from γ i and γ j or the relationship between γ i and γ j from cij (i = j = 1, · · · , n). To summarize, the Mixed Integer Linear Programming of 3D-SBSBPP, noted as MILP1, can be stated as follows: (MILP 1)

min

γ

lij +lji +uij +uji +bij +bji +cij +cji = 1 (i < j = 1, · · · , n) (7)

(11)

lij , uij , bij , cij ∈ {0, 1} (i = j = 1, · · · , n) 0 ≤ xi ≤ W − wi (i = 1, · · · , n) 0 ≤ yi ≤ H − hi (i = 1, · · · , n) 0 ≤ zi ≤ D − di (i = 1, · · · , n) 1 ≤ γ i ≤ γ ≤ γ (i = 1, · · · , n) As we explained before, the condition that no overlap between two packed items is guaranteed by constraints (7, 8, 9, 10). Constraints (11) implies that when cij = 1 or cji = 1, items i and j are located in different bins and that when one of variables lij , lji , uij , uji , bij , bji is equal to 1, items i and j are necessarily located in the same bin. The parameter γ is a valid upper bound of γ. γ can be evaluated by using a fast heuristic, for instance, WallBuilding heuristic which was first proposed by George and Robinson (1980). Finally, we precise that this model has been improved in our previous work (Hifi et al (2010)) by adding a set of valid inequalities based on the work of Bekrar and Kacem (2009). It is well-known that it is not practical to entirely solve MILP1. For this reason, we return our attention to solve MILP1 stage by stage: we first try to find a feasible solution, and then, with starting from this node, we try to find an improved solution. 2.2 Mixed integer linear programming formulation for the 3D-SKP This model allows to pack a subset of items into a fixed bin by maximizing the used volume. With the similar notations as in MILP1, the linear model for the 3D-SKP (denoted as MILP2) is formulated as follows: (M ILP 2)

max

n 

pi si

i=1

lij +lji +uij +uji +bij +bji ≥ si +sj −1 (i < j = 1, · · · , n) (12) 2(lij +lji +uij +uji +bij +bji ) ≤ si +sj (i < j = 1, · · · , n) (13)

xi − xj + W lij ≤ W − wi (i = j = 1, · · · , n)

(14)

yi − yj + Huij ≤ H − hi (i = j = 1, · · · , n)

(15)

zi − zj + Dbij ≤ D − di (i = j = 1, · · · , n)

(16)

0 ≤ xi ≤ (W − wi )si (i = 1, · · · , n)

(17)

0 ≤ yi ≤ (H − hi )si (i = 1, · · · , n)

(18)

0 ≤ zi ≤ (D − di )si (i = 1, · · · , n)

(19)

lij , uij , bij ∈ {0, 1} (i = j = 1, · · · , n) si ∈ {0, 1} (i = 1, · · · , n) The binary variables si (i = 1, · · · , n) is used to indicate whether item i is assigned to the bin. The inequalities (12) guarantee that two items i, j located in the bin will not overlop. To be consistent, the introduced inequalities (13) imply that one and only one relative position between two items will be fixed while they are assigned to the bin. We introduce the constraints (17, 18 and 19) to make MILP1 coherent: if item i is not assigned to the bin, its coordinate will be set to zero. We set pi = wi hi di (the volume of item i) since our aim is to maximize the total space used by packing items in the bin. As it will be presented in the next section, MILP2 will be used to solve a single filling bin problem in order to construct a feasible solution for MILP1. 3. UPPER BOUNDS FOR THE 3D-SBSBPP The basic scheme of our algorithm follows the framework of Martello et al (2000). We attempt to find a feasible (or optimal) solution for the 3D-SBSBPP by filling a sequence of single bins (or by solving a sequence of 3DSKP). MILP1 has always a trivial solution — each item is assigned to a single bin, therefore the number of used bins equals to the total number of items. When we set γ to the upper bound calculated by heuristic Wall-Building, finding a feasible solution of MILP1 with a such upper bound becomes computationally difficult. Of course, by using an exact method, such as branch-and-bound or branch-andcut algorithms, we can find an optimal solution when the tree search is explored. Unfortunately, when the number of items increases, the computation time becomes very long. This can be also explained by the great number of solutions we can associate to the same value of the objective function. For example, given a feasible packing P , the total number of used bins will not change when we exchange labels of all used bins. With respect to the change of the order of bins, the values of cij and γ i will be diversified. Recall that, cij is set to 1 if γ i < γ j . In conclusion, the tree search includes a huge number of unuseful nodes. Nevertheless, this observation also implies that the order of the bins has no impact on a feasible

Algorithm 1. Procedure Set-Candidates()

DATA γ i : continuous solution returned by solving LP-relaxation of (P1); N : critical number of candidates; Rounding (γ i ): γ i = ⌊γ i ⌋; CS: Candidates Set; INSTRUCTIONS Initialization: CS = ∅; Rounding (γ i ); Calculate the number of items which have the same label; Sort the label γ ′ associated with the most no-packed items; Chose items which are labeled by γ ′ as the candidates; Chose a core among these candidates; IF(candidate i cannot stay with the core), Then Give up i; END IF Sort the items which are not in SC in nondecreasing order of volume; WHILE(Total number of Candidates < N ): Adding the items have not been selected to CS. END WHILE WHILE(Total number of Candidates > N ): Removing the items have been selected from CS. END WHILE IF(Total number of Candidates = N): Return CS. END IF packing. By taking into account this aspect, we try to solve P1 (i.e., 3D-SBSBPP) one bin by one bin. We select the candidates to be packed in a greedy manner. More precisely, in each single bin packing, we aim to determine the set of candidates by selecting the items with the label which is supported by the most no packed items. SetCandidates() (1) is the so-called function which allows us to return a set of candidates. Indeed, a sequence of resolutions of P2 (i.e., 3D-SKP) can be considered as a local search of (P1). In each single bin packing, we attempt to maximize the total volume of items which can be loaded with the core item. The core item can be chosen by respecting the following rules: a) If the candidate set includes item i which belongs to Set-Isolates, we set item i as the core; b) If the candidate set includes no one of elements in Set-Isolates, we set the biggest current items as the cote. 4. COMPUTATIONAL EXPERIMENTS In order to test MILP1, we adopt the 9 groups random instances described by Martello et al (2000). The first five groups structured by Martello and Vigo can be generated as follows: • mvp-1: bin size W = H = D = 100; items with wi ∈ [1, 21 W ], hi ∈ [ 32 H, H] and di ∈ [ 32 D, D]. • mvp-2: bin size W = H = D = 100; items with wi ∈ [ 32 W, W ], hi ∈ [1, 21 H] and di ∈ [ 32 D, D]. • mvp-3: bin size W = H = D = 100; items with wi ∈ [ 32 W, W ], hi ∈ [ 23 H, H] and di ∈ [1, 23 D].

Algorithm 2. Heuristic Greedy Packing (n, m)

DATA n: total number of items; m: m ≥ n, total number of items; (lij , uij , bij , cij ): decision variables to be fixed; LP (xi , yi , zi , γ i ): solution returned by solving LPrelaxation of (P1); LPSP(1) (lij , uij , bij , cij ): solves LP-relaxation of (P1); List-fixed: list of the items which have been already fitted; Wall-Building(n, m): returns an upper bound; Test-All-placed(): returns 1, if all items have been placed, else returns 0; Set-Candidates(LP (xi , yi , zi , γ i )): selects items to be packed in a single bin; SP(2) (lij , uij , bij , CS): solves (P2) and returns a feasible packing F P S; Generate-Cuts(): generates all valid inequalities introduced in Hifi et al (2010). INSTRUCTIONS (xi , yi , zi , γ i ), i = 1, · · · , n: a feasible packing using γ bins; Initialization: γ = 1 and γ = Wall-Building(n, m); Generate-Cuts(); WHILE(Test-All-placed(List-fixed) = 0) IF(γ = γ) and (Test-All-placed() = 0)) γ = γ + 1; Generate-Cuts() and solve (P1); END IF LP (xi , yi , zi , γ i ) = LPSP(1) (lij , uij , bij , cij ); CS = Set-Candidates (LP (xi , yi , zi , γ i )); F P S = SP(2) (lij , uij , bij , CS); Assign F P S to the current bin γ; Set List-fixed; γ = γ + 1; END WHILE • mvp-4: bin size W = H = D = 100; items with wi ∈ [ 21 W, W ], hi ∈ [ 12 H, H] and di ∈ [ 21 D, D]. • mvp-5: bin size W = H = D = 100; items with wi ∈ [1, 12 W ], hi ∈ [1, 21 H] and di ∈ [1, 12 D]. For group k (k = 1, · · · , 5), each item is of type k with probability 60% and of the other four types with probability10%. It is important to note that mvp-1, mvp-2 and mvp-3 generate a lager rate of special shape items whose two of their dimensions are larger than 50% of the corresponding dimension of the bin. In other words, this kind of items can be fitted along only one dimension. The next group of classes is a generalization of the instances described by Berkey and Wang (1987). The three classes have been defined as: • mvp-6: bin size W = H = D = 10; items with wi , hi , di ∈ [1, 10]. • mvp-7: bin size W = H = D = 40; items with wi , hi , di ∈ [1, 35]. • mvp-8: bin size W = H = D = 100; items with wi , hi , di ∈ [1, 100]. Finally, the last class (mvp-9) has been generated in a all-fill way. The items are generated by decomposing a large item which is identical to the bin in a set of small items. Thus, these classes have a known optimal solution corresponding to the number of the large items used in the

decomposition. Furthermore, for this type of instances, the continuous bound is equal to optimal solution. The exact code was implemented in the C++ Language and the Cplex 11.20 Solver was used to solve the MILP2. The experiments were run on an UltraSparc10 machine (of 250 Mhz processor speed and with 1 Gb of RAM). The results of our experiments are shown in table (2). We limited the time spent to solve a single filling bin problem as: 100 seconds for |CS| = 10, 200 seconds for |CS| = 20 and 300 seconds for |CS| = 30, where |CS| is the cardinal number of Candidates Set. With respect to the computational effort required to solve the MILP2, we limited the maximal value of CS to 30 items over all instances. In table (1) we summarize the average deviation of the upper bound U found by algorithms H1 and H2 (cf. Martello et al, 2000) with respect to the best lower bound value L2 (cf. Martello et al, 2000), computed over all instances. From these results, we can observe that the quality of the lower bound (repspectively, the upper bound) strongly depends on the presence of the large item. For instance, in Class 4 which contains a sufficient number of large items, we always successfully both find nice lower and upper bounds.

n 10 15 20 25 30 35 40 45 50 60 70 80 90

1 8.3 16.5 19.2 13.2 16.8 15.7 16.1 15.6 17.4 15.2 14.9 17.0 13.4

2 15.0 18.3 14.5 14.0 15.7 11.6 14.7 12.5 14.4 15.6 14.8 14.9 14.0

3 29.2 22.0 27.7 18.7 16.6 15.5 17.3 12.1 17.1 14.0 15.8 12.8 13.8

4 2.5 1.1 0.8 2.4 3.9 2.5 2.2 3.2 3.5 2.8 3.6 2.7 3.4

Class 5 30.0 47.5 26.7 23.7 22.3 18.1 34.1 25.2 31.6 33.3 31.0 32.6 30.1

6 28.3 30.7 20.5 20.2 20.2 25.0 19.3 23.0 25.6 23.5 24.1 22.5 21.3

7 48.3 19.2 25.8 30.8 37.5 33.5 39.4 45.6 33.7 41.0 47.2 37.9 45.0

8 25.0 23.3 18.3 21.8 25.9 28.1 28.1 30.4 35.2 23.3 32.2 35.2 32.8

9 0.0 0.0 6.7 30.0 40.0 40.0 53.3 56.7 66.7 60.0 83.3 93.3 103.3

Table 1. Average deviation of Umvp with respect to L2 . The bold-face numbers in the table (2) means that we have the better results than Martello et al’s. We can easy notice that our algorithm is in the dry tree over the first three groups of instances. REFERENCES [1] Bekrar, A., Kacem, I., (2009) An exact method for the 2D guillotine strip packing problem. Advances in Operations Research volume 2009, article ID 732010, 20 pages [2] Boschetti, M.A., (2004) New lower bounds for the three-dimensional finite bin packing problem. Discrete Applied Mathematics 140(1) 241-258 [3] Davies, A.P., Bischoff, E.E., (1999) Weight distribution considerations in container loading. European Journal of Operational Research 114 (3) 509-527

n 10

1 3.3

2 5.8

3 15.0

4 0.0

Class 5 6 10.0 25.8

15 20 25 30 35 40 45 50

19.0 24.8 21.4 19.1 19.0 28.7 26.7 19.6 20.4 16.4 20.6 17.5

20.3 19.6 27.5 28.0 23.6 18.6 19.7 18.3 18.4 20.3 18.6 15.9

20.3 23.5 21.5 24.8 23.1 19.2 22.3 17.5 14.0 18.4 14.1 18.2

0.0 0.0 1.3 1.1 2.9 0.9 1.2 0.7 2.8 0.5 0.8 0.9

10.8 11.2 15.8 19.5 32.6 19.0 17.0 18.1 33.3 26.4 37.9 20.4

70 80 90

12.8 13.0 26.6 26.7 19.1 22.5 23.5 18.7 23.5 21.8 20.5 19.2

7 5 .0 21.6 11.6 27.0 21.5 27.3 24.5 36.8 23.3 41.0 25.2 39.7 31.9

8 16.7

9 0.0

20 19.8 14.6 19.4 27.9 17.6 24.4 21.3 23.3 17.1 21.3 24.1

0.0 0.0 3.3 36.6 43.3 56.7 50 66.7 60.0 73.3 83.3 93.3

Table 2. Average deviation of our upper and lower bounds. [4] Dell’Amico, M., Martello, S., (1995) Optimal scheduling of tasks on identical parallel processors. ORSA J. Comput. 7(2) 191-200 [5] Egeblad, J., Pisinger, D., (2009) Heuristic approaches for the two- and three-dimensional knapsack packing problem. Computers & Operations Research 36(4) 1026-1049 [6] Fekete, S.P., Schepers, J., (2004) A combinatorial characterization of higher-dimensional orthogonal packing. Mathematics of Operations Research 29(2) 353-368 [7] Fekete, S.P., Schepers, J., (2001) New classes of lower bounds for bin packing problems. Mathematical Programming 91(1) 11-31 [8] Fekete, S.P., Schepers, J., van der Veen, J.C., (2007) An Exact Algorithm for Higher-Dimensional Orthogonal Packing Operations Research 55(3) 569—587 [9] George, J.A., Robinson, D.F., (1980) A heuristic for packing boxes into a container. Computers & Operations Research 7(3) 147-156 [10] Gilmore, P.C., Gomory, R.E., (1961) A Linear Programming Approach to the Cutting-Stock Problem. Operations Research 9(6) 849—859 [11] Gomory, R.E., (1963) An algorithm for integer solutions to linear programs. Recent Advances in Mathematical Programming, R.L. Graves and P. Wolfe eds., McGraw-Hill, New York, 269—302 [12] Hifi, M., Kacem, I., Nègre, S., Wu, L., (2010) A Linear Programming Approach for the Three-Dimensional Bin-Packing Problems. Electronic Notes in Discrete Mathematics (to appear) [13] Jin, Z., Ito, T., Ohno, K., (2003) The threedimensional bin packing problem and its practical algorithm, JSME International Journal Series C 46(1) 60-66 [14] Lodi, A., Martello, S., Monaci, M., (2002a) Twodimensional packing problems: A survey. European Journal of Operational Research 141(2) 241-252 [15] Lodi, A., Martello, S., Vigo, D., (2002b) Heuristic algorithms for the three-dimensional bin packing problem. European Journal of Operational Research 141(2) 410-420 [16] Martello, S., Pisinger, D., Vigo, D., (2000) The threedimensional bin packing problem. Operations Research 48(2) 256-267

[17] Martello, S., Toth, P., (1990) Knapsack Problems: Algorithms and Computer Implementations, John Wiley and Sons, Chichester. [18] Puchinger, J., Raidl, G.R., (2007) Models and algorithms for three-stage two-dimensional bin packing. European Journal of Operational Research 183(3) 1304—1327. [19] Valério de Carvalho, J.M., (2002) LP models for bin packing and cutting stock problems. European Journal of Operational Research 141 (2) 253—273. [20] Wascher, G., Haussner, H., Schumann, H., (2007) An improved typology of cutting and packing problems. European Journal of Operational Research 183(3) 1109-1130