This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Harmonic Algorithms for Packing
dd-dimensional Cuboids Into Bins

Eklavya Sharma
Department of Computer Science and Automation
Indian Institute of Science, Bengaluru.
eklavyas@iisc.ac.in
Abstract

We explore approximation algorithms for the dd-dimensional geometric bin packing problem (ddBP). Caprara [8] gave a harmonic-based algorithm for ddBP having an asymptotic approximation ratio (AAR) of Td1T_{\infty}^{d-1} (where T1.691T_{\infty}\approx 1.691). However, their algorithm doesn’t allow items to be rotated. This is in contrast to some common applications of ddBP, like packing boxes into shipping containers. We give approximation algorithms for ddBP when items can be orthogonally rotated about all or a subset of axes. We first give a fast and simple harmonic-based algorithm having AAR TdT_{\infty}^{d}. We next give a more sophisticated harmonic-based algorithm, which we call 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}, having AAR Td1(1+ε)T_{\infty}^{d-1}(1+\varepsilon). This gives an AAR of roughly 2.860+ε2.860+\varepsilon for 3BP with rotations, which improves upon the best-known AAR of 4.54.5. In addition, we study the multiple-choice bin packing problem that generalizes the rotational case. Here we are given nn sets of dd-dimensional cuboidal items and we have to choose exactly one item from each set and then pack the chosen items. Our algorithms also work for the multiple-choice bin packing problem. We also give fast and simple approximation algorithms for the multiple-choice versions of ddD strip packing and ddD geometric knapsack.

Acknowledgements.

I want to thank my advisor, Prof. Arindam Khan, for his valuable comments, and Arka Ray for helpful suggestions.

1 Introduction

Packing of rectangular and cuboidal items is a fundamental problem in computer science, mathematics, and operations research. Packing problems find numerous applications in practice, e.g., physical packing of concrete 3D items during storage or transportation [7], cutting prescribed 2D pieces from cloth or metal sheet while minimizing the waste [16], etc. In this paper, we study packing of dd-dimensional (ddD) cuboidal items (for d2d\geq 2).

Let II be a set of nn number of ddD cuboidal items, where each item has length at most one in each dimension. A feasible packing of items into a ddD cuboid is a packing where items are placed inside the cuboid parallel to the axes without any overlapping. A ddD unit cube is a ddD cuboid of length one in each dimension. In the ddD bin packing problem (ddBP), we have to compute a feasible packing of II (without rotating the items) into the minimum number of bins that are ddD unit cubes. Let optdBP(I)\operatorname{opt}_{d\mathrm{BP}}(I) denote the minimum number of bins needed to pack II.

ddBP is NP-hard, as it generalizes the classic bin packing problem [9]. Thus, we study approximation algorithms. For ddBP, the worst-case approximation ratio usually occurs only for small pathological instances. Thus, the standard performance measure is the asymptotic approximation ratio (AAR). For an algorithm 𝒜\mathcal{A}, AAR is defined as:

limmsupI𝙸:opt(I)=m𝒜(I)opt(I),\lim\limits_{m\to\infty}\quad\sup_{I\in\mathtt{I}:\,\operatorname{opt}(I)=m}\quad\frac{\mathcal{A}(I)}{\operatorname{opt}(I)},

where 𝙸\mathtt{I} is the set of all problem instances. 𝒜(I)\mathcal{A}(I) and opt(I)\operatorname{opt}(I) are the number of bins used by 𝒜\mathcal{A} and the optimal algorithm, respectively, on II.

Coffman et al. [10] initiated the study of approximation algorithms for rectangle packing. They studied packing algorithms such as First-Fit Decreasing Height (FFDH) and Next-Fit Decreasing Height (NFDH). In his seminal paper, Caprara [8] devised a polynomial-time algorithm for ddBP called 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} (Harmonic Decreasing Height), where kk\in\mathbb{Z} is a parameter to the algorithm. 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} has AAR equal to Tkd1T_{k}^{d-1}, where TkT_{k} is a decreasing function of kk and TlimkTk1.691T_{\infty}\coloneqq\lim_{k\to\infty}T_{k}\approx 1.691. The algorithm 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} is based on an extension of the harmonic algorithm [24] for 1BP.

A limitation of 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} is that it does not allow rotation of items. This is in contrast to some real-world problems, like packing boxes into shipping containers (d=3d=3), where items can often be rotated orthogonally, i.e., 9090^{\circ} rotation around all or a subset of axes [1, 30]. Orientation constraints may sometimes limit the vertical orientation of a box to one dimension (“This side up”) or to two (of three) dimensions (e.g., long but low and narrow box should not be placed on its smallest surface). These constraints are introduced to deter goods and packaging from being damaged and to ensure the stability of the load. One of our primary contributions is presenting variants of 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} that work for generalizations of ddBP that capture the notion of orthogonal rotation of items.

1.1 Prior Work

For 2BP, Bansal et al. [3] obtained AAR of T+εT_{\infty}+\varepsilon even for the case with rotations, using a more sophisticated algorithm that used properties of harmonic rounding. Then there has been a series of improvements [3, 19] culminating with the present best AAR of 1.406 [5], for both the cases with and without orthogonal rotations. Bansal et al. [6] showed that ddBP is APX-hard, even for d=2d=2. They also gave an asymptotic PTAS for ddBP where all items are ddD squares.

Closely related to ddBP is the ddD strip packing problem (ddSP), where we have to compute a packing of II (without rotating the items) into a ddD cuboid (called a strip) that has length one in the first d1d-1 dimensions and has the minimum possible length (called height) in the dthd^{\textrm{th}} dimension.

For 2SP, an asymptotic PTAS was given by Kenyon and Rémila [22]. Jansen and van Stee [21] extended this to the case with orthogonal rotations. For 3SP, when rotations are not allowed, Bansal et al. [4] gave a harmonic-based algorithm achieving AAR of T+εT_{\infty}+\varepsilon. Recently, this has been improved to 1.5+ε1.5+\varepsilon [20]. Miyazawa and Wakabayashi [25] studied 3SP and 3BP when rotations are allowed, and gave algorithms with AAR 2.64 and 4.89, respectively. Epstein and van Stee [13] gave an improved AAR of 2.25 and 4.5 for 3SP and 3BP with rotations, respectively. The 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} algorithm also works for ddSP and has an AAR of Tkd1T_{k}^{d-1}. For online ddBP, there are harmonic-based TdT_{\infty}^{d}-asymptotic-approximation algorithms [12, 11], which are optimal for O(1)O(1) memory algorithms.

1.2 Multiple-Choice Packing

We will now define the ddD multiple-choice bin packing problem (ddMCBP). This generalizes ddBP and captures the notion of orthogonal rotation of items. This perspective will be helpful in designing algorithms for the rotational case. In ddMCBP, we’re given a set ={I1,I2,,In}\mathcal{I}=\{I_{1},I_{2},\ldots,I_{n}\}, where for each jj, IjI_{j} is a set of items, henceforth called an itemset. We have to pick exactly one item from each itemset and pack those items into the minimum number of bins. See Fig. 1 for an example of 2MCBP.

12345678942859
Figure 1: 2MCBP example: packing the input ={{1,2,3},{4},{5,6},{7,8},{9}}\mathcal{I}=\{\{1,2,3\},\{4\},\{5,6\},\{7,8\},\{9\}\} into two bins. Here items of the same color belong to the same itemset.

We can model rotations using multiple-choice packing: Given a set II of items, for each item iIi\in I, create an itemset IiI_{i} that contains all allowed orientations of ii. Then the optimal solution to {Ii:iI}\mathcal{I}\coloneqq\{I_{i}:i\in I\} will tell us how to rotate and pack items in II.

Some algorithms for 2D bin packing with rotations assume that the bin is square [3, 19, 5]. This assumption holds without loss of generality when rotations are forbidden, because we can scale the items. But if rotations are allowed, this won’t work because items i1i_{1} and i2i_{2} that are rotations of each other may stop being rotations of each other after they are scaled. Multiple-choice packing algorithms can be used in this case. For each item iIi\in I, we will create an itemset IiI_{i} that contains scaled orientations of ii.

Multiple-choice packing problems have been studied before. Lawler gave an FPTAS for the multiple-choice knapsack problem [23]. Patt-Shamir and Rawitz gave an algorithm for multiple-choice vector bin packing having AAR O(logd)O(\log d) and a PTAS for multiple-choice vector knapsack [27]. Similar notions have been studied in the scheduling of malleable or moldable jobs [31, 18].

1.3 Our Contributions

After the introduction of the harmonic algorithm for online 1BP by Lee and Lee [24], many variants have found widespread use in multidimensional packing problems (both offline and online) [8, 3, 4, 2, 12, 11, 17, 28, 29]. They are also simple, fast, and easy to implement. For example, among algorithms for 3SP, 2BP and 3BP with practical running time, harmonic-based algorithms provide the best AAR.

In our work, we extend harmonic-based algorithms to ddMCBP. ddMCBP subsumes the rotational case for geometric bin packing, and we believe ddMCBP is an important natural generalization of geometric bin packing that may be of independent interest.

In Section 3, we describe ideas from 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} [8] that help us devise harmonic-based algorithms for ddMCBP. In Section 4, we show an O(Nd+ndlogn)O(Nd+nd\log n)-time algorithm for ddMCBP, called 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k}, having an AAR of TkdT_{k}^{d}, where nn is the number of itemsets and NN is the total number of items across all the nn itemsets. 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} is a fast and simple algorithm that works in two stages: In the first stage, we select the smallest item from each itemset (we will precisely define smallest in Section 4). In the second stage, we pack the selected items into bins using a variant of the 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} algorithm.

In Section 5, we show an algorithm for ddMCBP, called 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}, having an AAR of Tkd1(1+ε)T_{k}^{d-1}(1+\varepsilon) and having a running time of NO(1/ε2)n(1/ε)O(1/ε)+O(Nd+ndlogn)N^{O(1/\varepsilon^{2})}n^{(1/\varepsilon)^{O(1/\varepsilon)}}+O(Nd+nd\log n). For d3d\geq 3, this matches the present best AAR for the case where rotations are forbidden. Also, for large kk, this gives an AAR of roughly T22.860T_{\infty}^{2}\approx 2.860 for 3D bin packing when orthogonal rotations are allowed, which is an improvement over the previous best AAR of 4.54.5 [13], an improvement after fourteen years.

As harmonic algorithms are ubiquitous in bin packing, we expect our results will have applications in other related problems.

Our techniques can be extended to some other packing problems, like strip packing and geometric knapsack. In LABEL:sec:hdhk-sp, we define the ddD multiple-choice strip packing problem (ddMCSP) and extend Caprara’s 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} algorithm [8] to ddMCSP. The algorithm has AAR Tkd1T_{k}^{d-1} and runs in time O(Nd+ndlogn)O(Nd+nd\log n), where nn is the number of itemsets and NN is the total number of items across all itemsets. In LABEL:sec:hdhks, we define the ddD multiple-choice knapsack problem (ddMCKS), and for any 0<ε<10<\varepsilon<1, we show an O(Nd+NlogN+Nn/ε+ndlogn)O(Nd+N\log N+Nn/\varepsilon+nd\log n)-time algorithm that is (1ε)3d(1-\varepsilon)3^{-d}-approximate.

2 Preliminaries

Let [n]{1,2,,n}[n]\coloneqq\{1,2,\ldots,n\}. For a set XX, define sum(X)xXx\operatorname{sum}(X)\coloneqq\sum_{x\in X}x. For an nn-dimensional vector 𝐯\mathbf{v}, define sum(𝐯)i=1n𝐯i\operatorname{sum}(\mathbf{v})\coloneqq\sum_{i=1}^{n}\mathbf{v}_{i}. For a set XIX\subseteq I of items and any function f:If:I\mapsto\mathbb{R}, f(X)f(X) is defined to be iXf(i)\sum_{i\in X}f(i), unless stated otherwise.

The length of a ddD item ii in the jthj^{\textrm{th}} dimension is denoted by j(i)\ell_{j}(i). Define vol(i)j=1dj(i)\operatorname{vol}(i)\coloneqq\prod_{j=1}^{d}\ell_{j}(i). For a ddD cuboid ii, call the first d1d-1 dimensions base dimensions and call the dthd^{\textrm{th}} dimension height. For a set II of items, |I||I| is the number of items in II. Let |P||P| denote the number of bins used by a packing PP of items into bins.

2.1 Multiple-Choice Packing

Let \mathcal{I} be a set of itemsets. Define flat()\operatorname{flat}(\mathcal{I}) to be the union of all itemsets in \mathcal{I}.

Let KK be a set of items that contains exactly one item from each itemset in \mathcal{I}. Formally, for each itemset II\in\mathcal{I}, |KI|=1|K\cap I|=1. Then KK is called an assortment of \mathcal{I}. Let Ψ()\Psi(\mathcal{I}) denote the set of all assortments of \mathcal{I}. In ddMCBP, given an input instance \mathcal{I}, we have to select an assortment KΨ()K\in\Psi(\mathcal{I}) and output a bin packing of KK, such that the number of bins used is minimized. Therefore, optdMCBP()=minKΨ()optdBP(K)\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})=\min_{K\in\Psi(\mathcal{I})}\operatorname{opt}_{d\mathrm{BP}}(K).

3 Important Ideas from the 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} Algorithm

In this section, we will describe some important ideas behind the 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} algorithm for ddBP by Caprara [8]. These ideas are the building blocks for our algorithms for ddMCBP.

