Algorithm 864 General and RobotPackableVariantsOfTheThreeDimensi...
Algorithm 864 General and RobotPackableVariantsOfTheThreeDimensi...
net/publication/220492665
CITATIONS READS
47 903
5 authors, including:
14 PUBLICATIONS 141 CITATIONS
Philips
139 PUBLICATIONS 3,734 CITATIONS
SEE PROFILE
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
EURO, the Association of Operational Research Societies within IFORS View project
All content following this page was uploaded by Jan Korst on 21 May 2014.
We consider the problem of orthogonally packing a given set of rectangular-shaped boxes into the
minimum number of three-dimensional rectangular bins. The problem is NP-hard in the strong
sense and extremely difficult to solve in practice. We characterize relevant subclasses of packing
and present an algorithm which is able to solve moderately large instances to optimality. Extensive
computational experiments compare the algorithm for the three-dimensional bin packing when
solving general orthogonal packings and when restricted to robot packings.
Categories and Subject Descriptors: G.4 [Mathematical Software]: Algorithm design and anal-
ysis; G.2.1 [Discrete Mathematics]: Combinatorics—Combinatorial algorithms
General Terms: Algorithms, Experimentation
Additional Key Words and Phrases: Bin packing, exact algorithms, constraint programming,
branch-and-bound
S. Martello and D. Vigo were supported by the Italian Ministry of Education, University and Re-
search (MIUR).
D. Pisinger thanks The Danish Natural Science Research Council (SNF) for the support of this
project.
Authors’ current addresses: S. Martello and D. Vigo, DEIS, University of Bologna, Viale
Risorgimento 2, 40136 Bologna, Italy; email: {smartello,dvigo}@deis.unibo.it; D. Pisinger,
DIKU, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen, Denmark; email:
[email protected]; E. den Boef, Quintiq, Goudsbloemvallei 12-28 5237, MJs-Hertogenbosch, The
Netherlands; email: [email protected]; J. Korst, Philips Research Laboratories Eind-
hoven, Building WY 2.23, Prof. Holstlaan 4, 5656 AA Eindhoven, The Netherlands; email: jan.
[email protected].
Permission to make digital or hard copies of part or all of this work for personal or classroom use is
granted without fee provided that copies are not made or distributed for profit or direct commercial
advantage and that copies show this notice on the first page or initial screen of a display along
with the full citation. Copyrights for components of this work owned by others than ACM must be
honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers,
to redistribute to lists, or to use any component of this work in other works requires prior specific
permission and/or a fee. Permissions may be requested from Publications Dept., ACM, Inc., 2 Penn
Plaza, Suite 701, New York, NY 10121-0701 USA, fax +1 (212) 869-0481, or [email protected].
C 2007 ACM 0098-3500/2007/03-ART7 $5.00. DOI 10.1145/1206040.1206047 http://doi.acm.org/
10.1145/1206040.1206047
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
2 • S. Martello et al.
1. INTRODUCTION
The Three-Dimensional Bin Packing Problem asks for an orthogonal packing
of a given set of rectangular-shaped boxes into a minimum number of three-
dimensional rectangular bins. Each box j ( j = 1, . . . , n) is characterized by a
width w j , height h j , and depth d j . An unlimited number of identical three-
dimensional bins, having width W , height H, and depth D is available. The
boxes have fixed orientation, that is, they may not be rotated, but no further
restriction is imposed. Such packings will be hereafter denoted as general pack-
ings. Without loss of generality, we assume in the following that all input data
is positive integers. Coordinates originate from the bottom-left-behind corner
of a bin, and (x j , y j , z j ) is the point where the bottom-left-behind corner of box
j is positioned.
The problem has several industrial applications in cutting and loading con-
texts. The reader is referred to Dyckhoff et al. [1997] for an annotated bibliog-
raphy on this subject, and to Lodi et al. [2002a, 2002b] for recent surveys.
In some relevant practical applications, it is demanded that the boxes can be
obtained from the bin through a sequence of guillotine cuts, that is, face-to-face
cuts parallel to the faces of the bin: these packings are said to be guillotine cut-
table. In other industrial contexts, boxes have to be packed by robots equipped
with a “hand” parallel to the base of the bins, which is covered with vacuum
cells for lifting the boxes. When the boxes have to be palletized or packed into
a container that is open from three sides while loading, the robot is usually
located at one of the corners. To simplify the packing operations, and to avoid
collisions between the hand and the boxes, it can be demanded that no al-
ready packed box be positioned in front of, right of, or above the destination
of the current box: a robot packing is a packing which can be achieved by suc-
cessively placing boxes starting from the bottom-left-behind corner, and such
that each box is in front of, right of, or above each of the previously placed
boxes.
Note that each guillotine-cuttable packing is also a robot packing. Consider
a guillotine-cuttable packing and a feasible sequence (tree) of cuts: by first
packing the boxes in the bottom, left, or back part (depending on the cutting
direction) of each cut, a feasible robot packing is obtained. The converse is not
true, that is, not all robot packings are guillotine cuttable, and some sets of
items can be robot packable even though they are not guillotine cuttable, as
shown by the example depicted in Figure 1.
Martello et al. [2000] proposed a branch-and-bound algorithm for the three-
dimensional bin packing problem. den Boef et al. [2005] have shown that this
algorithm correctly solves the robot packing variant of the problem, but does
not generate all orthogonal packings, thus possibly failing the detection of an
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
Algorithm 864: Variants of Three-Dimensional Bin Packing Problem • 3
Fig. 1. A two-dimensional robot packing that is not guillotine cuttable. The four items cannot be
packed in the given square bin so as to be guillotine cuttable.
2. THE ALGORITHM
The algorithm is based on the two-level decomposition approach presented by
Martello and Vigo [1998] for the two-dimensional bin packing problem. A main
branching tree assigns the boxes to the bins, without specifying their actual
position. The actual feasibility of this assignment is then checked by an inner
level. The boxes are initially sorted by nonincreasing volume.
The lower bound used by the algorithm is L2 , whose detailed description is
given in Martello et al. [2000]. Bound L2 is determined through three lower
bound computations, each relative to a different dimension of bins and boxes.
Consider, say, the depth, and let p ≤ W/2 and q ≤ H/2 be two given threshold
values. The corresponding bound LWH 2 ( p, q) is obtained by extracting from the
box set three subsets of boxes: (i) very large (those with w j > W − p and
h j > H − q); (ii) large (among the remaining boxes, those with w j > W/2
and h j > H/2); (iii) small (among the remaining boxes, those with w j ≥ p and
h j ≥ q). The other (smaller) boxes are disregarded. The bound is then computed,
on the basis of the depths of the considered boxes, by determining, through
a simpler bound LWH 1 , the minimum number of bins needed to allocate the
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
4 • S. Martello et al.
large and very large boxes, as well as the minimum number of additional bins
needed for the small ones. Lower bound LWH 2 is then the maximum LWH 2 ( p, q)
value, computed over all ( p, q) pairs. The two other bounds, LWD 2 (respectively
LHD
2 ) are obtained in the same way, by interchanging h j (respectively w j ) with
d j and H (respectively W ) with D, thus providing the overall bound L2 =
max{LWH 2 , L2 , L2 }.
WD HD
At the root node, we execute in sequence two heuristic algorithms, H1 and H2,
whose detailed descriptions are given in Martello et al. [2000]. Algorithm H1 is
based on a level approach where a number of layers of dimension W × H × d ,
(d ≤ D) are constructed: the resulting layers are then combined into full bins
of depth D by solving a one-dimensional bin packing problem defined on the
depths of the layers. Algorithm H2 is a greedy approach which fills every bin
as far as possible, by heuristically solving a single-bin filling problem in which
the objective is to maximize the volume filled. These algorithms can produce
different solutions by rotating the dimensions of bins and boxes; hence the
computations are performed three times, and the best solution is selected as
the incumbent. If lower bound L2 does not prove that this solution is optimal,
the enumeration begins.
The search is recursively performed, following a depth-first strategy, by an
algorithm called rec binpack. At each decision node, let u denote the incumbent
solution value and M = {1, . . . , m} the set of bins used to allocate boxes in the
ascendant nodes. A bin of M is called open if further boxes may be possibly
placed into it; otherwise it is called closed. The branching phase assigns the
next free box, in turn, to all the open bins; in addition, if |M | < u − 1 the box is
also assigned to a new bin (hence opening it).
As previously mentioned, the exploration of a generated node requires
checking the actual feasibility of the associated assignment. This is performed
by an algorithm called onebin decision. Assume that the node has assigned
a box k to a bin i already containing a nonempty subset J of boxes such that
j ∈J ∪{k} w j h j d j ≤ W H D. The subproblem of establishing whether J ∪ {k}
can be packed into a single bin is in itself NP-hard. We solve it through the
following steps.
(1) Compute lower bound L2 for the subproblem;
(2) if L2 > 1 then fathom the node (no feasible packing exists); otherwise,
(3) if robot packing is desired then
(3.1) execute, for the subproblem, a branch-and-bound search to enumer-
ate all single-bin robot packings through algorithm onebin robot, de-
scribed in detail in Section 3.1; otherwise, that is, if general packing
is desired,
(3.2) execute, for the subproblem, algorithm onebin general, a constraint
programming-based approach described in detail in Section 3.2, to
enumerate all possible packings;
(4) if a single-bin packing is found, accept the assignment; otherwise, fathom
the node.
When the assignment of box k to bin i is accepted, an attempt is made to
close bin i. To this end, for each unassigned box k , we compute lower bound
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
Algorithm 864: Variants of Three-Dimensional Bin Packing Problem • 5
L2 for the subinstance defined by the boxes of J ∪ {k} ∪ {k }. If L2 > 1 for each
k , then we know that no further box can be placed into i and we close the
bin. If this fails, let K be the subset of those unassigned boxes k for which
we have obtained L2 = 1: if heuristic H1 or H2 finds a single-bin solution for
the subinstance defined by the boxes in J ∪ {k} ∪ K , then we know that no
better placing is possible for these boxes, so we assign all of them to bin i and
close it.
Whenever a bin is closed, lower bound L2 is computed for the instance defined
by all the boxes not currently assigned to closed bins: if u ≤ L2 + c, where c is
the number of closed bins, we backtrack.
Fig. 2. Envelope for the robot-packing single-bin filling. Black dots show the corner points for
future box insertions. Dotted lines show an encapsulated volume that cannot be used.
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
Algorithm 864: Variants of Three-Dimensional Bin Packing Problem • 7
while x j is set to zero if we maximize over the empty set. The algorithm runs in
O(n2 ) time since the topological ordering takes O(n2 ) time, and the assignment
of coordinates can be done in O(n2 ) time as there are O(n2 ) relations l, r. If
x j + w j > W for some j then box j exceeds the bin, and we backtrack.
To further speed up the solution algorithm, domain reduction and constraint
propagation are applied. Domain reduction is obtained by the Forward Check
(FC) approach proposed by Haralick and Elliot [1980]. Having chosen a relation
between boxes i and j , we may remove all other relations from M ij as we know
that only one relation needs to be chosen.
We use the Maintaining Arc Consistency (MAC) approach proposed by
Gaschnig [1979] to propagate the chosen constraints. The MAC algorithm is
a more sophisticated FC algorithm which at any step keeps the problem arc
consistent. The present problem is arc consistent if for all possible assign-
ments of a relation between two boxes i and j there is a feasible assign-
ment of coordinates to the boxes such that all constraints are satisfied. If this
is not possible then the relation is removed from the domain of M ij . In the
case where a domain becomes empty, the problem cannot be satisfied, and we
backtrack.
Although the use of MAC means that the time complexity of each node in
the search tree grows considerably, the number of nodes investigated decreases
correspondingly. Sabin and Freuder [1994] showed that the additional effort of
MAC pays off when dealing with hard problems.
The MAC strategy is implemented as follows. For each recursive call of al-
gorithm onebin general (i.e., for each new assignment of a relation) we run
through all pairs of boxes i and j with |M ij | ≥ 2 and test the feasibility of each
relation R ∈ M ij . If the packing becomes infeasible with the additional relation
imposed, the relation is removed from the domain. If M ij in this way becomes
empty, we may conclude that no feasible packing can be obtained by following
this branch, and thus we may backtrack in onebin general. If only one relation
is left in a domain M ij then this relation is fixed. Having fixed a relation, in
order to maintain arc consistency it may be necessary to run through an ad-
ditional reduction. However, preliminary computational experiments showed
that this does not pay off. All reductions in the domain achieved by the for-
ward propagation are pushed to a stack, such that the domains can be quickly
restored upon backtracking from onebin general.
The best performance of algorithm onebin general was obtained by sorting
the boxes according to nonincreasing volume, and then branching on pairs of
boxes (1, 2), (1, 3), (2, 3), (1, 4), (2, 4), (3, 4), (1, 5) . . .. In this way the, relative
position of the largest boxes was settled at an early stage of the algorithm,
and infeasibility could quickly be detected. This complies with the First Fail
Strategy proposed by Barták [1998].
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
8 • S. Martello et al.
5. COMPUTATIONAL EXPERIMENTS
For each class, we considered instances of different size, with n ranging be-
tween 10 and 50. The code was implemented in ANSI-C, and the experiments
were run on Pentium 4 running at 3 GHz. A time limit of 3600 s was given
to each instance, and 10 instances were solved for each class and size of a
problem.
The experiments were performed on the nine classes of random instances
described in Martello et al. [2000]. For the first five classes, the bin size was
W = H = D = 100 and five types of boxes were considered by uniformly
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
Algorithm 864: Variants of Three-Dimensional Bin Packing Problem • 9
Table II. Average Solution Times in Seconds, as Average of 10 Instances Using a Time Limit
of 3600 s
Class
Packing n 1 2 3 4 5 6 7 8 9
10 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15 0.00 0.00 0.00 0.00 0.01 0.00 0.02 0.00 0.00
20 0.01 0.01 0.01 0.00 0.01 0.01 0.16 0.00 0.01
25 0.05 0.04 0.10 0.00 0.09 0.19 1.76 0.91 0.11
General 30 15.18 1.09 3.50 0.00 1.41 7.34 93.73 360.35 468.81
35 61.07 102.39 26.30 0.00 3.01 2.90 764.97 390.11 546.46
40 217.87 614.06 861.15 0.00 448.32 15.79 1151.20 365.25 2859.09
45 1049.05 1493.49 2163.92 0.01 1464.79 363.07 1952.55 450.54 3600.01
50 1391.89 2696.83 1712.14 4.00 1971.17 4.22 1604.58 434.98 3600.02
10 0.00 0.00 0.00 0.00 0.00 0.00 7.81 0.00 0.00
15 0.00 0.00 0.00 0.00 0.04 0.01 4.85 0.02 0.00
20 0.01 0.01 0.01 0.00 3.96 0.04 207.76 4.31 0.00
25 0.11 0.03 0.18 0.00 843.37 0.09 1425.30 361.05 0.05
Robot 30 10.41 1.01 1.90 0.00 381.42 5.00 1308.55 1080.11 19.78
35 36.67 35.75 11.03 0.00 1819.74 1.53 2033.36 950.86 74.75
40 114.53 449.87 766.76 0.00 2184.86 12.84 2881.79 136.94 1250.15
45 748.34 1299.86 2162.28 0.01 2161.50 11.28 3240.01 751.35 3247.02
50 1262.65 2523.43 1333.56 3.52 2532.84 5.49 2742.58 1875.95 3600.01
algorithm was able to solve 723 out of 810 instances, while the robot-packable
algorithm was able to solve 694 of them. The difference may be explained by
the fact that the general version has more freedom in arranging the boxes and
thus may find solutions using fewer bins. In this way, having tighter upper
bounds, the algorithm may terminate faster as the lower bounds used by both
algorithms are the same. For Class 9, the picture changed as the robot-packable
algorithm was able to solve 71 instances while the general algorithm only solved
61 instances (out of 90). This behavior can be explained by the fact that the
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.
Algorithm 864: Variants of Three-Dimensional Bin Packing Problem • 11
Table IV. Average Number of Iterations in Procedure onebin decision (in Thousands)
Class
Packing n 1 2 3 4 56 7 8 9
10 0 0 0 0 0 0 0 0 0
15 2 3 9 0 0 0 1 0 1
20 10 22 9 0 0 1 5 0 8
25 39 42 94 0 2 16 36 68 59
General 30 12224 820 3876 0 5 1627 42912 149919 193643
35 27063 102944 31566 1 7 1715 309928 102222 363543
40 206458 598374 720682 8 166802 9161 430270 167427 1267382
45 1098733 1621442 1795338 24 674970 205247 816829 193217 1579066
50 1676059 3062527 2299310 17432 861892 3718 672255 152052 1266272
10 0 0 0 0 0 3 4123 0 0
15 1 2 3 0 16 4 2467 11 0
20 23 14 6 0 2098 27 100877 2087 4
25 127 35 223 0 285958 55 513293 174724 45
Robot 30 13651 1455 2742 0 129160 3024 400023 401562 14725
35 23214 54554 20954 2 548005 1168 895675 511179 28287
40 160077 644205 785467 12 1387156 13591 1436016 94393 493016
45 1137480 2139452 2439088 27 1576640 8260 1781172 509878 1343846
50 1966457 4570412 1990263 17027 989142 3821 975509 878014 1380453
generated instances were all robot packable, so the robot packing version had
the advantage that it only needed to search the relevant solution space. As a
whole, Classes 4 and 6 were generally the easiest to solve while Class 9 tended
to be the most difficult.
Table II gives the average CPU times with a time limit of 3600 s. If an
instance was not solved to proved optimality within the time limit, the time
spent is included in the computation. It can be seen that most instances up to
30 items were solved within a reasonable time. Classes 4 and 6 were particularly
easy to solve, and the solution times seldom exceeded a few seconds.
Table III reports the number of branch-and-bound nodes in the main search
tree, measured in thousands. Table IV shows the corresponding number of it-
erations in procedure onebin decision, measured in thousands. It can be seen
that Classes 1 to 3 demanded quite a lot of branch-and-bound nodes, while
Classes 5 to 9 seldom branched but mainly spent time in the onebin decision
procedure. Class 4 used neither many branch-and-bound nodes nor many iter-
ations in onebin decision.
REFERENCES
ACM Transactions on Mathematical Software, Vol. 33, No. 1, Article 7, Publication date: March 2007.