3.1 Weighting Functions

Fekete and Schepers [14] present a useful approach for obtaining lower bounds on the optimal solution to bin packing problems. Their approach is based on weighting functions.

Definition 1.

g:[0,1][0,1]g:[0,1]\mapsto[0,1] is a weighting function iff for all m>0m\in\mathbb{Z}_{>0} and x[0,1]mx\in[0,1]^{m},

i=1mxi1i=1mg(xi)1\sum_{i=1}^{m}x_{i}\leq 1\implies\sum_{i=1}^{m}g(x_{i})\leq 1

(Weighting functions are also called dual feasible functions (DFFs)).

Theorem 1.

Let II be a set of ddD items that can be packed into a bin. Let g1,g2,,gdg_{1},g_{2},\ldots,g_{d} be weighting functions. For iIi\in I, define g(i)g(i) as the item whose length is gj(j(i))g_{j}(\ell_{j}(i)) in the jthj^{\textrm{th}} dimension, for each j[d]j\in[d]. Then {g(i):iI}\{g(i):i\in I\} can be packed into a ddD bin (without rotating the items).

Theorem 1 is proved in LABEL:sec:dff-trn.

3.2 The Harmonic Function

To obtain a lower-bound on optdBP(I)\operatorname{opt}_{d\mathrm{BP}}(I) using Theorem 1, Caprara [8] defined a function fkf_{k}. For an integer constant k3k\geq 3, fk:[0,1][0,1]f_{k}:[0,1]\mapsto[0,1] is defined as

fk(x){1qx(1q+1,1q] for q[k1]kk2xx1k.f_{k}(x)\coloneqq\begin{cases}\frac{1}{q}&x\in\left(\left.\frac{1}{q+1},\frac{1}{q}\right]\right.\textrm{ for }q\in[k-1]\\ \frac{k}{k-2}x&x\leq\frac{1}{k}\end{cases}.

fkf_{k} was originally defined and studied by Lee and Lee [24] for their online algorithm for 1BP, except that they used k/(k1)k/(k-1) instead of k/(k2)k/(k-2). Define typek:[0,1][k]\operatorname{type}_{k}:[0,1]\mapsto[k] as

typek(x){qx(1q+1,1q] for q[k1]kx1k.\operatorname{type}_{k}(x)\coloneqq\begin{cases}q&x\in\left(\left.\frac{1}{q+1},\frac{1}{q}\right]\right.\textrm{ for }q\in[k-1]\\ k&x\leq\frac{1}{k}\end{cases}.

Define TkT_{k} to be the smallest positive constant such that Hk(x)fk(x)/TkH_{k}(x)\coloneqq f_{k}(x)/T_{k} is a weighting function. We call HkH_{k} the harmonic weighting function. We can efficiently compute TkT_{k} as a function of kk using ideas from [24]. Table 1 lists the values of TkT_{k} for the first few kk. It can also be proven that TkT_{k} is a decreasing function of kk and TlimkTk1.6910302T_{\infty}\coloneqq\lim_{k\to\infty}T_{k}\approx 1.6910302.

Table 1: Values of TkT_{k}.
kk 3 4 5 6 7 \infty
TkT_{k} 3 2 11/6=1.83¯11/6=1.8\overline{3} 7/4=1.757/4=1.75 26/15=1.73¯26/15=1.7\overline{3} 1.6910302\approx 1.6910302

For a ddD cuboid ii, define fk(i)f_{k}(i) to be the cuboid whose length is fk(j(i))f_{k}(\ell_{j}(i)) in the jthj^{\textrm{th}} dimension, for each j[d]j\in[d]. For a set II of ddD cuboids, let fk(I){fk(i):iI}f_{k}(I)\coloneqq\{f_{k}(i):i\in I\}. Similarly define Hk(i)H_{k}(i) and Hk(I)H_{k}(I). Define type(i)\operatorname{type}(i) to be a dd-dimensional vector whose jthj^{\textrm{th}} component is typek(j(i))\operatorname{type}_{k}(\ell_{j}(i)). Note that there can be at most kdk^{d} different values of type(i)\operatorname{type}(i). Sometimes, for the sake of convenience, we may express type(i)\operatorname{type}(i) as an integer in [kd][k^{d}].

Theorem 2.

For a set of II of ddD items, vol(fk(I))TkdoptdBP(I)\operatorname{vol}(f_{k}(I))\leq T_{k}^{d}\operatorname{opt}_{d\mathrm{BP}}(I).

Proof.

Let moptdBP(I)m\coloneqq\operatorname{opt}_{d\mathrm{BP}}(I). Let JjJ_{j} be the items in the jthj^{\textrm{th}} bin in the optimal bin packing of II. By Theorem 1 and because HkH_{k} is a weighting function, Hk(Jj)H_{k}(J_{j}) fits in a bin. Therefore,

vol(fk(I))=j=1mTkdvol(Hk(Jj))j=1mTkd=TkdoptdBP(I).\operatorname{vol}(f_{k}(I))=\sum_{j=1}^{m}T_{k}^{d}\operatorname{vol}(H_{k}(J_{j}))\leq\sum_{j=1}^{m}T_{k}^{d}=T_{k}^{d}\operatorname{opt}_{d\mathrm{BP}}(I).\qed

3.3 The 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k} Subroutine

From the 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} algorithm by Caprara [8], we extracted out a useful subroutine, which we call 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k}, that satisfies the following useful property:

Property 2.

The algorithm 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k[t](I)\operatorname{\mathtt{HDH-unit-pack}}_{k}^{[t]}(I) takes a sequence II of ddD items such that all items have type tt and vol(fk(I{last(I)}))<1\operatorname{vol}(f_{k}(I-\{\operatorname{last}(I)\}))<1 (here last(I)\operatorname{last}(I) is the last item in sequence II). It returns a packing of II into a single ddD bin in O(ndlogn)O(nd\log n) time, where n|I|n\coloneqq|I|.

The design of 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k} and its correctness can be inferred from Lemma 4.1 in [8]. We use 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k} as a black-box subroutine in our algorithms, i.e., we only rely on Property 2; we don’t need to know anything else about 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k}. Nevertheless, for the sake of completeness, in LABEL:sec:hdhkunit, we give a complete description of 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k} and prove its correctness.

4 Fast and Simple Algorithm for ddMCBP (𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k})

We will now describe an algorithm for ddBP called the full-harmonic algorithm (𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k}). We will then extend it to ddMCBP. The 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} algorithm works by first partitioning the items based on their type\operatorname{type} vector (type vector is defined in Section 3.2). Then for each partition, it repeatedly picks the smallest prefix JJ such that vol(fk(J))1\operatorname{vol}(f_{k}(J))\geq 1 and packs JJ into a ddD bin using 𝙷𝙳𝙷𝚞𝚗𝚒𝚝𝚙𝚊𝚌𝚔k\operatorname{\mathtt{HDH-unit-pack}}_{k}. See Algorithm 1 for a more precise description of 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k}. Note that 𝚏𝚞𝚕𝚕𝚑k(I)\operatorname{\mathtt{fullh}}_{k}(I) has a running time of O(|I|dlog|I|)O(|I|d\log|I|).

Algorithm 1 𝚏𝚞𝚕𝚕𝚑k(I)\operatorname{\mathtt{fullh}}_{k}(I): Returns a bin packing of ddD items II.
1:Let PP be an empty list.
2:for each type\operatorname{type} tt do
3:     I[t]={iI:type(i)=t}I^{[t]}=\{i\in I:\operatorname{type}(i)=t\}.
4:     while |I[t]|>0|I^{[t]}|>0 do
5:         Find JJ, the smallest prefix of I[t]I^{[t]} such that J=I[t]J=I^{[t]} or vol(fk(J)))1\operatorname{vol}(f_{k}(J)))\geq 1.
6:         B=HDH-unit-packk[t](J)B=\operatorname{\hyperref@@ii[sec:hdhk-prelims:hdhkunit]{\mathtt{HDH-unit-pack}}}_{k}^{[t]}(J). // BB is a packing of JJ into a ddD bin.
7:         Append BB to the list PP.
8:         Remove JJ from I[t]I^{[t]}.
9:     end while
10:end for
11:return the list PP of bins.
Theorem 3.

The number of bins used by 𝚏𝚞𝚕𝚕𝚑k(I)\operatorname{\mathtt{fullh}}_{k}(I) is less than Q+vol(fk(I))Q+\operatorname{vol}(f_{k}(I)), where QQ is the number of distinct type\operatorname{type}s of items (so QkdQ\leq k^{d}).

Proof.

Let I[t]I^{[t]} be the items in II of type tt. Suppose 𝚏𝚞𝚕𝚕𝚑k(I)\operatorname{\mathtt{fullh}}_{k}(I) uses m[t]m^{[t]} bins to pack I[t]I^{[t]}. For each type tt, the first m[t]1m^{[t]}-1 bins have volfk\operatorname{vol}\cdot f_{k} at least 1, so vol(fk(I[t]))>m[t]1\operatorname{vol}(f_{k}(I^{[t]}))>m^{[t]}-1. Therefore, total number of bins used is t=1Qm[t]<t=1Q(1+vol(fk(I[t])))=Q+vol(fk(I))\sum_{t=1}^{Q}m^{[t]}<\sum_{t=1}^{Q}(1+\operatorname{vol}(f_{k}(I^{[t]})))=Q+\operatorname{vol}(f_{k}(I)). ∎

Lemma 4 (Corollary to Theorems 3 and 2).

𝚏𝚞𝚕𝚕𝚑k(I)\operatorname{\mathtt{fullh}}_{k}(I) uses less than Q+TkdoptdBP(I)Q+T_{k}^{d}\operatorname{opt}_{d\mathrm{BP}}(I) bins, where QQ is the number of distinct item type\operatorname{type}s.

Theorem 5.

Let \mathcal{I} be a ddMCBP instance. Let K^{argminiIvol(fk(i)):I}\widehat{K}\coloneqq\{\operatorname*{argmin}_{i\in I}\operatorname{vol}(f_{k}(i)):I\in\mathcal{I}\}, i.e., K^\widehat{K} is the assortment obtained by picking from each itemset the item ii having the minimum value of vol(fk(i))\operatorname{vol}(f_{k}(i)). Then the number of bins used by 𝚏𝚞𝚕𝚕𝚑k(K^)\operatorname{\mathtt{fullh}}_{k}(\widehat{K}) is less than Q+TkdoptdMCBP()Q+T_{k}^{d}\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I}), where QQ is the number of distinct type\operatorname{type}s of items in flat()\operatorname{flat}(\mathcal{I}) (so QkdQ\leq k^{d}).

Proof.

For any assortment KK, vol(fk(K^))vol(fk(K))\operatorname{vol}(f_{k}(\widehat{K}))\leq\operatorname{vol}(f_{k}(K)). Let KK^{*} be the assortment in an optimal packing of \mathcal{I}. By Theorems 3 and 2, the number of bins used by 𝚏𝚞𝚕𝚕𝚑k(K^)\operatorname{\mathtt{fullh}}_{k}(\widehat{K}) is less than

Q+vol(fk(K^))Q+vol(fk(K))Q+TkdoptdBP(K).=Q+TkdoptdMCBP()Q+\operatorname{vol}(f_{k}(\widehat{K}))\leq Q+\operatorname{vol}(f_{k}(K^{*}))\leq Q+T_{k}^{d}\operatorname{opt}_{d\mathrm{BP}}(K^{*}).=Q+T_{k}^{d}\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})\qed

Let N|flat()|N\coloneqq|\operatorname{flat}(\mathcal{I})| and n||n\coloneqq|\mathcal{I}|. We can find K^\widehat{K} in O(Nd)O(Nd) time and compute 𝚏𝚞𝚕𝚕𝚑k(K^)\operatorname{\mathtt{fullh}}_{k}(\widehat{K}) in O(ndlogn)O(nd\log n) time. This gives us an O(Nd+ndlogn)O(Nd+nd\log n)-time algorithm for ddMCBP having AAR TkdT_{k}^{d}.

4.1 ddBP with Rotations

As mentioned before, we can solve the rotational version of ddBP by reducing it to ddMCBP. Specifically, for each item ii in the ddBP instance, we create an itemset containing all orientations of ii, and we pack the resulting ddMCBP instance using 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k}. Since an item can have up to d!d! allowed orientations, this can take up to O(nd!+ndlogn)O(nd!+nd\log n) time. Hence, the running time is large when dd is large. However, we can do better for some special cases.

When the bin has the same length in each dimension, then for any item ii, vol(fk(i))\operatorname{vol}(f_{k}(i)) is independent of how we orient ii. Hence, we can orient the items II arbitrarily and then pack them using 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} in O(ndlogn)O(nd\log n) time.

Suppose there are no orientation constraints, i.e., all d!d! orientations of each item are allowed. Let LjL_{j} be the length of the bin in the jthj^{\textrm{th}} dimension, for each j[d]j\in[d]. To use 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} to pack II, we need to find the best orientation for each item iIi\in I, i.e., we need to find a permutation π\pi for each item ii such that j=1dfk(πj(i)/Lj)\prod_{j=1}^{d}f_{k}\left(\ell_{\pi_{j}}(i)/L_{j}\right) is minimized. This can be formulated as a maximum-weight bipartite matching problem on a graph with dd vertices in each partition: for every u[d]u\in[d] and v[d]v\in[d], the edge (u,v)(u,v) has a non-negative weight of log(fk(u(i)/Lv))-\log(f_{k}(\ell_{u}(i)/L_{v})). So, using the Kuhn-Munkres algorithm [26], we can find the best orientation for each item in O(d3)O(d^{3}) time. Hence, we can pack II using 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} in O(nd3+ndlogn)O(nd^{3}+nd\log n) time.

5 Better Algorithm for ddMCBP (𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k})

Here we will describe a Tkd1(1+ε)T_{k}^{d-1}(1+\varepsilon)-asymptotic-approximate algorithm for ddMCBP that is based on 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} and Lueker and Fernandez de la Vega’s APTAS for 1BP [15]. We call our algorithm Harmonic Guess-and-Pack (𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}). This improves upon 𝚏𝚞𝚕𝚕𝚑k\operatorname{\mathtt{fullh}}_{k} that has AAR TkdT_{k}^{d}.

Definition 3.

For a ddD item ii, let h(i)d(i)h(i)\coloneqq\ell_{d}(i), w(i)j=1d1fk(j(i))w(i)\coloneqq\prod_{j=1}^{d-1}f_{k}(\ell_{j}(i)) and a(i)w(i)h(i)a(i)\coloneqq w(i)h(i). Let 𝚛𝚘𝚞𝚗𝚍(i)\operatorname{\mathtt{round}}(i) be a rectangle of height h(i)h(i) and width w(i)w(i). For a set XX of ddD items, define w(X)iXw(i)w(X)\coloneqq\sum_{i\in X}w(i) and 𝚛𝚘𝚞𝚗𝚍(X){𝚛𝚘𝚞𝚗𝚍(i):iX}\operatorname{\mathtt{round}}(X)\coloneqq\{\operatorname{\mathtt{round}}(i):i\in X\}.

For any ε>0\varepsilon>0, the algorithm 𝙷𝙶𝚊𝙿k(,ε)\operatorname{\mathtt{HGaP}}_{k}(\mathcal{I},\varepsilon) returns a bin packing of \mathcal{I}, where \mathcal{I} is a set of ddD itemsets. 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} first converts \mathcal{I} to a set ^\widehat{\mathcal{I}} of 2D itemsets. It then computes PbestP_{\mathrm{best}}, which is a structured bin packing of ^\widehat{\mathcal{I}} (we formally define structured later). Finally, it uses the algorithm 𝚒𝚗𝚏𝚕𝚊𝚝𝚎\operatorname{\mathtt{inflate}} to convert PbestP_{\mathrm{best}} into a bin packing of the ddD itemsets \mathcal{I}, where |𝚒𝚗𝚏𝚕𝚊𝚝𝚎(Pbest)||\operatorname{\mathtt{inflate}}(P_{\mathrm{best}})| is very close to |Pbest||P_{\mathrm{best}}|. See Algorithm 2 for a more precise description. We show that |Pbest|Tkd1(1+ε)opt()|P_{\mathrm{best}}|\lessapprox T_{k}^{d-1}(1+\varepsilon)\operatorname{opt}(\mathcal{I}), which proves that 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} has an AAR of Tkd1(1+ε)T_{k}^{d-1}(1+\varepsilon). This approach of converting items to 2D, packing them, and then converting back to ddD is very useful, because most of our analysis is about how to compute a structured 2D packing, and a packing of 2D items is easier to visualize and reason about than a packing of ddD items.

Algorithm 2 𝙷𝙶𝚊𝙿k(,ε)\operatorname{\mathtt{HGaP}}_{k}(\mathcal{I},\varepsilon): Returns a bin packing of ddD itemsets \mathcal{I}, where ε(0,1)\varepsilon\in(0,1).
1:Let δε/(2+ε)\delta\coloneqq\varepsilon/(2+\varepsilon).
2:^={𝚛𝚘𝚞𝚗𝚍(I):I}\widehat{\mathcal{I}}=\{\operatorname{\mathtt{round}}(I):I\in\mathcal{I}\}
3:Initialize PbestP_{\mathrm{best}} to null.
4:for P𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)P\in\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) do
5:     P¯=𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\overline{P}=\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta)
6:     if P¯\overline{P} is not null and (PbestP_{\mathrm{best}} is null or |P¯||Pbest||\overline{P}|\leq|P_{\mathrm{best}}|then
7:         Pbest=P¯P_{\mathrm{best}}=\overline{P}
8:     end if
9:end for
10:return 𝚒𝚗𝚏𝚕𝚊𝚝𝚎(Pbest)\operatorname{\mathtt{inflate}}(P_{\mathrm{best}})

A 2D bin packing is said to be shelf-based if items are packed into shelves and the shelves are packed into bins, where a shelf is a rectangle of width 1. See Fig. 2 for an example. A structured bin packing is a shelf-based bin packing where the heights of the shelves satisfy some additional properties (we describe these properties later). The algorithm 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} repeatedly guesses the number and heights of shelves and computes a structured packing PP of those shelves into bins. Then for each packing PP, the algorithm 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) tries to pack an assortment of ^\widehat{\mathcal{I}} into the shelves in PP plus maybe one additional shelf. If 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}} succeeds, call the resulting bin packing P¯\overline{P}. Otherwise, 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}} returns null. PbestP_{\mathrm{best}} is the value of P¯\overline{P} with the minimum number of bins across all guesses by 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}}.

Figure 2: An example of shelf-based packing with 3 shelves.

We prove that the AAR of 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} is Tkd1(1+ε)T_{k}^{d-1}(1+\varepsilon) by showing that for some P𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)P^{*}\in\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta), we have |P|Tkd1(1+ε)opt()|P^{*}|\lessapprox T_{k}^{d-1}(1+\varepsilon)\operatorname{opt}(\mathcal{I}) and 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P^{*},\delta) is not null.

We will now precisely define structured bin packing and state the main theorems on 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}.

5.1 Structured Packing

Definition 4 (Slicing).

Slicing a 1D item ii is the operation of replacing it by items i1i_{1} and i2i_{2} such that size(i1)+size(i2)=size(i)\operatorname{size}(i_{1})+\operatorname{size}(i_{2})=\operatorname{size}(i).

Slicing a rectangle ii using a vertical cut is the operation of replacing ii by two rectangles i1i_{1} and i2i_{2} where h(i)=h(i1)=h(i2)h(i)=h(i_{1})=h(i_{2}) and w(i)=w(i1)+w(i2)w(i)=w(i_{1})+w(i_{2}). Slicing ii using a horizontal cut is the operation of replacing ii by two rectangles i1i_{1} and i2i_{2} where w(i)=w(i1)=w(i2)w(i)=w(i_{1})=w(i_{2}) and h(i)=h(i1)+h(i2)h(i)=h(i_{1})+h(i_{2}).

Definition 5 (Shelf-based δ\delta-fractional packing).

Let δ(0,1)\delta\in(0,1) be a constant. Let KK be a set of rectangular items. Items in KL{iK:h(i)>δ}K_{L}\coloneqq\{i\in K:h(i)>\delta\} are said to be ‘δ\delta-large’ and items in KSKKLK_{S}\coloneqq K-K_{L} are said to be ‘δ\delta-small’. A δ\delta-fractional bin packing of KK is defined to be a packing of KK into bins where items in KLK_{L} can be sliced (recursively) using vertical cuts only, and items in KSK_{S} can be sliced (recursively) using both horizontal and vertical cuts.

A shelf is a rectangle of width 1 into which we can pack items such that the bottom edge of each item in the shelf touches the bottom edge of the shelf. A shelf can itself be packed into a bin. A δ\delta-fractional bin packing of KK is said to be shelf-based iff (all slices of) all items in KLK_{L} are packed into shelves, the shelves are packed into the bins, and items in KSK_{S} are packed outside the shelves (and inside the bins). Packing of items into a shelf SS is said to be tight iff the top edge of some item (or slice) in SS touches the top edge of SS.

Definition 6 (Structured packing).

Let KK be a set of rectangles and let PP be a packing of empty shelves into bins. Let HH be the set of heights of shelves in PP (note that HH is not a multiset, i.e., we only consider distinct heights of shelves). Then PP is said to be structured for (K,δ)(K,\delta) iff |H|1/δ2|H|\leq\lceil 1/\delta^{2}\rceil and each element in HH is the height of some δ\delta-large item in KK.

A shelf-based δ\delta-fractional packing of KK is said to be structured iff the shelves in the packing are structured for (K,δ)(K,\delta). Define soptδ(K)\operatorname{sopt}_{\delta}(K) to be the number of bins in the optimal structured δ\delta-fractional packing of KK.

𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} relies on the following key structural theorem. We formally prove it in Section A.2 and give an outline of the proof here.

Theorem 6 (Structural theorem).

Let II be a set of ddD items. Let δ(0,1)\delta\in(0,1) be a constant. Then soptδ(𝚛𝚘𝚞𝚗𝚍(I))<Tkd1(1+δ)optdBP(I)+1/δ2+1+δ\operatorname{sopt}_{\delta}(\operatorname{\mathtt{round}}(I))<T_{k}^{d-1}(1+\delta)\operatorname{opt}_{d\mathrm{BP}}(I)+\lceil 1/\delta^{2}\rceil+1+\delta.

Proof outline.

Let I^𝚛𝚘𝚞𝚗𝚍(I)\widehat{I}\coloneqq\operatorname{\mathtt{round}}(I). Let I^L\widehat{I}_{L} and I^S\widehat{I}_{S} be the δ\delta-large and δ\delta-small items in I^\widehat{I}, respectively.

We give a simple greedy algorithm to pack I^L\widehat{I}_{L} into shelves. Let JJ be the shelves output by this algorithm. We can treat JJ as a 1BP instance, and I^S\widehat{I}_{S} as a sliceable 1D item of size a(I^S)a(\widehat{I}_{S}). We prove that an optimal 1D bin packing of JI^SJ\cup\widehat{I}_{S} gives us an optimal shelf-based δ\delta-fractional packing of I^\widehat{I}.

We use linear grouping by Lueker and Fernandez de la Vega [15]. We partition JJ into linear groups of size δsize(J)+1\left\lfloor\delta\operatorname{size}(J)\right\rfloor+1 each. Let hjh_{j} be the height of the first 1D item in the jthj^{\textrm{th}} group. Let J(hi)J^{\mathrm{(hi)}} be the 1BP instance obtained by rounding up the height of each item in the jthj^{\textrm{th}} group to hjh_{j} for all jj. Then J(hi)J^{\mathrm{(hi)}} contains at most 1/δ2\lceil 1/\delta^{2}\rceil distinct sizes, so the optimal packing of J(hi)I^SJ^{\mathrm{(hi)}}\cup\widehat{I}_{S} gives us a structured δ\delta-fractional packing of I^\widehat{I}. Therefore, soptδ(I^)opt(J(hi)I^S)\operatorname{sopt}_{\delta}(\widehat{I})\leq\operatorname{opt}(J^{\mathrm{(hi)}}\cup\widehat{I}_{S}). Let J(lo)J^{\mathrm{(lo)}} be the 1BP instance obtained by rounding down the height of each item in the jthj^{\textrm{th}} group to hj+1h_{j+1} for all jj. We prove that J(lo)J^{\mathrm{(lo)}} contains at most 1/δ21\lceil 1/\delta^{2}\rceil-1 distinct sizes and that opt(J(hi)I^S)<opt(J(lo)I^S)+δa(I^L)+(1+δ)\operatorname{opt}(J^{\mathrm{(hi)}}\cup\widehat{I}_{S})<\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})+\delta a(\widehat{I}_{L})+(1+\delta).

We model packing J(lo)I^SJ^{\mathrm{(lo)}}\cup\widehat{I}_{S} as a linear program, denoted by LP(I^)\operatorname{LP}(\widehat{I}), that has at most 1/δ21/δ\lceil 1/\delta^{2}\rceil^{1/\delta} variables and 1/δ2\lceil 1/\delta^{2}\rceil non-trivial constraints. The optimum extreme point solution to LP(I^)\operatorname{LP}(\widehat{I}), therefore, has at most 1/δ2\lceil 1/\delta^{2}\rceil positive entries, so opt(J(lo)I^S)opt(LP(I^))+1/δ2\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})\leq\operatorname{opt}(\operatorname{LP}(\widehat{I}))+\lceil 1/\delta^{2}\rceil.

We use techniques from Caprara [8] to obtain a monotonic weighting function η\eta from the optimal solution to the dual of LP(I^)\operatorname{LP}(\widehat{I}). For each item iIi\in I, we define p(i)w(i)η(h(i))p(i)\coloneqq w(i)\eta(h(i)) and prove that p(I)opt(LP(I^))p(I)\geq\operatorname{opt}(\operatorname{LP}(\widehat{I})). By Theorem 1, we get that p(I)Tkd1optdBP(I)p(I)\leq T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I) and a(I^L)Tkd1optdBP(I)a(\widehat{I}_{L})\leq T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I). Combining the above facts gives us an upper-bound on soptδ(I^)\operatorname{sopt}_{\delta}(\widehat{I}) in terms of optdBP(I)\operatorname{opt}_{d\mathrm{BP}}(I). ∎

5.2 Subroutines

5.2.1 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}}

The algorithm 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) takes a set ^\widehat{\mathcal{I}} of 2D itemsets and a constant δ(0,1)\delta\in(0,1) as input. We will design 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} so that it satisfies the following theorem.

Theorem 7.

𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) returns all possible packings of empty shelves into at most |^||\widehat{\mathcal{I}}| bins such that each packing is structured for (flat(^),δ)(\operatorname{flat}(\widehat{\mathcal{I}}),\delta). 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) returns at most T(N1/δ2+1)(n+1)RT\coloneqq(N^{\lceil 1/\delta^{2}\rceil}+1)(n+1)^{R} packings, where N|flat(^)|N\coloneqq|\operatorname{flat}(\widehat{\mathcal{I}})|, n|^|n\coloneqq|\widehat{\mathcal{I}}|, and R(1/δ2+1/δ11/δ1)(1+1/δ2)1/δR\coloneqq\binom{\lceil 1/\delta^{2}\rceil+\left\lceil 1/\delta\right\rceil-1}{\left\lceil 1/\delta\right\rceil-1}\leq(1+\lceil 1/\delta^{2}\rceil)^{1/\delta}. Its running time is O(T)O(T).

𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} works by first guessing at most 1/δ2\lceil 1/\delta^{2}\rceil distinct heights of shelves. It then enumerates all configurations, i.e., different ways in which shelves can be packed into a bin. It then guesses the configurations in a bin packing of the shelves. 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} can be easily implemented using standard techniques. For the sake of completeness, we give a more precise description of 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} and prove Theorem 7 in Section A.3.

5.2.2 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}}

𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) takes as input a set ^\widehat{\mathcal{I}} of 2D itemsets, a constant δ(0,1)\delta\in(0,1), and a bin packing PP of empty shelves that is structured for (flat(^),δ)(\operatorname{flat}(\widehat{\mathcal{I}}),\delta). It tries to pack an assortment of ^\widehat{\mathcal{I}} into the shelves in PP.

𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}} works by rounding up the width of all δ\delta-large items in ^\widehat{\mathcal{I}} to a multiple of 1/n1/n. This would increase the number of shelves required by 1, so it adds another empty shelf. It then uses dynamic programming to pack an assortment into the shelves, such that the area of the chosen δ\delta-small items is minimum. This is done by maintaining a dynamic programming table that keeps track of the number of itemsets considered so far and the remaining space in shelves of each type. If it is not possible to pack the items into the shelves, then 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}} outputs null. In Section A.4, we give the details of this algorithm and formally prove the following theorems:

Theorem 8.

If there exists an assortment K^\widehat{K} of ^\widehat{\mathcal{I}} having a structured δ\delta-fractional bin packing PP, then 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) does not output null.

Theorem 9.

If the output of 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) is not null, then the output P¯\overline{P} is a shelf-based δ\delta-fractional packing of some assortment of ^\widehat{\mathcal{I}} such that |P¯||P|+1|\overline{P}|\leq|P|+1 and the distinct shelf heights in P¯\overline{P} are the same as that in PP.

Theorem 10.

𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) runs in O(Nn21/δ2)O(Nn^{2\lceil 1/\delta^{2}\rceil}) time. Here N|flat(^)|N\coloneqq|\operatorname{flat}(\widehat{\mathcal{I}})|, n|^|n\coloneqq|\widehat{\mathcal{I}}|.

5.2.3 𝚒𝚗𝚏𝚕𝚊𝚝𝚎\operatorname{\mathtt{inflate}}

For a set II of ddD items, 𝚒𝚗𝚏𝚕𝚊𝚝𝚎\operatorname{\mathtt{inflate}} is an algorithm that converts a shelf-based packing of 𝚛𝚘𝚞𝚗𝚍(I)\operatorname{\mathtt{round}}(I) into a packing of II having roughly the same number of bins.

For a ddD item ii, btype(i)\operatorname{btype}(i) (called base type) is defined to be a (d1)(d-1)-dimensional vector whose jthj^{\textrm{th}} component is typek(j(i))\operatorname{type}_{k}(\ell_{j}(i)). Roughly, 𝚒𝚗𝚏𝚕𝚊𝚝𝚎(P)\operatorname{\mathtt{inflate}}(P) works as follows: It first slightly modifies the packing PP so that items of different base types are in different shelves and δ\delta-small items are no longer sliced using horizontal cuts. Then it converts each 2D shelf to a ddD shelf of the same height using HDH-unit-packk\operatorname{\hyperref@@ii[sec:hdhk-prelims:hdhkunit]{\mathtt{HDH-unit-pack}}}_{k} (a ddD shelf is a cuboid where the first d1d-1 dimensions are equal to 1).

In Section A.5, we formally describe 𝚒𝚗𝚏𝚕𝚊𝚝𝚎\operatorname{\mathtt{inflate}} and prove the following theorem.

Theorem 11.

Let II be a set of ddD items having QQ distinct base types (there can be at most kd1k^{d-1} distinct base types, so Qkd1Q\leq k^{d-1}). Let PP be a shelf-based δ\delta-fractional packing of 𝚛𝚘𝚞𝚗𝚍(I)\operatorname{\mathtt{round}}(I) where shelves have tt distinct heights. Then 𝚒𝚗𝚏𝚕𝚊𝚝𝚎(P)\operatorname{\mathtt{inflate}}(P) returns a packing of II into less than |P|/(1δ)+t(Q1)+1+δQ/(1δ)|P|/(1-\delta)+t(Q-1)+1+\delta Q/(1-\delta) bins in O(|I|dlog|I|)O(|I|d\log|I|) time.

Now that we have mentioned the guarantees of all the subroutines used by 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}, we can prove the correctness and running time of 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}.

5.3 Correctness and Running Time of 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}

Theorem 12.

The number of bins used by 𝙷𝙶𝚊𝙿k(,ε)\operatorname{\mathtt{HGaP}}_{k}(\mathcal{I},\varepsilon) to pack \mathcal{I} is less than

Tkd1(1+ε)optdMCBP()+(2ε+1)2(Q+ε2)+3+(Q+3)ε2.T_{k}^{d-1}(1+\varepsilon)\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})+\left\lceil\left(\frac{2}{\varepsilon}+1\right)^{2}\right\rceil\left(Q+\frac{\varepsilon}{2}\right)+3+(Q+3)\frac{\varepsilon}{2}.

Here Qkd1Q\leq k^{d-1} is the number of distinct base types in flat()\operatorname{flat}(\mathcal{I}).

Proof.

Let KK^{*} be the assortment in an optimal bin packing of \mathcal{I}. Let K^=𝚛𝚘𝚞𝚗𝚍(K)\widehat{K}^{*}=\operatorname{\mathtt{round}}(K^{*}). Let PP^{*} be the optimal structured δ\delta-fractional bin packing of K^\widehat{K}^{*}. Then |P|=soptδ(K^)|P^{*}|=\operatorname{sopt}_{\delta}(\widehat{K}^{*}) by the definition of sopt\operatorname{sopt}. By Theorem 7, P𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)P^{*}\in\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta). Let P¯=𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\overline{P}^{*}=\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P^{*},\delta). By Theorem 8, P¯\overline{P}^{*} is not null. By Theorem 9, PbestP_{\mathrm{best}} is structured for (flat(^),δ)(\operatorname{flat}(\widehat{\mathcal{I}}),\delta) and |Pbest||P¯|soptδ(K^)+1|P_{\mathrm{best}}|\leq|\overline{P}^{*}|\leq\operatorname{sopt}_{\delta}(\widehat{K}^{*})+1.

By Theorem 11, we get that

|𝚒𝚗𝚏𝚕𝚊𝚝𝚎(Pbest)|<soptδ(K^)1δ+1δ2(Q1)+1+δQ+11δ.|\operatorname{\mathtt{inflate}}(P_{\mathrm{best}})|<\frac{\operatorname{sopt}_{\delta}(\widehat{K}^{*})}{1-\delta}+\left\lceil\frac{1}{\delta^{2}}\right\rceil(Q-1)+1+\frac{\delta Q+1}{1-\delta}.

By Theorem 6 (structural theorem) and using optdBP(K)=optdMCBP()\operatorname{opt}_{d\mathrm{BP}}(K^{*})=\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I}), we get

soptδ(K^)<Tkd1(1+δ)optdMCBP()+1/δ2+1+δ.\operatorname{sopt}_{\delta}(\widehat{K}^{*})<T_{k}^{d-1}(1+\delta)\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})+\lceil 1/\delta^{2}\rceil+1+\delta.

Therefore, |𝚒𝚗𝚏𝚕𝚊𝚝𝚎(Pbest)||\operatorname{\mathtt{inflate}}(P_{\mathrm{best}})| is less than

Tkd11+δ1δoptdMCBP()+1δ2(Q+δ1δ)+3+δ(3+Q)1δ\displaystyle T_{k}^{d-1}\frac{1+\delta}{1-\delta}\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})+\left\lceil\frac{1}{\delta^{2}}\right\rceil\left(Q+\frac{\delta}{1-\delta}\right)+3+\frac{\delta(3+Q)}{1-\delta}
=Tkd1(1+ε)optdMCBP()+(2ε+1)2(Q+ε2)+3+(Q+3)ε2.\displaystyle=T_{k}^{d-1}(1+\varepsilon)\operatorname{opt}_{d\mathrm{MCBP}}(\mathcal{I})+\left\lceil\left(\frac{2}{\varepsilon}+1\right)^{2}\right\rceil\left(Q+\frac{\varepsilon}{2}\right)+3+(Q+3)\frac{\varepsilon}{2}.\qed
Theorem 13.

𝙷𝙶𝚊𝙿k(,ε)\operatorname{\mathtt{HGaP}}_{k}(\mathcal{I},\varepsilon) runs in time O(N1+1/δ2nR+21/δ2+Nd+ndlogn)O(N^{1+\lceil 1/\delta^{2}\rceil}n^{R+2\lceil 1/\delta^{2}\rceil}+Nd+nd\log n), where n|^|n\coloneqq|\widehat{\mathcal{I}}|, N|flat(^)|N\coloneqq|\operatorname{flat}(\widehat{\mathcal{I}})|, δε/(2+ε)\delta\coloneqq\varepsilon/(2+\varepsilon) and R(1/δ2+1/δ11/δ1)(1+1/δ2)1/δR\coloneqq\binom{\lceil 1/\delta^{2}\rceil+\left\lceil 1/\delta\right\rceil-1}{\left\lceil 1/\delta\right\rceil-1}\leq(1+\lceil 1/\delta^{2}\rceil)^{1/\delta}.

Proof.

Follows from Theorems 7, 10 and 11. ∎

LABEL:sec:hgap:improve-time gives hints on improving the running time of 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}.

5.4 ddBP with Rotations

We can solve the rotational version of ddBP by reducing it to ddMCBP and using the 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} algorithm. Since each item can have up to d!d! orientations, the running time is polynomial in nd!nd!, which is large when dd is large. But we can do better for some special cases.

When the bin has the same length in each dimension, then for any item ii, w(i)j=1d1fk(j(i))w(i)\coloneqq\prod_{j=1}^{d-1}f_{k}(\ell_{j}(i)) is invariant to permuting the first d1d-1 dimensions. In the first step of 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}, we replace each ddD item ii by a rectangle of width w(i)w(i) and height d(i)\ell_{d}(i). So, instead of considering all d!d! orientations, we just need to consider at most dd different orientations, where each orientation has a different length in the dthd^{\textrm{th}} dimension.

Suppose there are no orientation constraints, i.e., all d!d! orientations of each item are allowed. Let LjL_{j} be the length of the bin in the jthj^{\textrm{th}} dimension, for each j[d]j\in[d]. Analogous to the trick in Section 4.1, we first fix the dthd^{\textrm{th}} dimension of the item and then optimally permute the first d1d-1 dimensions using a max-weight bipartite matching algorithm. Hence, we need to consider only dd orientations instead of d!d!.

References

  • [1] Mauro Maria Baldi, Guido Perboli, and Roberto Tadei. The three-dimensional knapsack problem with balancing constraints. Applied Mathematics and Computation, 218(19):9802–9818, 2012. doi:10.1016/j.amc.2012.03.052.
  • [2] János Balogh, József Békési, György Dósa, Leah Epstein, and Asaf Levin. A new and improved algorithm for online bin packing. In ESA, pages 5:1–5:14, 2018. doi:10.4230/LIPIcs.ESA.2018.5.
  • [3] Nikhil Bansal, Alberto Caprara, and Maxim Sviridenko. A new approximation method for set covering problems, with applications to multidimensional bin packing. SIAM Journal on Computing, 39(4):1256–1278, 2010. doi:10.1137/080736831.
  • [4] Nikhil Bansal, Xin Han, Kazuo Iwama, Maxim Sviridenko, and Guochuan Zhang. A harmonic algorithm for the 3d strip packing problem. SIAM J. Comput., 42(2):579–592, 2013. doi:10.1137/070691607.
  • [5] Nikhil Bansal and Arindam Khan. Improved approximation algorithm for two-dimensional bin packing. In SODA, pages 13–25, 2014. doi:10.1137/1.9781611973402.2.
  • [6] Nikhil Bansal and Maxim Sviridenko. New approximability and inapproximability results for 2-dimensional bin packing. In SODA, pages 196–203, 2004.
  • [7] Andreas Bortfeldt and Gerhard Wäscher. Constraints in container loading–a state-of-the-art review. European Journal of Operational Research, 229(1):1–20, 2013. doi:10.1016/j.ejor.2012.12.006.
  • [8] Alberto Caprara. Packing dd-dimensional bins in dd stages. Mathematics of Operations Research - MOR, 33:203–215, 02 2008. doi:10.1287/moor.1070.0289.
  • [9] Edward G. Coffman, János Csirik, Gábor Galambos, Silvano Martello, and Daniele Vigo. Bin packing approximation algorithms: survey and classification. In Handbook of combinatorial optimization, pages 455–531. Springer New York, 2013.
  • [10] Edward G. Coffman, Michael R. Garey, David S. Johnson, and Robert E. Tarjan. Performance bounds for level-oriented two-dimensional packing algorithms. SIAM Journal on Computing, 9:808–826, 1980. doi:10.1137/0209062.
  • [11] János Csirik and André van Vliet. An on-line algorithm for multidimensional bin packing. Oper. Res. Lett., 13(3):149–158, 1993. doi:10.1016/0167-6377(93)90004-Z.
  • [12] Leah Epstein and Rob van Stee. Optimal online algorithms for multidimensional packing problems. SIAM J. Comput., 35(2):431–448, 2005. doi:10.1137/S0097539705446895.
  • [13] Leah Epstein and Rob van Stee. This side up! ACM Trans. Algorithms, 2(2):228–243, 2006. doi:10.1145/1150334.1150339.
  • [14] Sándor P. Fekete and Jörg Schepers. A general framework for bounds for higher-dimensional orthogonal packing problems. Mathematical Methods of Operations Research, 60(2):311–329, 2004. doi:10.1007/s001860400376.
  • [15] Wenceslas Fernandez de la Vega and George S. Lueker. Bin packing can be solved within 1+ ε\varepsilon in linear time. Combinatorica, 1(4):349–355, 1981. doi:10.1007/BF02579456.
  • [16] Paul C. Gilmore and Ralph E. Gomory. A linear programming approach to the cutting-stock problem. Operations research, 9(6):849–859, 1961. doi:10.1287/opre.9.6.849.
  • [17] Xin Han, Francis YL Chin, Hing-Fung Ting, Guochuan Zhang, and Yong Zhang. A new upper bound 2.5545 on 2D online bin packing. ACM Transactions on Algorithms (TALG), 7(4):1–18, 2011. doi:10.1145/2000807.2000818.
  • [18] Klaus Jansen. A (3/2+ε)(3/2+\varepsilon) approximation algorithm for scheduling moldable and non-moldable parallel tasks. In SPAA, pages 224–235, 2012. doi:10.1145/2312005.2312048.
  • [19] Klaus Jansen and Lars Prädel. New approximability results for two-dimensional bin packing. In SODA, pages 919–936, 2013. doi:10.1007/s00453-014-9943-z.
  • [20] Klaus Jansen and Lars Prädel. A new asymptotic approximation algorithm for 3-dimensional strip packing. In SOFSEM, pages 327–338, 2014. doi:10.1007/978-3-319-04298-5_29.
  • [21] Klaus Jansen and Rob van Stee. On strip packing with rotations. In STOC, pages 755–761. ACM, 2005. doi:10.1145/1060590.1060702.
  • [22] Claire Kenyon and Eric Rémila. Approximate strip packing. In FOCS, pages 31–36, 1996. doi:10.1109/SFCS.1996.548461.
  • [23] Eugene L Lawler. Fast approximation algorithms for knapsack problems. Mathematics of Operations Research, 4(4):339–356, 1979. doi:10.1287/moor.4.4.339.
  • [24] C. C. Lee and D. T. Lee. A simple on-line bin-packing algorithm. J. ACM, 32(3):562–572, July 1985. doi:10.1145/3828.3833.
  • [25] Flavio Keidi Miyazawa and Yoshiko Wakabayashi. Three-dimensional packings with rotations. Computers & Operations Research, 36(10):2801–2815, 2009. doi:10.1016/j.cor.2008.12.015.
  • [26] James Munkres. Algorithms for the assignment and transportation problems. Journal of the Society for Industrial and Applied Mathematics, 5(1):32–38, 1957.
  • [27] Boaz Patt-Shamir and Dror Rawitz. Vector bin packing with multiple-choice. Discrete Applied Mathematics, 160(10-11):1591–1600, 2012. doi:10.1016/j.dam.2012.02.020.
  • [28] Prakash Ramanan, Donna J Brown, Chung-Chieh Lee, and Der-Tsai Lee. On-line bin packing in linear time. Journal of Algorithms, 10(3):305–326, 1989. doi:10.1016/0196-6774(89)90031-X.
  • [29] Steven S Seiden. On the online bin packing problem. Journal of the ACM (JACM), 49(5):640–671, 2002. doi:10.1145/585265.585269.
  • [30] Y. G. Stoyan and Andrey M. Chugay. Packing different cuboids with rotations and spheres into a cuboid. Advances in Decision Sciences, 2014, 2014.
  • [31] Hu Zhang and Klaus Jansen. Scheduling malleable tasks. In Handbook of Approximation Algorithms and Metaheuristics. Chapman & Hall/CRC, 2007.

Appendix A Details of the 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k} Algorithm

This section gives details of the subroutines used by 𝙷𝙶𝚊𝙿k\operatorname{\mathtt{HGaP}}_{k}. It also proves the theorems claimed in Section 5.

A.1 Preliminaries

Definition 7.

Let I1I_{1} and I2I_{2} be sets of 1D items. Then I1I_{1} is defined to be a predecessor of I2I_{2} (denoted as I1I2I_{1}\preceq I_{2}) iff there exists a one-to-one mapping π:I1I2\pi:I_{1}\mapsto I_{2} such that iI1,size(i)size(π(i))\forall i\in I_{1},\operatorname{size}(i)\leq\operatorname{size}(\pi(i)).

Observation 14.

Let I1I2I_{1}\preceq I_{2} where π\pi is the corresponding mapping. Then we can obtain a packing of I1I_{1} from a packing of I2I_{2}, by packing each item iI1i\in I_{1} in the place of π(i)\pi(i). Hence, opt(I1)opt(I2)\operatorname{opt}(I_{1})\leq\operatorname{opt}(I_{2}).

Definition 8 (Canonical shelving).

Let II be a set of rectangles. Order the items in II in non-increasing order of height (break ties arbitrarily but deterministically) and greedily pack them into tight shelves, slicing items using vertical cuts if necessary. The set of shelves thus obtained is called the canonical shelving of II, and is denoted by canshelv(I)\operatorname{can-shelv}(I). (The canonical shelving is unique because ties are broken deterministically.)

See Fig. 3 for an example of canonical shelving.

10.320.430.440.550.960.251230.3345560.5
Figure 3: Six items and their canonical shelving into three tight shelves of width 1. The items are numbered by decreasing order of height. Each item has its width mentioned below it. Item 3 was sliced into two items of widths 0.3 and 0.1. Item 5 was sliced into two items of widths 0.4 and 0.5.

Suppose a set II of rectangular items is packed into a set JJ of shelves. Then we can interpret JJ as a 1BP instance where the height of each shelf is the size of the corresponding 1D item. We will now prove that the canonical shelving is optimal, i.e., any shelf-based bin packing of items can be obtained by first computing the canonical shelving and then packing the shelves into bins like a 1BP instance.

Lemma 15.

Let II be a set of rectangles packed inside shelves JJ. Let Jcanshelv(I)J^{*}\coloneqq\operatorname{can-shelv}(I). Then JJJ^{*}\preceq J.

Proof.

We say that a shelf is full if the total width of items in a shelf is 1. Arrange the shelves JJ in non-increasing order of height, and arrange the items II in non-increasing order of height. Then try to pack II into JJ using the following greedy algorithm: For each item ii, pack the largest possible slice of ii into the first non-full shelf and pack the remaining slice (if any) in the next shelf. If this greedy algorithm succeeds, then within each shelf of JJ, there is a shelf of JJ^{*}, so JJJ^{*}\preceq J. We will now prove that this greedy algorithm always succeeds.

For the sake of proof by contradiction, assume that the greedy algorithm failed, i.e., for an item (or slice) ii there was a non-full shelf SS but h(i)>h(S)h(i)>h(S). Let II^{\prime} be the items (and slices) packed before ii and JJ^{\prime} be the shelves before SS. Therefore, w(I)=|J|w(I^{\prime})=|J^{\prime}|.

All items in II^{\prime} have height at least h(i)h(i), so all shelves in JJ^{\prime} have height at least h(i)h(i). All shelves after JJ^{\prime} have height less than h(i)h(i). Therefore, JJ^{\prime} is exactly the set of shelves of height at least h(i)h(i).

In the packing PP, I{i}I^{\prime}\cup\{i\} can only be packed into shelves of height at least h(i)h(i), so w(I)+w(i)|J|w(I^{\prime})+w(i)\leq|J^{\prime}|. But this contradicts w(I)=|J|w(I^{\prime})=|J^{\prime}|. Therefore, the greedy algorithm cannot fail. ∎

Lemma 16.

Consider the inequality x1+x2++xnsx_{1}+x_{2}+\ldots+x_{n}\leq s, where for each j[n]j\in[n], xj0x_{j}\in\mathbb{Z}_{\geq 0}. Let NN be the number of solutions to this inequality. Then N=(s+nn)(s+1)nN=\binom{s+n}{n}\leq(s+1)^{n}.

Proof.

The proof of N=(s+nn)N=\binom{s+n}{n} is a standard result in combinatorics.

To prove N(s+1)nN\leq(s+1)^{n}, note that we can choose each xj{0,1,,s}x_{j}\in\{0,1,\ldots,s\} independently. ∎

A.2 Structural Theorem

Let II be a set of ddD items. Let I^𝚛𝚘𝚞𝚗𝚍(I)\widehat{I}\coloneqq\operatorname{\mathtt{round}}(I). Let δ(0,1)\delta\in(0,1) be a constant. Let I^L{iI^:h(i)>δ}\widehat{I}_{L}\coloneqq\{i\in\widehat{I}:h(i)>\delta\} and I^SI^I^L\widehat{I}_{S}\coloneqq\widehat{I}-\widehat{I}_{L}. Let Jcanshelv(I^L)J\coloneqq\operatorname{can-shelv}(\widehat{I}_{L}). Let m|J|m\coloneqq|J|, i.e., JJ contains mm shelves. We can interpret I^S\widehat{I}_{S} as a single sliceable 1D item of size a(I^S)a(\widehat{I}_{S}).

We will show the existence of a structured δ\delta-fractional packing of I^\widehat{I} into at most Tkd1(1+δ)optdBP(I)+1/δ2+1+δT_{k}^{d-1}(1+\delta)\operatorname{opt}_{d\mathrm{BP}}(I)+\lceil 1/\delta^{2}\rceil+1+\delta bins. This would prove Theorem 6.

Definition 9 (Linear grouping [15]).

Arrange the 1D items JJ in non-increasing order of size and number them from 1 to mm. Let qδsize(J)+1q\coloneqq\left\lfloor\delta\operatorname{size}(J)\right\rfloor+1. Let J1J_{1} be the first qq items, J2J_{2} be the next qq items, and so on. JjJ_{j} is called the jthj^{\textrm{th}} linear group of JJ. This gives us tm/qt\coloneqq\left\lceil m/q\right\rceil linear groups. Note that the last group, JtJ_{t}, may have less than qq items.

Let hjh_{j} be the size of the first item in JjJ_{j}. Let ht+10h_{t+1}\coloneqq 0. For j[t1]j\in[t-1], let Jj(lo)J_{j}^{\mathrm{(lo)}} be the items obtained by decreasing the height of items in JjJ_{j} to hj+1h_{j+1}. For j[t]j\in[t], let Jj(hi)J_{j}^{\mathrm{(hi)}} be the items obtained by increasing the height of items in JjJ_{j} to hjh_{j}.

Let J(lo)j=1t1Jj(lo){J^{\mathrm{(lo)}}\coloneqq\bigcup_{j=1}^{t-1}J_{j}^{\mathrm{(lo)}}} and J(hi)j=1tJj(hi){J^{\mathrm{(hi)}}\coloneqq\bigcup_{j=1}^{t}J_{j}^{\mathrm{(hi)}}}. We call J(lo)J^{\mathrm{(lo)}} a down-rounding of JJ and J(hi)J^{\mathrm{(hi)}} an up-rounding of JJ.

Lemma 17.

t1/δ2t\leq\lceil 1/\delta^{2}\rceil.

Proof.

Since each shelf in JJ has height more than δ\delta, size(J)>|J|δ\operatorname{size}(J)>|J|\delta.

t|J|δsize(J)+1size(J)/δδsize(J)=1δ2.t\coloneqq\left\lceil\frac{|J|}{\left\lfloor\delta\operatorname{size}(J)\right\rfloor+1}\right\rceil\leq\left\lceil\frac{\operatorname{size}(J)/\delta}{\delta\operatorname{size}(J)}\right\rceil=\left\lceil\frac{1}{\delta^{2}}\right\rceil.\qed
Lemma 18.

J(lo)JJ(hi)J(lo)J1(hi)J^{\mathrm{(lo)}}\preceq J\preceq J^{\mathrm{(hi)}}\preceq J^{\mathrm{(lo)}}\cup J_{1}^{\mathrm{(hi)}}.

Proof.

It is trivial to see that J(lo)JJ(hi)J^{\mathrm{(lo)}}\preceq J\preceq J^{\mathrm{(hi)}}. For j[t1]j\in[t-1], all (1D) items in both Jj(lo)J_{j}^{\mathrm{(lo)}} and Jj+1(hi)J_{j+1}^{\mathrm{(hi)}} have height hj+1h_{j+1}, and |Jj+1|q=|Jj||J_{j+1}|\leq q=|J_{j}|. Therefore, Jj+1(hi)Jj(lo)J_{j+1}^{\mathrm{(hi)}}\preceq J_{j}^{\mathrm{(lo)}} and hence

J(hi)=J1(hi)j=1t1Jj+1(hi)J1(hi)j=1t1Jj(lo)=J1(hi)J(lo).J^{\mathrm{(hi)}}=J_{1}^{\mathrm{(hi)}}\cup\bigcup_{j=1}^{t-1}J_{j+1}^{\mathrm{(hi)}}\preceq J_{1}^{\mathrm{(hi)}}\cup\bigcup_{j=1}^{t-1}J_{j}^{\mathrm{(lo)}}=J_{1}^{\mathrm{(hi)}}\cup J^{\mathrm{(lo)}}.\qed
Lemma 19.

size(J)<1+a(I^L)\operatorname{size}(J)<1+a(\widehat{I}_{L}).

Proof.

In the canonical shelving of I^L\widehat{I}_{L}, let SjS_{j} be the jthj^{\textrm{th}} shelf. Let h(Sj)h(S_{j}) be the height of SjS_{j}. Let a(Sj)a(S_{j}) be the total area of the items in SjS_{j}. Since the shelves are tight, items in SjS_{j} have height at least h(Sj+1)h(S_{j+1}). So, a(Sj)h(Sj+1)a(S_{j})\geq h(S_{j+1}) and

size(J)=j=1|J|h(Sj)1+j=1|J|1h(Sj+1)1+j=1|J|1a(Sj)<1+a(I^L).\operatorname{size}(J)=\sum_{j=1}^{|J|}h(S_{j})\leq 1+\sum_{j=1}^{|J|-1}h(S_{j+1})\leq 1+\sum_{j=1}^{|J|-1}a(S_{j})<1+a(\widehat{I}_{L}).\qed
Lemma 20.

soptδ(I^)<opt(J(lo)I^S)+δa(I^L)+(1+δ)\operatorname{sopt}_{\delta}(\widehat{I})<\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})+\delta a(\widehat{I}_{L})+(1+\delta).

Proof.

By the definition of canshelv\operatorname{can-shelv}, I^L\widehat{I}_{L} can be packed into JJ. By Lemma 18, JJ(hi)J\preceq J^{\mathrm{(hi)}}, so I^L\widehat{I}_{L} can be packed into J(hi)J^{\mathrm{(hi)}}. By Lemma 17, the number of distinct sizes in J(hi)J^{\mathrm{(hi)}} is at most 1/δ2\lceil 1/\delta^{2}\rceil. So, the optimal 1D bin packing of J(hi)I^SJ^{\mathrm{(hi)}}\cup\widehat{I}_{S} will give us a structured δ\delta-fractional bin packing of I^\widehat{I}. Hence, soptδ(I^)opt(J(hi)I^S)\operatorname{sopt}_{\delta}(\widehat{I})\leq\operatorname{opt}(J^{\mathrm{(hi)}}\cup\widehat{I}_{S}).

By Lemmas 18 and 14 we get

opt(J(hi)I^S)opt(J(lo)J1(hi)I^S)opt(J(lo)I^S)+opt(J1(hi)).\operatorname{opt}(J^{\mathrm{(hi)}}\cup\widehat{I}_{S})\leq\operatorname{opt}(J^{\mathrm{(lo)}}\cup J_{1}^{\mathrm{(hi)}}\cup\widehat{I}_{S})\leq\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})+\operatorname{opt}(J_{1}^{\mathrm{(hi)}}).

By Lemma 19,

opt(J1(hi))|J1(hi)|q1+δsize(J)<1+δ(1+a(I^L)).\operatorname{opt}(J_{1}^{\mathrm{(hi)}})\leq|J_{1}^{\mathrm{(hi)}}|\leq q\leq 1+\delta\operatorname{size}(J)<1+\delta(1+a(\widehat{I}_{L})).\qed

A.2.1 LP for Packing J(lo)I^SJ^{\mathrm{(lo)}}\cup\widehat{I}_{S}

We will formulate an integer linear program for bin packing J(lo)I^SJ^{\mathrm{(lo)}}\cup\widehat{I}_{S}.

Let C0t1C\in\mathbb{Z}_{\geq 0}^{t-1} such that hCj=1t1Cjhj+11h_{C}\coloneqq\sum_{j=1}^{t-1}C_{j}h_{j+1}\leq 1. Then CC is called a configuration. CC represents a set of 1D items that can be packed into a bin and where CjC_{j} items are from Jj(lo)J_{j}^{\mathrm{(lo)}}. Let 𝒞\mathcal{C} be the set of all configurations. We can pack at most 1/δ1\left\lceil 1/\delta\right\rceil-1 items into a bin because ht>δh_{t}>\delta. By Lemma 16, we get |𝒞|(1/δ1+t1t1)1/δ21/δ|\mathcal{C}|\leq\binom{\left\lceil 1/\delta\right\rceil-1+t-1}{t-1}\leq\lceil 1/\delta^{2}\rceil^{1/\delta}.

Let xCx_{C} be the number of bins packed according to configuration CC. Bin packing J(lo)I^SJ^{\mathrm{(lo)}}\cup\widehat{I}_{S} is equivalent to finding the optimal integer solution to the following linear program, which we denote as LP(I^)\operatorname{LP}(\widehat{I}).

minx|𝒞|C𝒞xCwhere C𝒞CjxCqj[t1]C𝒞(1hC)xCa(I^S)xC0C𝒞\begin{array}[]{*3{>{\displaystyle}l}}\min_{x\in\mathbb{R}^{|\mathcal{C}|}}&\sum_{C\in\mathcal{C}}x_{C}\\[15.00002pt] \textrm{where }&\sum_{C\in\mathcal{C}}C_{j}x_{C}\geq q&\forall j\in[t-1]\\[15.00002pt] &\sum_{C\in\mathcal{C}}(1-h_{C})x_{C}\geq a(\widehat{I}_{S})\\[10.00002pt] &x_{C}\geq 0&\forall C\in\mathcal{C}\end{array}

Here the first set of constraints say that for each j[t1]j\in[t-1], all of the qδsize(J)+1q\coloneqq\left\lfloor\delta\operatorname{size}(J)\right\rfloor+1 shelves J(lo)jJ^{\mathrm{(lo)}}_{j} should be covered by the configurations in xx. The second constraint says that we should be able to pack a(I^S)a(\widehat{I}_{S}) into the non-shelf space in the bins.

Lemma 21.

opt(J(lo)I^S)opt(LP(I^))+t\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})\leq\operatorname{opt}(\operatorname{LP}(\widehat{I}))+t.

Proof.

Let xx^{*} be an optimal extreme-point solution to LP(I^)\operatorname{LP}(\widehat{I}). By rank-lemma, xx^{*} has at most tt non-zero entries. Let x^\widehat{x} be a vector where x^CxC\widehat{x}_{C}\coloneqq\left\lceil x_{C}^{*}\right\rceil. Then x^\widehat{x} is an integral solution to LP(I^)\operatorname{LP}(\widehat{I}) and Cx^C<t+CxC=opt(LP(I^))+t\sum_{C}\widehat{x}_{C}<t+\sum_{C}x_{C}^{*}=\operatorname{opt}(\operatorname{LP}(\widehat{I}))+t. ∎

The dual of LP(I^)\operatorname{LP}(\widehat{I}), denoted by DLP(I^)\operatorname{DLP}(\widehat{I}), is

maxyt1,z\displaystyle\max_{y\in\mathbb{R}^{t-1},z\in\mathbb{R}} a(I^S)z+qj=1t1yj\displaystyle a(\widehat{I}_{S})z+q\sum_{j=1}^{t-1}y_{j}
where j=1t1Cjyj+(1hC)z1C𝒞\displaystyle\sum_{j=1}^{t-1}C_{j}y_{j}+(1-h_{C})z\leq 1\quad\forall C\in\mathcal{C}
z0 and yj0j[t1]\displaystyle z\geq 0\textrm{ and }y_{j}\geq 0\quad\forall j\in[t-1]

A.2.2 Weighting Function for a Feasible Solution to DLP(I^)\operatorname{DLP}(\widehat{I})

We will now see how to obtain a monotonic weighting function η:[0,1][0,1]\eta:[0,1]\mapsto[0,1] from a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}). To do this, we adapt techniques from Caprara’s analysis of 𝙷𝙳𝙷k\operatorname{\mathtt{HDH}}_{k} [8]. Such a weighting function will help us upper-bound opt(LP(I^))\operatorname{opt}(\operatorname{LP}(\widehat{I})) in terms of optdBP(I)\operatorname{opt}_{d\mathrm{BP}}(I).

We first describe a transformation that helps us convert any feasible solution of DLP(I^)\operatorname{DLP}(\widehat{I}) to a feasible solution that is monotonic. We then show how to obtain a weighting function from this monotonic solution.

Transformation 10.

Let (y,z)(y,z) be a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let s[t1]s\in[t-1]. Define yt0y_{t}\coloneqq 0 and ht+10h_{t+1}\coloneqq 0. Then change ysy_{s} to max(ys,ys+1+(hs+1hs+2)z)\max(y_{s},y_{s+1}+(h_{s+1}-h_{s+2})z).

Lemma 22.

Let (y,z)(y,z) be a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let (y^,z)(\widehat{y},z) be the new solution obtained by applying Transformation 10 with parameter s[t1]s\in[t-1]. Then (y^,z)(\widehat{y},z) is feasible for DLP(I^)\operatorname{DLP}(\widehat{I}).

Proof.

For a configuration CC, let f(C,y,z)CTy+(1hC)zf(C,y,z)\coloneqq C^{T}y+(1-h_{C})z, where CTyj=1t1CjyjC^{T}y\coloneqq\sum_{j=1}^{t-1}C_{j}y_{j}. Since (y,z)(y,z) is feasible for DLP(I^)\operatorname{DLP}(\widehat{I}), f(C,y,z)1f(C,y,z)\leq 1. As per Transformation 10,

y^j{max(ys,ys+1+(hs+1hs+2)z)j=syjjs.\widehat{y}_{j}\coloneqq\begin{cases}\max(y_{s},y_{s+1}+(h_{s+1}-h_{s+2})z)&j=s\\ y_{j}&j\neq s\end{cases}.

If ysys+1+(hs+1hs+2)zy_{s}\geq y_{s+1}+(h_{s+1}-h_{s+2})z, then y^=y\widehat{y}=y, so (y^,z)(\widehat{y},z) would be feasible for DLP(I^)\operatorname{DLP}(\widehat{I}). So now assume that ys<ys+1+(hs+1hs+2)zy_{s}<y_{s+1}+(h_{s+1}-h_{s+2})z.

Let CC be a configuration. Define Ct0C_{t}\coloneqq 0. Let

C^j{0j=sCs+Cs+1j=s+1Cjotherwise.\widehat{C}_{j}\coloneqq\begin{cases}0&j=s\\ C_{s}+C_{s+1}&j=s+1\\ C_{j}&\textrm{otherwise}\end{cases}.

Then, CTy^C^Ty=Csy^s+Cs+1y^s+1C^sysC^s+1ys+1=Cs(hs+1hs+2)zC^{T}\widehat{y}-\widehat{C}^{T}y=C_{s}\widehat{y}_{s}+C_{s+1}\widehat{y}_{s+1}-\widehat{C}_{s}y_{s}-\widehat{C}_{s+1}y_{s+1}=C_{s}(h_{s+1}-h_{s+2})z.

Also, hC^hC=C^shs+1+C^s+1hs+2Cshs+1Cs+1hs+2=Cs(hs+1hs+2)h_{\widehat{C}}-h_{C}=\widehat{C}_{s}h_{s+1}+\widehat{C}_{s+1}h_{s+2}-C_{s}h_{s+1}-C_{s+1}h_{s+2}=-C_{s}(h_{s+1}-h_{s+2}).

Since hC^hC1h_{\widehat{C}}\leq h_{C}\leq 1, C^\widehat{C} is a configuration.

f(C,y^,z)\displaystyle f(C,\widehat{y},z) =CTy^+(1hC)z\displaystyle=C^{T}\widehat{y}+(1-h_{C})z
=(C^Ty+Cs(hs+1hs+2)z)+(1hC^Cs(hs+1hs+2))z\displaystyle=(\widehat{C}^{T}y+C_{s}(h_{s+1}-h_{s+2})z)+(1-h_{\widehat{C}}-C_{s}(h_{s+1}-h_{s+2}))z
=f(C^,y,z)1.\displaystyle=f(\widehat{C},y,z)\leq 1.

Therefore, (y^,z)(\widehat{y},z) is feasible for DLP(I^)\operatorname{DLP}(\widehat{I}). ∎

Definition 11.

Let (y,z)(y,z) be a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let

y^j{max(yt1,zht)j=t1max(yj,y^j+1+(hj+1hj+2)z)j<t1.\widehat{y}_{j}\coloneqq\begin{cases}\max(y_{t-1},zh_{t})&j=t-1\\ \max(y_{j},\widehat{y}_{j+1}+(h_{j+1}-h_{j+2})z)&j<t-1\end{cases}.

Then (y^,z)(\widehat{y},z) is called the monotonization of (y,z)(y,z).

Lemma 23.

Let (y,z)(y,z) be a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let (y^,z)(\widehat{y},z) be the monotonization of (y,z)(y,z). Then (y^,z)(\widehat{y},z) is a feasible solution to DLP(I^)\operatorname{DLP}(\widehat{I}).

Proof.

(y^,z)(\widehat{y},z) can be obtained by multiple applications of Transformation 10: first with s=t1s=t-1, then with s=t2s=t-2, and so on till s=1s=1. Then by Lemma 22, (y^,z)(\widehat{y},z) is feasible for DLP(I^)\operatorname{DLP}(\widehat{I}). ∎

Let (y,z)(y^{*},z^{*}) be an optimal solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let (y^,z)(\widehat{y},z^{*}) be the monotonization of (y,z)(y^{*},z^{*}). Then define the function η:[0,1][0,1]\eta:[0,1]\mapsto[0,1] as

η(x){y^1if x[h2,1]y^jif x[hj+1,hj), for 2jt1xzif x<ht.\eta(x)\coloneqq\begin{cases}\widehat{y}_{1}&\textrm{if }x\in[h_{2},1]\\ \widehat{y}_{j}&\textrm{if }x\in[h_{j+1},h_{j}),\textrm{ for }2\leq j\leq t-1\\ xz^{*}&\textrm{if }x<h_{t}\end{cases}.
Lemma 24.

η\eta is a monotonic weighting function.

Proof.

η\eta is monotonic by the definition of monotonization.

Let X(0,1]X\subseteq(0,1] be a finite set such that sum(X)1\operatorname{sum}(X)\leq 1. Let X0X[0,ht)X_{0}\coloneqq X\cap[0,h_{t}), let X1X[h2,1]X_{1}\coloneqq X\cap[h_{2},1] and for 2jt12\leq j\leq t-1, let XjX[hj+1,hj)X_{j}\coloneqq X\cap[h_{j+1},h_{j}). Let Ct10C\in\mathbb{Z}^{t-1}_{\geq 0} such that Cj|Xj|C_{j}\coloneqq|X_{j}|. Let hCj=1t1Cjhj+1h_{C}\coloneqq\sum_{j=1}^{t-1}C_{j}h_{j+1}.

1sum(X)\displaystyle 1\geq\operatorname{sum}(X) =sum(X0)+j=1t1sum(Xj)\displaystyle=\operatorname{sum}(X_{0})+\sum_{j=1}^{t-1}\operatorname{sum}(X_{j})
sum(X0)+j=1t1Cjhj+1\displaystyle\geq\operatorname{sum}(X_{0})+\sum_{j=1}^{t-1}C_{j}h_{j+1} (for j1j\geq 1, each element in XjX_{j} is at least hj+1h_{j+1})
=sum(X0)+hC.\displaystyle=\operatorname{sum}(X_{0})+h_{C}.

Since hC1sum(X0)1h_{C}\leq 1-\operatorname{sum}(X_{0})\leq 1, CC is a configuration. Therefore,

xXη(x)\displaystyle\sum_{x\in X}\eta(x) =j=0t1xXjη(x)=zsum(X0)+j=1t1Cjy^j\displaystyle=\sum_{j=0}^{t-1}\sum_{x\in X_{j}}\eta(x)=z^{*}\operatorname{sum}(X_{0})+\sum_{j=1}^{t-1}C_{j}\widehat{y}_{j} (by definition of η\eta)
(1hC)z+CTy^\displaystyle\leq(1-h_{C})z^{*}+C^{T}\widehat{y} (hC1sum(X0)h_{C}\leq 1-\operatorname{sum}(X_{0}))
1.\displaystyle\leq 1. (CC is a configuration and (y^,z)(\widehat{y},z^{*}) is feasible for DLP(I^)\operatorname{DLP}(\widehat{I}) by Lemma 23)

Lemma 25.

For iIi\in I, let p(i)η(h(i))w(i)p(i)\coloneqq\eta(h(i))w(i). Then opt(LP(I^))p(I)Tkd1optdBP(I)\operatorname{opt}(\operatorname{LP}(\widehat{I}))\leq p(I)\leq T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I).

Proof.

Let (y,z)(y^{*},z^{*}) be an optimal solution to DLP(I^)\operatorname{DLP}(\widehat{I}). Let (y^,z)(\widehat{y},z^{*}) be the monotonization of (y,z)(y^{*},z^{*}).

In the canonical shelving of II, suppose a rectangular item ii (or a slice thereof) lies in shelf SS where SJjS\in J_{j}. Then h(i)[hj+1,hj]h(i)\in[h_{j+1},h_{j}], where ht+10h_{t+1}\coloneqq 0. This is because shelves in Jcanshelv(I^)J\coloneqq\operatorname{can-shelv}(\widehat{I}) are tight. If j=1j=1, then η(h(i))=y^1y1\eta(h(i))=\widehat{y}_{1}\geq y^{*}_{1}. If 2jt12\leq j\leq t-1, then η(h(i)){y^j1,y^j}y^jyj\eta(h(i))\in\{\widehat{y}_{j-1},\widehat{y}_{j}\}\geq\widehat{y}_{j}\geq y^{*}_{j}. We are guaranteed that for j[t1]j\in[t-1], and each shelf SJjS\in J_{j}, w(S)=1w(S)=1.

p(I)\displaystyle p(I) =j=1tSJjiSη(h(i))w(i)+iI^Sη(h(i))w(i)\displaystyle=\sum_{j=1}^{t}\sum_{S\in J_{j}}\sum_{i\in S}\eta(h(i))w(i)+\sum_{i\in\widehat{I}_{S}}\eta(h(i))w(i) (by definition of pp)
j=1t1SJjiSyjw(i)+iI^S(h(i)z)w(i)\displaystyle\geq\sum_{j=1}^{t-1}\sum_{S\in J_{j}}\sum_{i\in S}y^{*}_{j}w(i)+\sum_{i\in\widehat{I}_{S}}(h(i)z^{*})w(i) (by definition of η\eta)
=j=1t1yjq+a(I^S)z\displaystyle=\sum_{j=1}^{t-1}y^{*}_{j}q+a(\widehat{I}_{S})z^{*} (since w(Jj)=qw(J_{j})=q for j[t1]j\in[t-1])
=opt(DLP(I^)).\displaystyle=\operatorname{opt}(\operatorname{DLP}(\widehat{I})). ((y,z)(y^{*},z^{*}) is optimal for DLP(I^)\operatorname{DLP}(\widehat{I}))

By strong duality of linear programs, opt(LP(I^))=opt(DLP(I^))p(I)\operatorname{opt}(\operatorname{LP}(\widehat{I}))=\operatorname{opt}(\operatorname{DLP}(\widehat{I}))\leq p(I).

Since η\eta and HkH_{k} are weighting functions (by Lemma 24), we get that p(I)Tkd1optdBP(I)p(I)\leq T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I) by Theorem 1. ∎

See 6

Proof.
a(I^L)a(I^)=iI(d(i)j=1d1fk(j(i)))Tkd1optdBP(I).\displaystyle a(\widehat{I}_{L})\leq a(\widehat{I})=\sum_{i\in I}\left(\ell_{d}(i)\prod_{j=1}^{d-1}f_{k}(\ell_{j}(i))\right)\leq T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I). (by Theorem 1)
soptδ(I^)\displaystyle\operatorname{sopt}_{\delta}(\widehat{I}) <opt(J(lo)I^S)+δa(I^L)+(1+δ)\displaystyle<\operatorname{opt}(J^{\mathrm{(lo)}}\cup\widehat{I}_{S})+\delta a(\widehat{I}_{L})+(1+\delta) (by Lemma 20)
opt(LP(I^))+1δ2+δTkd1optdBP(I)+(1+δ)\displaystyle\leq\operatorname{opt}(\operatorname{LP}(\widehat{I}))+\left\lceil\frac{1}{\delta^{2}}\right\rceil+\delta T_{k}^{d-1}\operatorname{opt}_{d\mathrm{BP}}(I)+(1+\delta) (by Lemmas 21 and 17)
Tkd1(1+δ)optdBP(I)+1δ2+1+δ.\displaystyle\leq T_{k}^{d-1}(1+\delta)\operatorname{opt}_{d\mathrm{BP}}(I)+\left\lceil\frac{1}{\delta^{2}}\right\rceil+1+\delta. (by Lemma 25)

A.3 Guessing Shelves and Bins

We want 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) to return all possible packings of empty shelves into at most n|^|n\coloneqq|\widehat{\mathcal{I}}| bins such that each packing is structured for (flat(^),δ)(\operatorname{flat}(\widehat{\mathcal{I}}),\delta).

Let H={h(i):iflat(^)}H=\{h(i):i\in\operatorname{flat}(\widehat{\mathcal{I}})\}. Let N|flat(^)|N\coloneqq|\operatorname{flat}(\widehat{\mathcal{I}})|. 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜(^,δ)\operatorname{\mathtt{guess-shelves}}(\widehat{\mathcal{I}},\delta) starts by picking the distinct heights of shelves by iterating over all subsets of HH of size at most 1/δ2\lceil 1/\delta^{2}\rceil. The number of such subsets is at most N1/δ2+1N^{\lceil 1/\delta^{2}\rceil}+1. Let H~{h1,h2,,ht}\widetilde{H}\coloneqq\{h_{1},h_{2},\ldots,h_{t}\} be one such guess, where t1/δ2t\leq\lceil 1/\delta^{2}\rceil. Without loss of generality, assume h1>h2>>ht>δh_{1}>h_{2}>\ldots>h_{t}>\delta.

Next, 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} needs to decide the number of shelves of each height and a packing of those shelves into bins. Let C0tC\in\mathbb{Z}_{\geq 0}^{t} such that hCj=1t1Cjhj1h_{C}\coloneqq\sum_{j=1}^{t-1}C_{j}h_{j}\leq 1. Then CC is called a configuration. CC represents a set of shelves that can be packed into a bin and where CjC_{j} shelves have height hjh_{j}. Let 𝒞\mathcal{C} be the set of all configurations. We can pack at most 1/δ1\left\lceil 1/\delta\right\rceil-1 items into a bin because ht>δh_{t}>\delta. By Lemma 16, we get

|𝒞|(1/δ1+tt)(1/δ1+1/δ21/δ1)(1δ2+1)1/δ.|\mathcal{C}|\leq\binom{\left\lceil 1/\delta\right\rceil-1+t}{t}\leq\binom{\left\lceil 1/\delta\right\rceil-1+\lceil 1/\delta^{2}\rceil}{\left\lceil 1/\delta\right\rceil-1}\leq\left(\left\lceil\frac{1}{\delta^{2}}\right\rceil+1\right)^{1/\delta}.

There can be at most nn bins, and 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} has to decide the configuration of each bin. By Lemma 16, the number of ways of doing this is at most (|𝒞|+n|𝒞|)(n+1)|𝒞|\binom{|\mathcal{C}|+n}{|\mathcal{C}|}\leq(n+1)^{|\mathcal{C}|}. Therefore, 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} computes all configurations and then iterates over all (|𝒞|+n|𝒞|)\binom{|\mathcal{C}|+n}{|\mathcal{C}|} combinations of these configs.

This completes the description of 𝚐𝚞𝚎𝚜𝚜𝚜𝚑𝚎𝚕𝚟𝚎𝚜\operatorname{\mathtt{guess-shelves}} and proves Theorem 7.

A.4 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}}

𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) takes as input a set ^\widehat{\mathcal{I}} of 2D itemsets, a packing PP of empty shelves into bins and constant δ(0,1)\delta\in(0,1). It tries to pack ^\widehat{\mathcal{I}} into PP and one additional shelf. Before we design 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{choose-and-pack}}, let us see how to handle a special case, i.e., where ^\widehat{\mathcal{I}} is simple.

Definition 12.

A set ^\widehat{\mathcal{I}} of 2D itemsets is δ\delta-simple iff the width of each δ\delta-large item in flat(^)\operatorname{flat}(\widehat{\mathcal{I}}) is a multiple of 1/|^|1/|\widehat{\mathcal{I}}|.

Let PP be a bin packing of empty shelves. Let h1>h2>>hth_{1}>h_{2}>\ldots>h_{t} be the distinct heights of the shelves in PP, where ht>δh_{t}>\delta. We will use dynamic programming to either pack a simple instance ^\widehat{\mathcal{I}} into PP or claim that no assortment of ^\widehat{\mathcal{I}} can be packed into PP. Call this algorithm 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{simple-choose-and-pack}}(\widehat{\mathcal{I}},P,\delta).

Let ^{I1,I2,,In}\widehat{\mathcal{I}}\coloneqq\{I_{1},I_{2},\ldots,I_{n}\}. For j{0,1,,n}j\in\{0,1,\ldots,n\}, define ^j{I1,I2,,Ij}\widehat{\mathcal{I}}_{j}\coloneqq\{I_{1},I_{2},\ldots,I_{j}\}, i.e., ^j\widehat{\mathcal{I}}_{j} contains the first jj itemsets from ^\widehat{\mathcal{I}}. Let u[u1,u2,,ut]{0,1,,n2}t\vec{u}\coloneqq[u_{1},u_{2},\ldots,u_{t}]\in\{0,1,\ldots,n^{2}\}^{t} be a vector. Let Φ(j,u)\Phi(j,\vec{u}) be the set of all assortments of ^j\widehat{\mathcal{I}}_{j} that can be packed into tt shelves, where the rthr^{\textrm{th}} shelf has height hrh_{r} and width ur/nu_{r}/n. For a set KK of items, define smallArea(K)\operatorname{smallArea}(K) as the total area of δ\delta-small items in KK. Define g(j,u)minKΦ(j,u)smallArea(K)g(j,\vec{u})\coloneqq\min_{K\in\Phi(j,\vec{u})}\operatorname{smallArea}(K). If Φ(j,u)=\Phi(j,\vec{u})=\emptyset, then we let g(j,u)=g(j,\vec{u})=\infty.

We will show how to compute g(j,u)g(j,\vec{u}) for all j{0,1,,n}j\in\{0,1,\ldots,n\} and all u{0,1,,n2}t\vec{u}\in\{0,1,\ldots,n^{2}\}^{t} using dynamic programming. Let there be nrn_{r} shelves in PP having height hrh_{r}. Then for j=nj=n and ur=nrnu_{r}=n_{r}n, ^\widehat{\mathcal{I}} can be packed into PP iff g(j,u)g(j,\vec{u}) is at most the area of non-shelf space in PP.

Note that in any solution KK corresponding to g(j,u)g(j,\vec{u}), we can assume without loss of generality that the item ii from KIjK\cap I_{j} is placed in the smallest shelves possible. This is because we can always swap ii with the slices of items in those shelves. This observation gives us the following recurrence relation for g(j,u)g(j,\vec{u}):

g(j,u)={ if uj<0 for some j[t]0 if n=0 and uj0 for all j[t]miniIj(smallArea({i})+g(j1,reduce(u,i))) if n>0 and uj0 for all j[t]g(j,\vec{u})=\begin{cases}\infty&\textrm{ if }u_{j}<0\textrm{ for some }j\in[t]\\ 0&\textrm{ if }n=0\textrm{ and }u_{j}\geq 0\textrm{ for all }j\in[t]\\ \min_{i\in I_{j}}\left(\begin{array}[]{ll}\operatorname{smallArea}(\{i\})\\ +\,g(j-1,\operatorname{reduce}(\vec{u},i))\end{array}\right)&\textrm{ if }n>0\textrm{ and }u_{j}\geq 0\textrm{ for all }j\in[t]\end{cases} (1)

Here reduce(u,i)\operatorname{reduce}(\vec{u},i) is a vector obtained as follows: If ii is δ\delta-small, then reduce(u,i)u\operatorname{reduce}(\vec{u},i)\coloneqq\vec{u}. Otherwise, initialize xx to w(i)w(i). Let pip_{i} be the largest integer rr such that h(i)hrh(i)\leq h_{r}. For rr varying from pip_{i} to 2, subtract min(x,uj)\min(x,u_{j}) from xx and uju_{j}. Then subtract xx from u1u_{1}. The new value of u\vec{u} is defined to be the output of reduce(u,i)\operatorname{reduce}(\vec{u},i).

The recurrence relation allows us to compute g(j,u)g(j,\vec{u}) for all jj and u\vec{u} using dynamic programming in time O(Nn2t)O(Nn^{2t}) time, where N|flat(^)|N\coloneqq|\operatorname{flat}(\widehat{\mathcal{I}})|. With a bit more work, we can also compute the corresponding assortment KK, if one exists. Therefore, 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{simple-choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) computes a packing of ^\widehat{\mathcal{I}} into PP if one exists, or returns null if no assortment of ^\widehat{\mathcal{I}} can be packed into PP.

Now we will look at the case where ^\widehat{\mathcal{I}} is not δ\delta-simple. Let ^\widehat{\mathcal{I}}^{\prime} be the instance obtained by rounding up the width of each δ\delta-large item in ^\widehat{\mathcal{I}} to a multiple of 1/n1/n, where n|^|n\coloneqq|\widehat{\mathcal{I}}|. Let P¯\overline{P} be the bin packing obtained by adding another bin to PP containing a single shelf of height h1h_{1}. 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) computes ^\widehat{\mathcal{I}}^{\prime} and P¯\overline{P} and returns the output of 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P¯,δ)\operatorname{\mathtt{simple-choose-and-pack}}(\widehat{\mathcal{I}}^{\prime},\overline{P},\delta).

See 9

Proof.

Follows from the definition of 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔\operatorname{\mathtt{simple-choose-and-pack}}. ∎

See 8

Proof.

Let K^\widehat{K}^{\prime} be the items obtained by rounding up the width of each item in K^\widehat{K} to a multiple of 1/n1/n. Then K^\widehat{K}^{\prime} is an assortment of ^\widehat{\mathcal{I}}^{\prime}. We will show that K^\widehat{K}^{\prime} fits into P¯\overline{P}, so 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P¯,δ)\operatorname{\mathtt{simple-choose-and-pack}}(\widehat{\mathcal{I}}^{\prime},\overline{P},\delta) will not output null.

Slice each item iK^i\in\widehat{K}^{\prime} into two pieces using a vertical cut such that one piece has width equal to the original width of ii in K^\widehat{K}, and the other piece has width less than 1/n1/n. This splits K^\widehat{K}^{\prime} into sets K^\widehat{K} and TT. TT contains at most nn items, each of width less than 1/n1/n. Therefore, we can pack K^\widehat{K} into PP and we can pack TT into the newly-created shelf of height h1h_{1}. Therefore, K^\widehat{K}^{\prime} can be packed into P¯\overline{P}, so 𝚜𝚒𝚖𝚙𝚕𝚎𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P¯,δ)\operatorname{\mathtt{simple-choose-and-pack}}(\widehat{\mathcal{I}}^{\prime},\overline{P},\delta) won’t output null. ∎

See 10

Proof.

The running time of 𝚌𝚑𝚘𝚘𝚜𝚎𝚊𝚗𝚍𝚙𝚊𝚌𝚔(^,P,δ)\operatorname{\mathtt{choose-and-pack}}(\widehat{\mathcal{I}},P,\delta) is dominated by computing g(j,u)g(j,\vec{u}) for all jj and u\vec{u}, which takes O(Nn2t)O(Nn^{2t}) time. Since PP is structured for (^,δ)(\widehat{\mathcal{I}},\delta), the number of distinct shelves in PP, which is tt, is at most 1/δ2\lceil 1/\delta^{2}\rceil. ∎

A.5 𝚒𝚗𝚏𝚕𝚊𝚝𝚎\operatorname{\mathtt{inflate}}

Let II be a set of ddD items. Let PP be a shelf-based δ\delta-fractional bin packing of I^𝚛𝚘𝚞𝚗𝚍(I)\widehat{I}\coloneqq\operatorname{\mathtt{round}}(I) into mm bins. Let there be tt distinct heights of shelves in PP: h1>h2>>ht>δh_{1}>h_{2}>\ldots>h_{t}>\delta. We want to design an algorithm 𝚒𝚗𝚏𝚕𝚊𝚝𝚎(P)\operatorname{\mathtt{inflate}}(P) that returns a packing of II into approximately |P||P| bins.

Define I^L{iI^:h(i)>δ}\widehat{I}_{L}\coloneqq\{i\in\widehat{I}:h(i)>\delta\} and I^SI^I^L\widehat{I}_{S}\coloneqq\widehat{I}-\widehat{I}_{L}. Let there be QQ distinct base types in II (so Qkd1Q\leq k^{d-1}).

A.5.1 Separating Base Types

We will now impose an additional constraint over PP: items in each shelf must have the same btype\operatorname{btype}. This will be helpful later, when we will try to compute a packing of ddD items II.

Separating base types of I^S\widehat{I}_{S} is easy, since we can slice them in both directions. An analogy is to think of a mixture of multiple immiscible liquids of different densities settling into equilibrium.

Let there be njn_{j} shelves of height hjh_{j}. Let I^j\widehat{I}_{j} be the items packed into shelves of height hjh_{j}. Therefore, w(I^j)njw(\widehat{I}_{j})\leq n_{j}. Let I^j,qI^j\widehat{I}_{j,q}\subseteq\widehat{I}_{j} be the items of base type q[Q]q\in[Q].

For each qq, pack I^j,q\widehat{I}_{j,q} into w(I^j,q)\lceil w(\widehat{I}_{j,q})\rceil shelves of height hjh_{j} (slicing items if needed). For these newly-created shelves, define the btype\operatorname{btype} of the shelf to be the btype\operatorname{btype} of the items in it. Let the number of newly-created shelves of height hjh_{j} be njn_{j}^{\prime}. Then

nj=q=1Qw(I^j,q)<q=1Qw(I^j,q)+Qnj+Qnjnj+Q1.n_{j}^{\prime}=\sum_{q=1}^{Q}\lceil w(\widehat{I}_{j,q})\rceil<\sum_{q=1}^{Q}w(\widehat{I}_{j,q})+Q\leq n_{j}+Q\implies n_{j}^{\prime}\leq n_{j}+Q-1.

njn_{j} of these shelves can be packed into existing bins in place of the old shelves. The remaining njnjQ1n_{j}^{\prime}-n_{j}\leq Q-1 shelves can be packed on the base of new bins.

Therefore, by using at most t(Q1)t(Q-1) new bins, we can ensure that for every shelf, all items in that shelf have the same btype\operatorname{btype}. These new bins don’t contain any items from I^S\widehat{I}_{S}. Call this new bin packing PP^{\prime}. This transformation takes O(|I|dlog|I|)O(|I|d\log|I|) time.

A.5.2 Forbidding Horizontal Slicing

We will now use PP^{\prime} to compute a shelf-based bin packing PP^{\prime\prime} of I^\widehat{I} where items in I^\widehat{I} can be sliced using vertical cuts only.

Let I^q,S\widehat{I}_{q,S} be the items in I^S\widehat{I}_{S} of base type qq. Pack items I^q,S\widehat{I}_{q,S} into shelves using can-shelv\operatorname{\hyperref@@ii[defn:hgap:can-shelv]{\operatorname{can-shelv}}}. Suppose canshelv\operatorname{can-shelv} used mqm_{q} shelves to pack I^q,S\widehat{I}_{q,S}. For j[mq]j\in[m_{q}], let hq,jh_{q,j} be the height of the jthj^{\textrm{th}} shelf. Let Hqj=1mqhq,jH_{q}\coloneqq\sum_{j=1}^{m_{q}}h_{q,j} and Hq=1QHqH\coloneqq\sum_{q=1}^{Q}H_{q}. Since for j[mq1]j\in[m_{q}-1], all items in the jthj^{\textrm{th}} shelf have height at least hq,j+1h_{q,j+1},

a(I^q,S)>j=1mq1hq,j+1Hqhq,1Hqδ.a(\widehat{I}_{q,S})>\sum_{j=1}^{m_{q}-1}h_{q,j+1}\geq H_{q}-h_{q,1}\geq H_{q}-\delta.

Therefore, H<a(I^S)+QδH<a(\widehat{I}_{S})+Q\delta. Let J^S\widehat{J}_{S} be the set of these newly-created shelves.

Use Next-Fit to pack J^S\widehat{J}_{S} into the space used by I^S\widehat{I}_{S} in PP^{\prime}. I^S\widehat{I}_{S} uses at most mm bins in PP^{\prime} (recall that m|P|m\coloneqq|P|). A height of less than δ\delta will remain unpacked in each of those bins. The total height occupied by I^S\widehat{I}_{S} in PP^{\prime} is a(I^S)a(\widehat{I}_{S}). Therefore, Next-Fit will pack a height of more than a(I^S)δma(\widehat{I}_{S})-\delta m.

Some shelves in J^S\widehat{J}_{S} may still be unpacked. Their total height will be less than H(a(I^S)δm)<δ(Q+m)H-(a(\widehat{I}_{S})-\delta m)<\delta(Q+m). We will pack these shelves into new bins using Next-Fit. The number of new bins used is at most δ(Q+m)/(1δ)\left\lceil\delta(Q+m)/(1-\delta)\right\rceil. Call this bin packing PP^{\prime\prime}. The number of bins in PP^{\prime\prime} is at most mm+t(Q1)+δ(Q+m)/(1δ)m^{\prime}\coloneqq m+t(Q-1)+\left\lceil\delta(Q+m)/(1-\delta)\right\rceil.

A.5.3 Shelf-Based ddD packing

We will now show how to convert the packing PP^{\prime\prime} of I^\widehat{I} that uses mm^{\prime} bins into a packing of II that uses mm^{\prime} ddD bins.

First, we repack the items into the shelves. For each q[Q]q\in[Q], let J^q\widehat{J}_{q} be the set of shelves in PP^{\prime\prime} of btype\operatorname{btype} qq. Let I^[q]\widehat{I}^{[q]} be the items packed into J^q\widehat{J}_{q}. Compute J^qcan-shelv(I^[q])\widehat{J}^{*}_{q}\coloneqq\operatorname{\hyperref@@ii[defn:hgap:can-shelv]{\operatorname{can-shelv}}}(\widehat{I}^{[q]}) and pack the shelves J^q\widehat{J}^{*}_{q} into J^q\widehat{J}_{q}. This is possible by Lemma 15.

This repacking gives us an ordering of shelves in J^q\widehat{J}_{q}. Number the shelves from 1 onwards. All items have at most 2 slices. If an item has 2 slices, and one slice is packed into shelf number pp, then the other slice is packed into shelf number p+1p+1. The slice in shelf pp is called the leading slice. Every shelf has at most one leading slice.

Let SjS_{j} be the jthj^{\textrm{th}} shelf of J^q\widehat{J}_{q}. Let RjR_{j} be the set of unsliced items in SjS_{j} and the item whose leading slice is in SjS_{j}. Order the items in RjR_{j} arbitrarily, except that the sliced item, if any, should be last. Then w(Rjlast(Rj))<1w(R_{j}-\operatorname{last}(R_{j}))<1. So, we can use HDH-unit-p