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

Approximation Algorithms for Generalized Multidimensional Knapsack

Arindam Khan    Eklavya Sharma    K. V. N. Sreenivas Department of Computer Science and Automation, Indian Institute of Science, Bengaluru, India. arindamkhan@iisc.ac.in, eklavyas@iisc.ac.in, venkatanaga@iisc.ac.in
Abstract

We study a generalization of the knapsack problem with geometric and vector constraints. The input is a set of rectangular items, each with an associated profit and dd nonnegative weights (dd-dimensional vector), and a square knapsack. The goal is to find a non-overlapping axis-parallel packing of a subset of items into the given knapsack such that the vector constraints are not violated, i.e., the sum of weights of all the packed items in any of the dd dimensions does not exceed one. We consider two variants of the problem: (i)(i) the items are not allowed to be rotated, (ii)(ii) items can be rotated by 90 degrees.

We give a (2+ε)(2+\varepsilon)-approximation algorithm for this problem (both versions). In the process, we also study a variant of the maximum generalized assignment problem (Max-GAP), called Vector-Max-GAP, and design a PTAS for it.

1 Introduction

The knapsack problem is a fundamental well-studied problem in the field of combinatorial optimization and approximation algorithms. It is one of Karp’s 21 NP-Complete problems and has been studied extensively for more than a century [15]. A common generalization of the knapsack problem is the 2-D geometric knapsack problem. Here, the knapsack is a unit square and the items are rectangular objects with designated profits. The objective is to pack a maximum profit subset of items such that no two items overlap and all the items are packed parallel to the axes of the knapsack (called axis-parallel or orthogonal packing). There are two further variants of the problem depending on whether we are allowed to rotate the items by 90 degrees or not. Another well-studied variant of the knapsack problem is dd-D vector knapsack problem, where we are given a set of items, each with dd-dimensional weight vector and a profit, and a dd-dimensional bin (dd is a constant). The goal is to select a subset of items of maximum profit such that the sum of all weights in each dimension is bounded by the bin capacity in that dimension.

In this paper we study a natural variant of knapsack problem, called (2,d)(2,d) Knapsack, which considers items with both geometric dimensions and the vector dimensions. In this 22-D geometric knapsack problem with dd-D vector constraints (where dd is a constant), or (2,d)(2,d) KS in short, the input set II consists of nn items. For any item iIi\in I, let w(i),h(i),p(i)w(i),h(i),p(i) denote the width, height and the profit of the item, respectively, and let a(i)=w(i)h(i)a(i)=w(i)h(i) denote the area of the item. Also, for any item iIi\in I, let vj(i)v_{j}(i) denote the weight of the item in the jthj^{\textrm{th}} dimension. The objective is to pack a maximum profit subset of items JIJ\subseteq I into a unit square knapsack in an axis-parallel, non-overlapping manner such that for any j[d]j\in[d], iJvj(i)1\sum_{i\in J}v_{j}(i)\leq 1.

We will also study a variant of Maximum Generalized Assignment Problem (Max-GAP). In Max-GAP problem, we are provided with a set of machines with designated capacities, and a set of items; an item’s size and value depends on the machine to which it is going to be assigned. The objective is to assign a subset of items to machines such that the obtained value is maximized while making sure that no machine’s capacity is breached. We define a variant of the Max-GAP problem called Vector-Max-GAP. In this problem, we additionally have a dd-dimensional weight vector associated with every item and a dd-dimensional global weight constraint on the whole setup of machines. The objective is to find the maximum value obtainable so that no machine’s capacity is breached and the overall weight of items does not cross the global weight constraint.

1.1 Our contributions

Our two main contributions are (i)(i) a (2+ε)(2+\varepsilon) approximation algorithm for the (2,d)(2,d) KS problem (ii)(ii) define a new problem called Vector-Max-GAP and obtain a PTAS for it.

To obtain the approximation algorithm for (2,d)(2,d) KS, we first obtain a structural result using corridor decomposition, which shows that if we consider an optimal packing and remove either vertical items (height\ggwidth) or horizontal items (width\ggheight), we can restructure the remaining packing to possess a ‘nice’ structure that can be efficiently searched for.

In [9], which deals with the 2-D geometric knapsack problem, the authors use the PTAS for the maximum generalized assignment problem (Max-GAP) to efficiently search for such a nice structure. But due to the presence of vector constraints, we needed a generalization of the Max-GAP problem which we call the Vector-Max-GAP problem and obtain a PTAS for it to obtain the desired approximation algorithm for (2,d)(2,d) KS.

1.2 Related work

The classical knapsack problem admits a fully polynomial time approximation scheme (FPTAS) [14, 21]. Both 2-D geometric knapsack (2D GK) and 2-D vector knapsack problem are W[1]-hard [12, 20], thus do not admit an EPTAS unless W[1]=FPT. 111EPTAS is a PTAS with running time f(ε)ncf(\varepsilon)n^{c} where cc is a constant that does not depend on ε\varepsilon. However, dd-D vector knapsack problem admits a PTAS [7]. On the other hand, it is not known whether the 2D GK is APX-Hard or not, and finding a PTAS for the problem is one of the major open problems in the area. The current best approximation algorithm [9] for this problem without rotations achieves an approximation ratio of 17/9+ε17/9+\varepsilon. If rotations are allowed, the approximation ratio improves to 3/2+ε3/2+\varepsilon. In a special case known as the cardinality case where each item has a profit of one unit, the current best approximation factor is 558/325+ε558/325+\varepsilon without rotations and 4/3+ε4/3+\varepsilon with rotations (see [9]). PTASes exist for the restricted profit density case, i.e., the profit/area ratio of each item is upper bounded and lower bounded by fixed constants (see [2]) and the case where all the items are small compared to the dimensions of the bin. EPTAS exists for the case where all the items are squares [13]. In the case where we can use resource augmentation, i.e., we are allowed to increase the width or height of the knapsack by a factor of ε\varepsilon, we can construct a packing which gives the exact optimal profit in polynomial time (see [13]). 2GK has also been studied under psedopolynomial setting [17, 11]. The following table summarizes the results for 2GK problem.

without rotations with rotations
General case 17/9+ε17/9+\varepsilon[9] 3/2+ε3/2+\varepsilon[9]
Cardinality case 558/325+ε558/325+\varepsilon[9] 4/3+ε4/3+\varepsilon[9]
Restricted profit density PTAS[2] PTAS[2]
Small items folklore FPTAS (Lemma 15) folklore FPTAS (Lemma 15)
Square items EPTAS [13] irrelevant
Resource Augmentation exact solution[13] exact solution[13]
Figure 1: The state-of-the-art for the 2-D geometric knapsack problem.

A well-studied problem closely related to the knapsack problem is bin packing. A natural generalization of the bin packing problem is the 2-D geometric bin packing (2GBP) problem where items are rectangles and bins are unit squares. The current best asymptotic approximation ratio of (1+ln1.5+ε)(1+\ln 1.5+\varepsilon) for 2GBP is due to [4]. Another generalization of bin packing is the vector bin packing problem (VBP) where each item has multiple constraints. For the current best approximation ratios of VBP, we refer the reader to [3].

There exist many other variants of the discussed packing problems such as strip packing (see [8, 10]), maximum independent set of rectangles (see [18]), storage allocation problems [22], etc. For an extensive survey of related packing problems, see [5, 16].

1.3 Organization of the Paper

In Section 2, we study the Vector-Max-GAP problem and design a PTAS for it. Section 3 describes the (2+ε)(2+\varepsilon) approximation algorithm for the (2,d)(2,d) Knapsack problem. In Sections 3.1 and 3.2, we use a structural result involving corridor decomposition and reduce our problem to a container packing problem. In Sections 3.3 and 3.4 we will discuss how to model the container packing problem as an instance of the Vector-Max-GAP problem. Finally, in Section 3.5, we put everything together to obtain the (2+ε)(2+\varepsilon) approximation algorithm for the (2,d)(2,d) Knapsack problem.

2 Vector-Max-GAP problem and a PTAS

We will formally define the Vector-Max-GAP problem. Let II be a set of nn items numbered 1 to nn and let MM be a set of kk machines, where kk is a constant. The jthj^{\textrm{th}} machine has a capacity MjM_{j}. Each item iIi\in I has a size of sj(i)s_{j}(i), value of valj(i)\mathrm{val}_{j}(i) in the jthj^{\textrm{th}} machine (j[k]j\in[k]). Additionally, each item ii also has a weight wq(i)w_{q}(i) in the qthq^{\textrm{th}} dimension (q[d]q\in[d], dd is a constant). Assume that for all j[k]j\in[k], q[d]q\in[d] and i[n]i\in[n], Mj,wq(i),sj(i),valj(i)M_{j},w_{q}(i),s_{j}(i),\mathrm{val}_{j}(i) are all non-negative.

The objective is to assign a subset of items JIJ\subseteq I to the machines such that for any machine jj, the size of all the items assigned to it does not exceed MjM_{j}. Further, the total weight of the set JJ in any dimension q[d]q\in[d] must not exceed WqW_{q}, which is the global weight constraint of the whole setup in the qthq^{\textrm{th}} dimension. Respecting these constraints, we would like to maximize the total value of the items in JJ.

Formally, let JJ be the subset of items picked and JjJ_{j} be the items assigned to the jthj^{\textrm{th}} machine (j[k]j\in[k]). The assignment is feasible iff the following constraints are satisfied:

q[d],iJwq(i)Wq\forall q\in[d],\sum_{i\in J}w_{q}(i)\leq W_{q}
j[k],iJjsj(i)Mj\forall j\in[k],\sum_{i\in J_{j}}s_{j}(i)\leq M_{j}

Let M=[M1,M2,,Mk]\overrightarrow{M}=[M_{1},M_{2},\dots,M_{k}], w(i)=[w1(i),w2(i),,wd(i)]\overrightarrow{w}(i)=[w_{1}(i),w_{2}(i),\dots,w_{d}(i)], s(i)=[s1(i),s2(i),,sk(i)]\overrightarrow{s}(i)=[s_{1}(i),s_{2}(i),\dots,s_{k}(i)], val(i)=[val1(i),val2(i),,valk(i)]\overrightarrow{\mathrm{val}}(i)=[\mathrm{val}_{1}(i),\mathrm{val}_{2}(i),\dots,\mathrm{val}_{k}(i)].

Let s=[s(1),s(2),,s(n)]\overrightarrow{s}=[\overrightarrow{s}(1),\overrightarrow{s}(2),\dots,\overrightarrow{s}(n)], w=[w(1),w(2),,w(n)],val=[val(1),val(2),,val(n)]\overrightarrow{w}=[\overrightarrow{w}(1),\overrightarrow{w}(2),\dots,\overrightarrow{w}(n)],\overrightarrow{\mathrm{val}}=[\overrightarrow{\mathrm{val}}(1),\overrightarrow{\mathrm{val}}(2),\dots,\overrightarrow{\mathrm{val}}(n)]. W=[W1,W2,,Wd]\overrightarrow{W}=[W_{1},W_{2},\dots,W_{d}].

An instance of this problem is given by (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). We say that the set of items JJ is feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}) iff JJ can fit in machines of capacity given by M\overrightarrow{M} and satisfy the global weight constraint given by W\overrightarrow{W} where item sizes and weights are given by s\overrightarrow{s} and w\overrightarrow{w} respectively.

2.1 Dynamic-Programming Algorithm for Integral Input

Consider the case where item sizes and weights are integers. W.l.o.g., we can assume that the capacities of machines, MjM_{j} (j[k])(j\in[k]) and weight constraints, WqW_{q} (q[d])(q\in[d]), are also integers (otherwise, we can round them down to the closest integers).

Arbitrarily order the items and number them from 11 onwards. Let VAL(n,M,W)\mathrm{VAL}(n,\overrightarrow{M},\overrightarrow{W}) be the maximum value obtainable by assigning a subset of the first nn items to kk machines with capacities given by M\overrightarrow{M} respecting the global weight constraint W\overrightarrow{W}. We can express VAL(n,M,W)\mathrm{VAL}(n,\overrightarrow{M},\overrightarrow{W}) as a recurrence.

VAL(n,M,W)={if ¬(W0M0)0if n=0max(VAL(n1,M,W),maxj=1k(valj(n)+VAL(n1,Ms(n)ej,Ww(n))))else\mathrm{VAL}(n,\overrightarrow{M},\overrightarrow{W})=\left\{\begin{array}[]{lr}-\infty&\textrm{if }\neg(\overrightarrow{W}\geq 0\wedge\overrightarrow{M}\geq 0)\\ 0&\textrm{if }n=0\\ \lx@intercol{\displaystyle\max\left(\begin{array}[]{l}\mathrm{VAL}(n-1,\overrightarrow{M},\overrightarrow{W}),\\ {\displaystyle\max_{j=1}^{k}\left(\mathrm{val}_{j}(n)+\mathrm{VAL}\left(n-1,\overrightarrow{M}-\overrightarrow{s}(n)\cdot\overrightarrow{e}_{j},\overrightarrow{W}-\overrightarrow{w}(n)\right)\right)}\end{array}\right)}\;\textrm{else}\hfil\lx@intercol\end{array}\right.

VAL(n,M,W)\mathrm{VAL}(n,\overrightarrow{M},\overrightarrow{W}) can be computed using dynamic programming. We can find the subset of items that gives this much value and it is also easy to ensure that no item assigned to a machine has value 0 in that machine. There are nj=1k(Mj+1)q=1d(Wq+1)n\prod_{j=1}^{k}(M_{j}+1)\prod_{q=1}^{d}(W_{q}+1) items in the state space and each iteration takes Θ(d+k)\Theta(d+k) time. Therefore, time taken by the dynamic programming solution is Θ(n(d+k)j=1k(Mj+1)q=1d(Wq+1))\Theta\left(n(d+k)\prod_{j=1}^{k}(M_{j}+1)\prod_{q=1}^{d}(W_{q}+1)\right).

2.2 Optimal Solution with Resource Augmentation

Let μ=[μ1,μ2,,μk]\overrightarrow{\mu}=[\mu_{1},\mu_{2},\ldots,\mu_{k}] and δ=[δ1,δ2,,δd]\overrightarrow{\delta}=[\delta_{1},\delta_{2},\ldots,\delta_{d}] be vectors whose values will be decided later. For j[k]j\in[k], define sj(i)=sj(i)/μj,Mj=Mj/μj+ns_{j}^{\prime}(i)=\left\lceil s_{j}(i)/\mu_{j}\right\rceil,M_{j}^{\prime}=\left\lfloor M_{j}/\mu_{j}\right\rfloor+n. For q[d]q\in[d], define wq(i)=wq(i)/δq,Wq=Wq/δq+nw_{q}^{\prime}(i)=\left\lceil w_{q}(i)/\delta_{q}\right\rceil,W_{q}^{\prime}=\left\lfloor W_{q}/\delta_{q}\right\rfloor+n.

Lemma 1.

Let JJ be feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). Then JJ is also feasible for (s,w,M,W)(\overrightarrow{s^{\prime}},\overrightarrow{w^{\prime}},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}).

Proof.

For any dimension q[d]q\in[d], iJwq(i)=iJwq(i)/δqiJ(wq(i)/δq+1)\sum_{i\in J}w_{q}^{\prime}(i)=\sum_{i\in J}\left\lceil w_{q}(i)/\delta_{q}\right\rceil\leq\sum_{i\in J}\left(\left\lfloor w_{q}(i)/\delta_{q}\right\rfloor+1\right).

iJ(wq(i)/δq+1)|J|+(1/δq)iJwq(i)n+Wq/δq=Wq\sum_{i\in J}\left(\left\lfloor w_{q}(i)/\delta_{q}\right\rfloor+1\right)\leq|J|+\left\lfloor(1/\delta_{q})\sum_{i\in J}w_{q}(i)\right\rfloor\leq n+\left\lfloor W_{q}/\delta_{q}\right\rfloor=W_{q}^{\prime}

Let JjJ_{j} be the items in JJ assigned to the jthj^{\textrm{th}} machine. Then iJjsj(i)=iJjsj(i)/μj\sum_{i\in J_{j}}s_{j}^{\prime}(i)=\sum_{i\in J_{j}}\left\lceil s_{j}(i)/\mu_{j}\right\rceil.

iJj(sj(i)/μj+1)|Jj|+(1/μj)iJjsj(i)n+Mj/μj=Mj\sum_{i\in J_{j}}\left(\left\lfloor s_{j}(i)/\mu_{j}\right\rfloor+1\right)\leq|J_{j}|+\left\lfloor(1/\mu_{j})\sum_{i\in J_{j}}s_{j}(i)\right\rfloor\leq n+\left\lfloor M_{j}/\mu_{j}\right\rfloor=M_{j}^{\prime}\qed
Lemma 2.

Let JJ be feasible for (s,w,M,W)(\overrightarrow{s^{\prime}},\overrightarrow{w^{\prime}},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}). Then JJ is also feasible for (s,w,M+nμ,W+nδ)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M}+n\overrightarrow{\mu},\overrightarrow{W}+n\overrightarrow{\delta}).

Proof.

For all q[d]q\in[d]

iJwq(i)iJδqwq(i)δqWq=δq(Wq/δq+n)Wq+nδq\sum_{i\in J}w_{q}(i)\leq\sum_{i\in J}\delta_{q}w_{q}^{\prime}(i)\leq\delta_{q}W_{q}^{\prime}=\delta_{q}\left(\left\lfloor W_{q}/\delta_{q}\right\rfloor+n\right)\leq W_{q}+n\delta_{q}

Let JjJ_{j} be the items in JJ assigned to the jthj^{\textrm{th}} machine.

iJjsj(i)iJjμjsj(i)μjMj=μj(Mj/μj+n)Mj+nμj\sum_{i\in J_{j}}s_{j}(i)\leq\sum_{i\in J_{j}}\mu_{j}s_{j}^{\prime}(i)\leq\mu_{j}M_{j}^{\prime}=\mu_{j}\left(\left\lfloor M_{j}/\mu_{j}\right\rfloor+n\right)\leq M_{j}+n\mu_{j}\qed

Let μj=εMj/n\mu_{j}=\varepsilon M_{j}/n and δq=εWq/n\delta_{q}=\varepsilon W_{q}/n for all q[d]q\in[d] and j[k]j\in[k]. Let JJ^{*} be the optimal solution to (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). Let J^\widehat{J} be the optimal solution to (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s^{\prime}},\overrightarrow{w^{\prime}},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}). By Lemma 1, val(J^)val(J)\mathrm{val}(\widehat{J})\geq\mathrm{val}(J^{*}). By Lemma 2, J^\widehat{J} is feasible for (s,w,(1+ε)M,(1+ε)W)(\overrightarrow{s},\overrightarrow{w},(1+\varepsilon)\overrightarrow{M},(1+\varepsilon)\overrightarrow{W}). Also, observe that |Mj|n+Mj/μj=n(1+1/ε)|M_{j}^{\prime}|\leq n+M_{j}/\mu_{j}=n(1+1/\varepsilon) is a polynomial in nn. Similarly, |Wq|n(1+1/ε)|W_{q}^{\prime}|\leq n(1+1/\varepsilon) and hence the optimal solution to (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s^{\prime}},\overrightarrow{w^{\prime}},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}) can be obtained using the dynamic-programming algorithm in polynomial time. Therefore, the optimal solution to (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s^{\prime}},\overrightarrow{w^{\prime}},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}) can be obtained using the dynamic-programming algorithm in time Θ((d+k)nd+k+1/εd+k){\displaystyle\Theta\left((d+k)n^{d+k+1}/\varepsilon^{d+k}\right)}.

Let us define a subroutine assignresaugε(I,val,s,w,M,W)\operatorname{assign-res-aug}_{\varepsilon}(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}) which takes as input set II with associated values, val\overrightarrow{\mathrm{val}}, and gives as output the optimal feasible solution to (s,w,(1+ε)M,(1+ε)W)(\overrightarrow{s},\overrightarrow{w},(1+\varepsilon)\overrightarrow{M},(1+\varepsilon)\overrightarrow{W}).

2.3 Trimming

Consider a set II of items where each item has length s(i)s(i) and profit p(i)p(i) (in this subsection, II is an instance of the knapsack problem instead of the Vector-Max-GAP problem).

Suppose for all iI,s(i)(0,ε]i\in I,s(i)\in(0,\varepsilon] and s(I)1+δs(I)\leq 1+\delta. We’ll show that there exists an RIR\subseteq I such that s(IR)1s(I-R)\leq 1 and p(R)<(δ+ε)p(I)p(R)<(\delta+\varepsilon)p(I). We call this technique of removing a low-profit subset from II so that it fits in a bin of length 1 trimming.

Arbitrarily order the items and arrange them linearly in a bin of size 1+δ1+\delta. Let k=1/(δ+ε)k=\left\lfloor 1/(\delta+\varepsilon)\right\rfloor. Create k+1k+1 intervals of length δ\delta and kk intervals of length ε\varepsilon. Place δ\delta-intervals and ε\varepsilon-intervals alternately. They will fit in the bin because (k+1)δ+kε=δ+(δ+ε)1/(δ+ε)1+δ(k+1)\delta+k\varepsilon=\delta+(\delta+\varepsilon)\left\lfloor 1/(\delta+\varepsilon)\right\rfloor\leq 1+\delta

Number the δ\delta-intervals from 0 to kk and let SiS_{i} be the set of items intersecting the ithi^{\textrm{th}} δ\delta-interval. Note that, all SiS_{i} are mutually disjoint. Let i=argmini=0kp(Si)i^{*}=\operatorname*{argmin}_{i=0}^{k}p(S_{i}).

p(Si)=mini=0kp(Si)1k+1i=0kp(Si)p(I)1/(δ+ε)+1<(δ+ε)p(I)p(S_{i^{*}})=\min_{i=0}^{k}p(S_{i})\leq\frac{1}{k+1}\sum_{i=0}^{k}p(S_{i})\leq\frac{p(I)}{\left\lfloor 1/(\delta+\varepsilon)\right\rfloor+1}<(\delta+\varepsilon)p(I)

Removing SiS_{i^{*}} will create an empty interval of length δ\delta in the bin, and the remaining items can be shifted so that they fit in a bin of length 1.

2.4 Packing Small Items

Consider a Vector-Max-GAP instance (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). Item ii is said to be ε\varepsilon-small for this instance iff w(i)εW\overrightarrow{w}(i)\leq\varepsilon\overrightarrow{W} and for all j[k],(sj(i)εMj or valj(i)=0)j\in[k],(s_{j}(i)\leq\varepsilon M_{j}\textit{ or }\mathrm{val}_{j}(i)=0). A set II of items is said to be ε\varepsilon-small iff each item in II is ε\varepsilon-small.

Suppose II is ε\varepsilon-small. Let JIJ\subseteq I be a feasible solution to (I,val,s,w,(1+ε)M,(1+ε)W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},(1+\varepsilon)\overrightarrow{M},(1+\varepsilon)\overrightarrow{W}). Let JjJ_{j} be the items assigned to the jthj^{\textrm{th}} machine.

For each j[k]j\in[k], use trimming on JjJ_{j} for sizes sjs_{j} and then for each j[d]j\in[d], use trimming on JJ for weights wjw_{j}. In both cases, use ε:=ε\varepsilon:=\varepsilon and δ:=ε\delta:=\varepsilon. Let RR be the removed items and J=JRJ^{\prime}=J-R be the remaining items. Total value lost is less than 2ε(d+1)val(J)2\varepsilon(d+1)\mathrm{val}(J) and JJ^{\prime} is feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}).

Therefore, any resource-augmented solution JJ of small items can be transformed to get a feasible solution JJ^{\prime} of value at most (12(d+1)ε)val(J)(1-2(d+1)\varepsilon)\mathrm{val}(J).

2.5 A Structural Result

Theorem 3.

Let JJ be a feasible solution to (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). Let JjJJ_{j}\subseteq J be the items assigned to the jthj^{\textrm{th}} machine. Then for all ε>0\varepsilon>0, there exist sets XX and YY such that |X|(d+k)/(ε2)|X|\leq(d+k)/(\varepsilon^{2}) and val(Y)εval(J)\mathrm{val}(Y)\leq\varepsilon\cdot\mathrm{val}(J) and

j[k],iJjXY,\displaystyle\forall j\in[k],\forall i\in J_{j}-X-Y, sj(i)ε(Mjsj(XJj))\displaystyle\;s_{j}(i)\leq\varepsilon\left(M_{j}-s_{j}\left(X\cap J_{j}\right)\right)
iJXY,\displaystyle\forall i\in J-X-Y, w(i)ε(Ww(X))\displaystyle\;\overrightarrow{w}(i)\leq\varepsilon\left(\overrightarrow{W}-\overrightarrow{w}(X)\right)
Proof.

Let P1,j={iJj:sj(i)>εMj}P_{1,j}=\{i\in J_{j}:s_{j}(i)>\varepsilon M_{j}\}, where j[k]j\in[k], and Q1,q={iJ:wq(i)>εWq}Q_{1,q}=\{i\in J:w_{q}(i)>\varepsilon W_{q}\}, where q[d]q\in[d]. We know that sj(P1,j)>εMj|P1,j|s_{j}(P_{1,j})>\varepsilon M_{j}|P_{1,j}|. Therefore, |P1,j|1ε|P_{1,j}|\leq\frac{1}{\varepsilon}. Also, wq(Q1,q)>εWq|Q1,q|w_{q}(Q_{1,q})>\varepsilon W_{q}|Q_{1,q}|. Therefore, |W1,q|1ε|W_{1,q}|\leq\frac{1}{\varepsilon}. Let R1=(j=1kP1,j)(q=1dQ1,q)R_{1}=\left(\bigcup_{j=1}^{k}P_{1,j}\right)\cup\left(\bigcup_{q=1}^{d}Q_{1,q}\right). R1R_{1} is therefore the set of items in JJ that are in some sense ‘big’. Note that |R1|(d+k)/ε|R_{1}|\leq(d+k)/\varepsilon.

If val(R1)εval(J)\mathrm{val}(R_{1})\leq\varepsilon\cdot\mathrm{val}(J), set Y=R1Y=R_{1} and X={}X=\{\} and we’re done. Otherwise, set P2,j={iJjR1:sj(i)>ε(Mjsj(R1Jj))}P_{2,j}=\{i\in J_{j}-R_{1}:s_{j}(i)>\varepsilon(M_{j}-s_{j}(R_{1}\cap J_{j}))\}, Q2,q={iJR1:wq(i)>ε(Wqwq(R1))}Q_{2,q}=\{i\in J-R_{1}:w_{q}(i)>\varepsilon(W_{q}-w_{q}(R_{1}))\}, and R2=(j=1kP2,j)(q=1dQ2,q)R_{2}=\left(\bigcup_{j=1}^{k}P_{2,j}\right)\cup\left(\bigcup_{q=1}^{d}Q_{2,q}\right). If val(R2)εval(J)\mathrm{val}(R_{2})\leq\varepsilon\cdot\mathrm{val}(J), set Y=R2Y=R_{2} and X=R1X=R_{1} and we’re done. Otherwise, set P3,j={iJjR1R2:sj(i)>ε(Mjsj((R1R2)Jj))}P_{3,j}=\{i\in J_{j}-R_{1}-R_{2}:s_{j}(i)>\varepsilon(M_{j}-s_{j}((R_{1}\cup R_{2})\cap J_{j}))\}, Q3,q={iJR1R2:wq(i)>ε(Wqwq(R1)wq(R2))}Q_{3,q}=\{i\in J-R_{1}-R_{2}:w_{q}(i)>\varepsilon(W_{q}-w_{q}(R_{1})-w_{q}(R_{2}))\}, and R3=(j=1kP3,j)(q=1dQ3,q)R_{3}=\left(\bigcup_{j=1}^{k}P_{3,j}\right)\cup\left(\bigcup_{q=1}^{d}Q_{3,q}\right). If val(R3)εval(J)\mathrm{val}(R_{3})\leq\varepsilon\cdot\mathrm{val}(J), set Y=R3Y=R_{3} and X=R1R2X=R_{1}\cup R_{2} and we’re done. Otherwise, similarly compute R4R_{4} and check if val(R4)εval(J)\mathrm{val}(R_{4})\leq\varepsilon\cdot\mathrm{val}(J), and so on. Extending the similar arguments about |R1|\left\lvert R_{1}\right\rvert, it follows that for all t>0t>0, |Rt|(d+k)/ε|R_{t}|\leq(d+k)/\varepsilon.

Since every RtR_{t} (t>0)(t>0) is disjoint, there will be some RTR_{T} such that val(RT)εval(J)\mathrm{val}(R_{T})\leq\varepsilon\cdot\mathrm{val}(J).

Now set Y=RTY=R_{T} and X=R1RT1X=R_{1}\cup\ldots\cup R_{T-1}. We can see that |X|t=1T|RT|T(d+k)/ε(d+k)/ε2|X|\leq\sum_{t=1}^{T}|R_{T}|\leq T(d+k)/\varepsilon\leq(d+k)/\varepsilon^{2} and val(Y)=val(RT)εval(J)\mathrm{val}(Y)=\mathrm{val}(R_{T})\leq\varepsilon\cdot\mathrm{val}(J). Note that all items in JXYJ-X-Y are small because of the way RTR_{T} was constructed. Hence it follows that

j[k],iJjXY,sj(i)ε(Mjsj(XJj))\forall j\in[k],\forall i\in J_{j}-X-Y,s_{j}(i)\leq\varepsilon(M_{j}-s_{j}(X\cap J_{j}))
iJXY,w(i)ε(Ww(X))\forall i\in J-X-Y,\overrightarrow{w}(i)\leq\varepsilon\left(\overrightarrow{W}-\overrightarrow{w}(X)\right)\qed

2.6 PTAS for Vector-Max-GAP

Let JJ^{*} be an optimal assignment for (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}). Let JjJJ_{j}^{*}\subseteq J^{*} be the items assigned to the jthj^{\textrm{th}} machine.

By Theorem 3, JJ^{*} can be partitioned into sets XX^{*}, YY^{*} and ZZ^{*} such that |X|d+kε2|X^{*}|\leq\frac{d+k}{\varepsilon^{2}} and val(Y)εval(J)\mathrm{val}(Y^{*})\leq\varepsilon\cdot\mathrm{val}(J^{*}). Let W=Ww(X)\overrightarrow{W}^{*}=\overrightarrow{W}-\overrightarrow{w}(X^{*}) and Mj=Mjsj(XJj)M_{j}^{*}=M_{j}-s_{j}(X^{*}\cap J_{j}^{*}). Then ZZ^{*} is ε\varepsilon-small for (val,s,w,M,W)(\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M}^{*},\overrightarrow{W}^{*}).

For a set SS, define Πk(S)\Pi_{k}(S) as the set of kk-partitions of SS. Then the pseudo code in Algorithm 1 provides a PTAS for the Vector-Max-GAP problem.

Algorithm 1 Vector-Max-GAP(I,p,s,w,M,W)\textrm{Vector-Max-GAP}(I,\overrightarrow{p},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}): PTAS for Vector Max GAP
Jbest={}J_{\textrm{best}}=\{\}.
for XIX\subseteq I such that |X|(d+k)/ε2|X|\leq(d+k)/\varepsilon^{2} do
     for (X1,X2,,Xk)Πk(X)(X_{1},X_{2},\ldots,X_{k})\in\Pi_{k}(X) do
         W=Ww(X)\overrightarrow{W}^{\prime}=\overrightarrow{W}-\overrightarrow{w}(X)
         Mj=Mjsj(Xj)M_{j}^{\prime}=M_{j}-s_{j}(X_{j}) for each j[k]j\in[k].
         valj(i)={valj(i)if sj(i)εMj0otherwise\mathrm{val}_{j}^{\prime}(i)=\begin{cases}\mathrm{val}_{j}(i)&\textrm{if }s_{j}(i)\leq\varepsilon M_{j}^{\prime}\\ 0&\textrm{otherwise}\end{cases} for each iIXi\in I-X.
         \triangleright IXI-X is ε\varepsilon-small for (val,s,w,M,W)(\overrightarrow{\mathrm{val}^{\prime}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M}^{\prime},\overrightarrow{W}^{\prime})
         Z=assignresaugε(IX,val,s,w,M,W)Z^{\prime}=\operatorname{assign-res-aug}_{\varepsilon}(I-X,\overrightarrow{\mathrm{val}^{\prime}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M}^{\prime},\overrightarrow{W}^{\prime}).
         Trim ZZ^{\prime} to get ZZ so that ZZ is feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M^{\prime}},\overrightarrow{W^{\prime}}).
         J=XZJ=X\cup Z
         if val(J)>val(Jbest)\mathrm{val}(J)>\mathrm{val}(J_{\textrm{best}}) then
              Jbest=JJ_{\textrm{best}}=J
         end if
     end for
end for
return JbestJ_{\textrm{best}}

Correctness: Since ZZ is feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M}^{\prime},\overrightarrow{W}^{\prime}), XZX\cup Z is feasible for (s,w,M,W)(\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}).

Approximation guarantee:
For some iteration of Algorithm 1, X=XX=X^{*} and Xj=XJjX_{j}=X^{*}\cap J_{j}^{*}. When that happens, W=W\overrightarrow{W}^{\prime}=\overrightarrow{W}^{*} and M=M\overrightarrow{M}^{\prime}=\overrightarrow{M}^{*}. Let val\mathrm{val}^{*} be the maximum value ε\varepsilon-small assignment of items to the machines with capacities given by M\overrightarrow{M}^{\prime} and over all weight constraints W\overrightarrow{W}^{\prime}. Therefore, valval(Z)\mathrm{val}^{*}\geq\mathrm{val}(Z^{*}).

To try to find an optimal assignment of small items, we’ll forbid non-small items to be assigned to a machine. To do this, if for item ii, sj(i)>εMjs_{j}(i)>\varepsilon M_{j}^{\prime}, set valj(i)\mathrm{val}_{j}(i) to 0. Using our resource-augmented Vector-Max-GAP algorithm, we get val(Z)val\mathrm{val}(Z^{\prime})\geq\mathrm{val}^{*}. By the property of trimming, val(Z)(12(d+1)ε)val(Z)\mathrm{val}(Z)\geq(1-2(d+1)\varepsilon)\mathrm{val}(Z^{\prime}).

val(Jbest)val(X)+val(Z)val(X)+(12(d+1)ε)val(Z)(12(d+1)ε)(1ε)val(J)\mathrm{val}(J_{\textrm{best}})\geq\mathrm{val}(X^{*})+\mathrm{val}(Z)\geq\mathrm{val}(X^{*})+(1-2(d+1)\varepsilon)\mathrm{val}(Z^{*})\geq(1-2(d+1)\varepsilon)(1-\varepsilon)\mathrm{val}(J^{*})

This gives us a (1(2d+3)ε)(1-(2d+3)\varepsilon)-approx solution. The running time can be easily seen to be polynomial as assignresaug\operatorname{assign-res-aug} runs in polynomial time and the number of iterations of the outer loop in Algorithm 1 is polynomial in nn and for one iteration of the outer loop, the inner loop runs at most constant number of times.

3 Algorithm for (2, dd) Knapsack Problem

In this section, we will obtain a (2+ε)(2+\varepsilon)-approximation algorithm for the (2, dd) knapsack problem both with and without rotations. First, we show the algorithm for the case without rotations. An algorithm for the case rotations are allowed is similar except for some small changes.

Let II be a set of nn (2, dd)-dimensional items. We are given a (2, dd)-dimensional knapsack and we would like to pack a high profit subset of II in the knapsack. Let us denote this optimal profit by OPTGVKS(I)\operatorname{OPT}_{\mathrm{GVKS}}(I). Let w=[w(1),,w(n)]\overrightarrow{w}=[w(1),\dots,w(n)], h=[h(1),,h(n)]\overrightarrow{h}=[h(1),\dots,h(n)], p=[p(1),,p(n)]\overrightarrow{p}=[p(1),\dots,p(n)]. For an item iIi\in I, let v(i)=[v1(i),,vd(i)]\overrightarrow{v}(i)=[v_{1}(i),\dots,v_{d}(i)] and let v=[v(1),,v(n)]\overrightarrow{v}=[\overrightarrow{v}(1),\dots,\overrightarrow{v}(n)].

In the whole section, a container is a rectangular region inside the knapsack. For our purposes, every container can be one of the four types: large, wide, tall, area. A large container can contain at most one item. An area container can only contain items that are ε\varepsilon-small for the container i.e. an item can be packed into an area container of width ww and height hh only if the item has width at most εw\varepsilon w and height at most εh\varepsilon h. In a wide (resp. tall) container, items must be stacked up one on top of another (resp. arranged side by side). We also require that the containers do not overlap amongst themselves and no item partially overlaps with any of the containers.

We also use the notation Oε(1)O_{\varepsilon}(1) in place of O(f(ε))O(f(\varepsilon)), where ε\varepsilon is an arbitrary constant and f()f(\cdot) is a function which solely depends on the value of ε\varepsilon, when we do not explicitly define what f()f(\cdot) is. Similarly, Oε1,ε2(1)O_{\varepsilon_{1},\varepsilon_{2}}(1) represents O(f(ε1,ε2))O(f(\varepsilon_{1},\varepsilon_{2})) and so on.

3.1 A Structural Result

Consider a set of items SS that are packed in a knapsack. We now state a structural result, inspired by [9], where only a subset of items SSS^{\prime}\subseteq S is packed into the knapsack. We may lose some profit but the packing has a nice structure which can be searched for, efficiently.

Theorem 4.

Let SS denote a set of items that can be feasibly packed into a knapsack and let 0<ε<10<\varepsilon<1 be any small constant. Then there exists a subset SSS^{\prime}\subseteq S such that p(S)(1/2ε)p(S)p(S^{\prime})\geq(1/2-\varepsilon)\cdot p(S). The items in SS^{\prime} are packed into the knapsack in containers. Further, the number of containers formed is Oε(1)O_{\varepsilon}(1) and their widths and heights belong to a set whose cardinality is poly(|S|)\operatorname{poly}(|S|) and moreover, this set can be computed in time poly(|S|)\operatorname{poly}(|S|).

Now, let us go back to our original problem instance II. Let IOPTI_{\mathrm{OPT}} be the set of items packed into the knapsack in an optimal packing 𝒫\mathcal{P}.

Let us apply Theorem 4 to the set of items IOPTI_{\mathrm{OPT}} with ε:=εstruct\varepsilon:=\varepsilon_{\mathrm{struct}} (εstruct\varepsilon_{\mathrm{struct}} will be defined later). Let IOPTI_{\mathrm{OPT}}^{\prime} be the resulting analog of SS^{\prime} in the theorem (there can be many candidates for IOPTI_{\mathrm{OPT}}^{\prime} but let us pick one). Therefore,

p(IOPT)(12εstruct)p(IOPT)=(12εstruct)OPTGVKS(I)\displaystyle p(I_{\mathrm{OPT}}^{\prime})\geq(\frac{1}{2}-\varepsilon_{\mathrm{struct}})\cdot p(I_{\mathrm{OPT}})=(\frac{1}{2}-\varepsilon_{\mathrm{struct}})\cdot\operatorname{OPT}_{\mathrm{GVKS}}{(I)} (1)

3.2 Proof of the Structural Result

In this subsection, we will prove Theorem 4.

The strategy to prove the theorem is to use the corridor decomposition scheme, essentially taken from [1]. First, we assume that we can remove O1/ε(1)O_{1/\varepsilon}(1) number of items at the cost of zero profit loss from the originally packed items. Under this assumption, we show that we lose at most half profit by our restructuring. Finally, we show how to get rid of this assumption by using shifting argumentations.

Removing Medium items: Let εsmall,εbig\varepsilon_{\mathrm{small}},\varepsilon_{\mathrm{big}} be two fixed constants such that εbig>εsmall\varepsilon_{\mathrm{big}}>\varepsilon_{\mathrm{small}}. We partition the items in SS based on the values of εsmall\varepsilon_{\mathrm{small}} and εbig\varepsilon_{\mathrm{big}} as follows:

  • SS={iS:w(i)εsmall and h(i)εsmall}S_{S}=\left\{i\in S\>:\>w(i)\leq\varepsilon_{\mathrm{small}}\textup{ and }h(i)\leq\varepsilon_{\mathrm{small}}\right\}

  • SB={iS:w(i)>εbig and h(i)>εbig}S_{B}=\left\{i\in S\>:\>w(i)>\varepsilon_{\mathrm{big}}\textup{ and }h(i)>\varepsilon_{\mathrm{big}}\right\}

  • SW={iS:w(i)>εbig and h(i)εsmall}S_{W}=\left\{i\in S\>:\>w(i)>\varepsilon_{\mathrm{big}}\textup{ and }h(i)\leq\varepsilon_{\mathrm{small}}\right\}

  • ST={iS:w(i)εsmall and h(i)>εbig}S_{T}=\left\{i\in S\>:\>w(i)\leq\varepsilon_{\mathrm{small}}\textup{ and }h(i)>\varepsilon_{\mathrm{big}}\right\}

  • Smed={iS:w(i)>εsmall and w(i)εbigORh(i)εbig and h(i)>εsmall}S_{\mathrm{med}}=\left\{i\in S\>:\>w(i)>\varepsilon_{\mathrm{small}}\textup{ and }w(i)\leq\varepsilon_{\mathrm{big}}\quad\textup{OR}\quad h(i)\leq\varepsilon_{\mathrm{big}}\textup{ and }h(i)>\varepsilon_{\mathrm{small}}\right\}

We call the items in SSS_{S} as small items as they are small in both the dimensions. Similarly, we call the items in SB,SW,ST,SmedS_{B},S_{W},S_{T},S_{\mathrm{med}} as big, wide, tall, medium respectively.

By standard arguments, it is possible to choose the constants εsmall\varepsilon_{\mathrm{small}} and εbig\varepsilon_{\mathrm{big}} such that the total profit of all the medium items is at most εp(S)\varepsilon\cdot p(S). Hence, we can discard the items in SmedS_{\mathrm{med}} from SS while losing a very small profit. We omit the proof as it is present in many articles on packing (see, for example, [9]).

3.2.1 Corridors

First, let us define what a subcorridor is. A subcorridor is just a rectangle in the 2D coordinate system with one side longer than εbig\varepsilon_{\mathrm{big}} and the other side having a length of at most εbig\varepsilon_{\mathrm{big}}. A subcorridor is called wide (resp. tall) if the longer side is parallel to the xx-axis (resp. yy-axis).

A corridor is just a subcorridor or a union of at most 1/ε1/\varepsilon subcorridors such that each wide (resp. tall) subcorridor overlaps with exactly two tall (resp. wide) subcorridors, except for at most two subcorridors which are called the ends of the corridors and can overlap with exactly one subcorridor. The overlap between any two subcorridors should be in such a way that one of their corners coincide.

3.2.2 Corridor Decomposition

For now, let’s consider a generic packing of a set of items SS that can contain big, small, wide, tall items.

Since the number of big items packed can be at most a constant, and since we assumed that we can remove a constant number of items at no profit loss, let us remove all the big items from the packing. Let’s also get rid of the small items for now (we will pack the small items later). Hence, we are left with wide and tall items packed in the knapsack. Let’s name these items as skewed items and denote the set of these items by SskewS_{\mathrm{skew}}.

Lemma 5 (Corridor Packing lemma [1]).

There exist non-overlapping corridor regions in the knapsack such that we can partition SskewS_{\mathrm{skew}} into sets ScorrS_{\mathrm{corr}}, ScrossniceS_{\mathrm{cross}}^{\mathrm{nice}}, ScrossbadS_{\mathrm{cross}}^{\mathrm{bad}} such that

  • |Scrossnice|=O1/ε(1)\left\lvert S_{\mathrm{cross}}^{\mathrm{nice}}\right\rvert=O_{1/\varepsilon}(1)

  • p(Scrossbad)Oε(1)p(Sskew)p(S_{\mathrm{cross}}^{\mathrm{bad}})\leq O_{\varepsilon}(1)\cdot p(S_{\mathrm{skew}})

  • Every item in ScorrS_{\mathrm{corr}} is fully contained in one of the corridors. The number of corridors is O1/ε,1/εbig(1)O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}}}(1) and in each corridor, the number of subcorridors is at most 1/ε1/\varepsilon.

  • Each subcorridor has length at least εbig\varepsilon_{\mathrm{big}} and breadth less than εbig\varepsilon_{\mathrm{big}} (assuming length to denote the longest side and breadth to denote the smallest side).

Remark 6.

The total number of subcorridors after the corridor partition is O1/ε,1/εbig(1)O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}}}(1).

We also remove items in ScrossniceS_{\mathrm{cross}}^{\mathrm{nice}} since they are at most a constant in number and items in ScrossbadS_{\mathrm{cross}}^{\mathrm{bad}} since their total profit is very less.

The last point of the lemma ensures that a skewed item is completely contained in at most one subcorridor. Hence for every skewed item contained in a corridor, we can tell which subcorridor it belongs to. The last point also ensures that, there can not be a subcorridor which completely contains both wide and tall items. This fact allows us to label each subcorridor as wide or tall: If a subcorridor contains only wide (resp. tall) items, we say that it is a wide (resp. tall) subcorridor.

Removing either wide or tall items: Now, we will simplify the above structure of skewed items while losing at most half of the original profit.

Assume w.l.o.g. that the total profit of wide items is at least as much as the total profit of the tall items. Hence, if we get rid of the tall items, we lose at most half of the original profit. With this step, we can also remove all the tall subcorridors since they are all empty. We are left with wide items packed in wide subcorridors. Since the subcorridors are just rectangles and they no longer overlap, we just call these subcorridors as boxes.

Next, we will describe how to reorganize the items in these boxes into containers at a very marginal profit loss.

3.2.3 Reorganizing Boxes into Containers

Note that the boxes contain only wide items. And since the width of the wide items is lower bounded by εbig\varepsilon_{\mathrm{big}}, we can create an empty wide strip in each box at the loss of very small profit and at most a constant number of items. This is described in the following lemma.

Lemma 7.

Let BB be a box of dimensions a×ba\times b such that each item contained in it has a width of at least μ\mu, where μ\mu is a constant. Let the total profit packed inside the item be PP and let εbox\varepsilon_{\mathrm{box}} be a small constant. Then, it is possible to pack all the items barring a set of items of profit at most εboxP\varepsilon_{\mathrm{box}}\cdot P and a set of O1/μ(1)O_{1/\mu}(1) number of items into a box of dimensions a×(1εbox)ba\times(1-\varepsilon_{\mathrm{box}})b.

Proof.

Assume the height of the box is along the yy-axis and width of the box is along the xx-axis and say, the bottom left corner of the box is situated at the origin. Draw lines at y=yiy=y_{i} for i{1,,1/εbox}i\in\left\{1,\dots,\left\lfloor 1/\varepsilon_{\mathrm{box}}\right\rfloor\right\} such that yi=iεboxby_{i}=i\cdot\varepsilon_{\mathrm{box}}b. These lines will partition the box into 1/εbox\left\lceil 1/\varepsilon_{\mathrm{box}}\right\rceil regions. For all i{1,,1/εbox}i\in\left\{1,\dots,\left\lceil 1/\varepsilon_{\mathrm{box}}\right\rceil\right\}, let sis_{i} be the set of items completely contained in the ithi^{\textrm{th}} region. Then, there must exist some region jj such that p(sj)(1/1/εbox)Pp(s_{j})\leq(1/\left\lceil 1/\varepsilon_{\mathrm{box}}\right\rceil)\cdot P. We will remove all the items in sjs_{j}. Also, the number of items partially overlapping with the region jj can be at most 2/μ2/\mu, which is O1/μ(1)O_{1/\mu}(1). By removing these items, we create an empty strip of size a×εboxba\times\varepsilon_{\mathrm{box}}b and hence the remaining items can be packed in a box of size a×(1εbox)ba\times(1-\varepsilon_{\mathrm{box}})b. ∎

We apply the above lemma to each and every box with small enough εbox\varepsilon_{\mathrm{box}} and μ=εbig\mu=\varepsilon_{\mathrm{big}}. Consider a box BB and let SboxS_{\mathrm{box}} be the items packed inside BB. Also, let a×ba\times b be the dimensions of the box. Let SboxS_{\mathrm{box}}^{\prime} be the set of items in the knapsack after performing the steps in Lemma 7. SboxS_{\mathrm{box}}^{\prime} can be packed within the box a×(1εbox)ba\times(1-\varepsilon_{\mathrm{box}})b and we are left with some empty space in the vertical direction. Hence, we can apply the resource augmentation lemma, which is taken from [9].

Lemma 8 (Resource Augmentation Lemma).

Let II be a set of items packed inside a box of dimensions a×ba\times b and let εra\varepsilon_{\mathrm{ra}} be a given constant. Then there exists a container packing of a set III^{\prime}\subseteq I inside a box of size a×(1+εra)ba\times(1+\varepsilon_{\mathrm{ra}})b such that

  • p(I)(1Oεra(1))p(I)p(I^{\prime})\geq(1-O_{\varepsilon_{\mathrm{ra}}}(1))\cdot p(I)

  • The number of containers is O1/εra(1)O_{1/\varepsilon_{\mathrm{ra}}}(1) and the dimensions of the containers belong to a set of cardinality 𝒪(|I|O1/εra(1))\mathcal{O}\left(\left\lvert I\right\rvert^{O_{1/\varepsilon_{\mathrm{ra}}}(1)}\right).

  • The total area of the containers is at most a(I)+εraaba(I)+\varepsilon_{\mathrm{ra}}\cdot ab

Applying the above lemma to the box BB, we obtain a packing where SboxS_{\mathrm{box}}^{\prime} is packed into box of size a×(1εbox)(1+εra)ba\times(1-\varepsilon_{\mathrm{box}})(1+\varepsilon_{\mathrm{ra}})b. We will choose εbox,εra\varepsilon_{\mathrm{box}},\varepsilon_{\mathrm{ra}} such that the product (1εbox)(1+εra)<(12ε)(1-\varepsilon_{\mathrm{box}})(1+\varepsilon_{\mathrm{ra}})<(1-2\varepsilon).

Lemma 9.

The total area of containers obtained is at most

min{(12ε),a(Scorr)+εra}\min\left\{(1-2\varepsilon),a(S_{\mathrm{corr}})+\varepsilon_{\mathrm{ra}}\right\}
Proof.

The second upper bound directly follows from the last point of Lemma 8: Area of the containers in a box BB of dimensions a×ba\times b is at most a(Sbox)+εraaba(S_{\mathrm{box}})+\varepsilon_{\mathrm{ra}}\cdot ab. Summing over all boxes we get the bound a(Scorr)+εraa(S_{\mathrm{corr}})+\varepsilon_{\mathrm{ra}}.

For the first upper bound, observe that every box of dimensions a×ba\times b is shrunk into a box of dimensions a×(12ε)ba\times(1-2\varepsilon)b. Since all the original boxes were packable into the knapsack, the total area of the boxes (and hence the containers) after shrinking is at most (12ε)(1-2\varepsilon) times the area of the knapsack itself, which is 1. ∎

To this end, we have completed packing all the items into containers (except the constant number of discarded items and the small items). We will analyze the number of containers created. A box was partitioned into O1/εra(1)O_{1/\varepsilon_{\mathrm{ra}}}(1) containers as given by Lemma 8 and boxes are nothing but subcorridors whose number is O1/ε,1/εbig(1)O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}}}(1) by Remark 6. Hence the total number of containers formed is O1/ε,1/εbig,1/εra(1)O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}},1/\varepsilon_{\mathrm{ra}}}(1). This fact is going to be crucial in order to pack the small items.

3.2.4 Packing Small Items

In this subsection, we show how to pack small items that have been removed from the packing temporarily. Let the set of small items be denoted by SsmallS_{\mathrm{small}}. Let εgrid=1/ε/εsmall\varepsilon_{\mathrm{grid}}=1/\left\lceil\varepsilon/\varepsilon_{\mathrm{small}}\right\rceil.

Let us define a uniform grid 𝒢\mathcal{G} in the knapsack where grid lines are equally spaced at a distance of εgrid\varepsilon_{\mathrm{grid}}. It is easy to see that the number of grid cells formed is at most 1/εgrid21/\varepsilon_{\mathrm{grid}}^{2} which is at most a constant. We mark a grid cell as free if it has no overlapping with any container and non-free otherwise. We delete all the non-free cells and the free cells will serve as the area containers that we use to pack the small items.

Lemma 10.

For some choice of εsmall\varepsilon_{\mathrm{small}} and εra\varepsilon_{\mathrm{ra}}, the total area of non-free cells is at most

min{(1ε),a(Scorr)+3ε2}\min\left\{(1-\varepsilon),a(S_{\mathrm{corr}})+3\varepsilon^{2}\right\}
Proof.

Let AA be the total area of containers and kk be the number of containers. The total area of cells completely covered by containers is at most AA. The partially overlapped cells are the cells that intersect the edges of the containers. Since, the number of containers is kk and each container has 4 edges and each edge can overlap with at most 1/εgrid1/\varepsilon_{\mathrm{grid}} number of cells, the area of completely and partially overlapped cells is at most

A+4k1εgridεgrid2=A+4k1ε/εsmallA+4k\cdot\frac{1}{\varepsilon_{\mathrm{grid}}}\cdot\varepsilon_{\mathrm{grid}}^{2}=A+4k\cdot\frac{1}{\left\lceil\varepsilon/\varepsilon_{\mathrm{small}}\right\rceil}

As we noted before, k=O1/ε,1/εbig,1/εra(1)k=O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}},1/\varepsilon_{\mathrm{ra}}}(1) which doesn’t depend on εsmall\varepsilon_{\mathrm{small}} in some sense. Hence, we can choose a very small εsmall\varepsilon_{\mathrm{small}} (when compared to ε,εbig,εra\varepsilon,\varepsilon_{\mathrm{big}},\varepsilon_{\mathrm{ra}}), and ensure that the above quantity is at most A+2ε2A+2\varepsilon^{2}.

By Lemma 9, the value of AA is bounded by min{(12ε),a(Scorr)+εra}.\min\left\{(1-2\varepsilon),a(S_{\mathrm{corr}})+\varepsilon_{\mathrm{ra}}\right\}.

Hence, the total area of deleted cells is at most min{(12ε+2ε2),a(Scorr)+εra+2ε2}.\min\left\{(1-2\varepsilon+2\varepsilon^{2}),a(S_{\mathrm{corr}})+\varepsilon_{\mathrm{ra}}+2\varepsilon^{2}\right\}.

For ε<1/2\varepsilon<1/2 and by choosing εra<ε2\varepsilon_{\mathrm{ra}}<\varepsilon^{2}, we get the desired result. ∎

We now show that there is a significant area of free cells left to pack the small items profitably.

Lemma 11.

The area of free cells is at least (13ε)a(Ssmall)(1-3\varepsilon)a(S_{\mathrm{small}})

Proof.

Since SsmallS_{\mathrm{small}} and ScorrS_{\mathrm{corr}} were packable in the knapsack, a(SsmallScorr)1a(S_{\mathrm{small}}\cup S_{\mathrm{corr}})\leq 1.

Now if a(Ssmall)εa(S_{\mathrm{small}})\geq\varepsilon, then the area of free cells is at least 1a(Scorr)3ε2a(Ssmall)3ε2(13ε)a(Ssmall)1-a(S_{\mathrm{corr}})-3\varepsilon^{2}\geq a(S_{\mathrm{small}})-3\varepsilon^{2}\geq(1-3\varepsilon)a(S_{\mathrm{small}})

On the other hand, if a(Ssmall)<εa(S_{\mathrm{small}})<\varepsilon, then the area of free cells is at least ε\varepsilon which in turn is at least a(Ssmall)a(S_{\mathrm{small}}). ∎

Each free cell has dimensions εgrid×εgrid\varepsilon_{\mathrm{grid}}\times\varepsilon_{\mathrm{grid}} and a small item has each side at most εsmall\varepsilon_{\mathrm{small}}. Hence, all small items are ε\varepsilon-small for the created free cells and these can be used to pack the small items. Using NFDH, we can pack a very high profit in the area containers as described in the following lemma.

Lemma 12.

Let II be a set of items and let there be kk identical area containers such that each item iIi\in I is ε\varepsilon-small for every container and the whole set II can be packed in these containers. Then there exists an algorithm which packs a subset III^{\prime}\subseteq I in these area containers such that p(I)(12ε)p(I)p(I^{\prime})\geq(1-2\varepsilon)p(I).

Proof.

W.l.o.g., assume that each container has dimensions 1×11\times 1. So, we can assume that every item iIi\in I has a width of at most ε\varepsilon and a height of at most ε\varepsilon. Order the items in II in non-increasing ratio of profit/area (we call this profit density) breaking ties arbitrarily and also order the containers arbitrarily.

Start packing items into the containers using NFDH. If we are able to pack all the items in II, we are done. Otherwise, consider an arbitrary container CC. Let ICI_{C} be the items we packed in CC and let iCi_{C} be the item we could not pack in CC. Then by Lemma 15, a(IC{iC})>(1ε)2a(C)=(1ε)2a(I_{C}\cup\{i_{C}\})>(1-\varepsilon)^{2}a(C)=(1-\varepsilon)^{2}. But since a(iC)ε2a(i_{C})\leq\varepsilon^{2}, a(IC)>12εa(I_{C})>1-2\varepsilon. Hence, we have packed at least (12ε)(1-2\varepsilon) fraction of the total area of the containers with the densest items and thus the claim follows. ∎

To this end, we have packed at least (1/2Oε(1))(1/2-O_{\varepsilon}(1)) fraction of the total profit in the original packing assuming that we can leave out a constant number of items at no cost.

3.2.5 Shifting Argumentation

We assumed that we can drop O1/ε(1)O_{1/\varepsilon}(1) number of items from SS at no profit loss. But this may not be true because they can carry significant amount of profit in the original packing. The left out constant number of items are precisely the big items and items in ScrossniceS_{\mathrm{cross}}^{\mathrm{nice}} and the items partially overlapping with the removed strip in Lemma 7.

The main idea is to fix some items in the knapsack and then carry out our algorithm discussed in the previous sections with some modifications. Again, we may leave out some items with high profit. We fix these items too and repeat this process. We can argue that at some point, the left out items have a very less profit and hence this process will end.

Let us define the set K(0)K(0) as the set of items that were removed in the above process. If the total profit of K(0)K(0) is at most εp(S)\varepsilon\cdot p(S), then we are done. If this is not the case, then we use shifting argumentation.

Assume that we completed the ttht^{\textrm{th}} iteration for some t>0t>0 and say p(K(r))>εp(S)p(K(r))>\varepsilon\cdot p(S) for all 0rt0\leq r\leq t. Let 𝒦(t)=r=0tK(t)\mathcal{K}(t)=\bigcup_{r=0}^{t}K(t). We will argue that for every rtr\leq t, |K(r)|\left\lvert K(r)\right\rvert is at most a constant. Then |𝒦(t)|\left\lvert\mathcal{K}(t)\right\rvert is also at most a constant if t<1/εt<\left\lceil 1/\varepsilon\right\rceil (in fact, we will argue that tt will not go beyond 1/ε\left\lfloor 1/\varepsilon\right\rfloor).

Let us define a non-uniform grid 𝒢(t)\mathcal{G}(t) induced by the set 𝒦(t)\mathcal{K}(t) as follows: The xx and yy coordinates of the grid are given by all the corners of the items in 𝒦(t)\mathcal{K}(t). Note that the number of horizontal (resp. vertical) grid lines is bounded by 2|𝒦(t)|2\left\lvert\mathcal{K}(t)\right\rvert. This grid partitions the knapsack into a set of cells 𝒞(t)\mathcal{C}(t). Since |𝒦(t)|\left\lvert\mathcal{K}(t)\right\rvert is at most a constant, the number of grid cells created is also at most a constant.

Let us denote an arbitrary grid cell by CC and the items in SS which intersect CC and which are not in 𝒦(t)\mathcal{K}(t) by S(C)S(C). For an item ii in S(C)S(C), let h(iC)h(i\cap C) and w(iC)w(i\cap C) denote the width and height of the overlap of an item ii with CC. We categorize the items in S(C)S(C) relative to CC as follows.

  • Ssmall(C)={iS(C):h(iC)εsmallh(C) and w(iC)εsmallw(C)}S_{\mathrm{small}}(C)=\left\{i\in S(C):h(i\cap C)\leq\varepsilon_{\mathrm{small}}h(C)\textup{ and }w(i\cap C)\leq\varepsilon_{\mathrm{small}}w(C)\right\}

  • Sbig(C)={iS(C):h(iC)>εbigh(C) and w(iC)>εbigw(C)}S_{\mathrm{big}}(C)=\left\{i\in S(C):h(i\cap C)>\varepsilon_{\mathrm{big}}h(C)\textup{ and }w(i\cap C)>\varepsilon_{\mathrm{big}}w(C)\right\}

  • Swide(C)={iS(C):h(iC)εsmallh(C) and w(iC)>εbigw(C)}S_{\mathrm{wide}}(C)=\left\{i\in S(C):h(i\cap C)\leq\varepsilon_{\mathrm{small}}h(C)\textup{ and }w(i\cap C)>\varepsilon_{\mathrm{big}}w(C)\right\}

  • Stall(C)={iS(C):h(iC)>εbigh(C) and w(iC)εsmallw(C)}S_{\mathrm{tall}}(C)=\left\{i\in S(C):h(i\cap C)>\varepsilon_{\mathrm{big}}h(C)\textup{ and }w(i\cap C)\leq\varepsilon_{\mathrm{small}}w(C)\right\}

We call an item ii small if it is not in Sbig(C)Swide(C)Stall(C)S_{\mathrm{big}}(C)\cup S_{\mathrm{wide}}(C)\cup S_{\mathrm{tall}}(C) for some cell CC. We call an item ii big if it is in Sbig(C)S_{\mathrm{big}}(C) for some cell CC. We call an item ii wide (resp. tall) if it is in Swide(C)S_{\mathrm{wide}}(C) (resp. Stall(C)S_{\mathrm{tall}}(C)) for some cell CC.

We call an item ii medium if there is a cell CC such that h(iC)(εsmallh(C),εbigh(C)]h(i\cap C)\in\left(\varepsilon_{\mathrm{small}}h(C),\varepsilon_{\mathrm{big}}h(C)\right] or w(iC)(εsmallw(C),εbigw(C)]w(i\cap C)\in\left(\varepsilon_{\mathrm{small}}w(C),\varepsilon_{\mathrm{big}}w(C)\right].

It is easy to observe that an item must belong to exactly one of small, big, wide, tall, medium categories. Note that the width and height of a small item are at most εsmall\varepsilon_{\mathrm{small}}. We call an item ii skewed if it is either wide or tall.

Again by standard arguments, we can select εsmall\varepsilon_{\mathrm{small}} and εbig\varepsilon_{\mathrm{big}} such that the profit of the medium items is at most εp(S)\varepsilon\cdot p(S). Hence, we remove all the medium items. We also remove all the small items for now, but we will pack them at the end exactly as in Section 3.2.4. We add all the big items to K(t+1)K(t+1). We can do this because the big items are at most constant in number: Consider any cell CC. The number of big items associated with it is at most a constant and the number of cells themselves is at most a constant.

We create a corridor decomposition in the knapsack with respect to the skewed items as follows: First we transform this non-uniform grid into a uniform grid by moving the grid lines and simultaneously stretching or compressing the items. This transformation is to ensure that every wide (resp. tall) item associated with a cell CC has at least a width (resp. height) of εbig/(1+2|𝒦(t)|)\varepsilon_{\mathrm{big}}/(1+2\left\lvert\mathcal{K}(t)\right\rvert). We apply Lemma 5 on the set of skewed items into a set of O1/ε,1/εbig(1)O_{1/\varepsilon,1/\varepsilon_{\mathrm{big}}}(1) corridors. Let Scorr,Scrossnice,ScrossbadS_{\mathrm{corr}},S_{\mathrm{cross}}^{\mathrm{nice}},S_{\mathrm{cross}}^{\mathrm{bad}} be the sets obtained similar to Lemma 5. The set ScorrS_{\mathrm{corr}} is the set of items that are packed in the corridors completely. We add the set ScrossniceS_{\mathrm{cross}}^{\mathrm{nice}} to K(t+1)K(t+1) since they are constant in number. As the set ScrossbadS_{\mathrm{cross}}^{\mathrm{bad}} has a very small profit, we discard them. We also remove all the items in tall subcorridors assuming, w.l.o.g., that their profit is at most that of the items in wide subcorridors.

Now, we have the items in 𝒦(t)\mathcal{K}(t) fixed inside the knapsack and the items in boxes (obtained after deleting the tall items and hence deleting the tall subcorridors). We would like to split the boxes into containers as in Section 3.2.3 but there is an issue: There can be items in 𝒦(t)\mathcal{K}(t) which overlap with the boundaries of the boxes. But these are at most a constant in number and hence we can resolve this issue in the following way.

Consider an item ii in 𝒦(t)\mathcal{K}(t) partially overlapping with a box. We extend each of its horizontal edge that is inside the box in both the directions till the ends of the box. This extended edge and ii divide the items in the box into at most five categories: The items intersecting the extended edge, the items to the left of ii, the items to the right of ii, the items above ii and the items below ii. We note that the items in the first part are at most a constant in number and hence add them to K(t+1)K(t+1). Thus ii splits the box into at most four smaller boxes. We repeat this process for all the items in 𝒦(t)\mathcal{K}(t) partially overlapping with the box. We obtain smaller boxes but with the required property that there are no partially overlapping items in 𝒦(t)\mathcal{K}(t) with the boxes. This is depicted in Figure 2.

We apply Lemma 7 to these smaller boxes and while doing this, we add all the items partially overlapping with the removed strip to K(t+1)K(t+1). Then, we apply Lemma 8 to these new smaller boxes to split them into containers as in Section 3.2.3. At this point, the (t+1)th(t+1)^{\textrm{th}} round ends and we look at the set K(t+1)K(t+1). If p(K(t+1))εp(S)p(K(t+1))\leq\varepsilon\cdot p(S), we end; otherwise we continue to round t+2t+2. We can argue that the number of rounds are at most 1/ε1/\varepsilon: K(r)K(r) and K(r+1)K(r+1) are disjoint for all r0r\geq 0. Hence, for some r<1/εr<\left\lceil 1/\varepsilon\right\rceil, we can guarantee that p(K(r))p(K(r)) is at most εp(S)\varepsilon\cdot p(S).

Therefore, after the rthr^{\textrm{th}} round, we end the process and we add the small items to the packing as described in Section 3.2.4.

In [9], it is also shown how to modify the formed containers so that their widths and heights come from a set of cardinality poly(|S|)\operatorname{poly}(\left\lvert S\right\rvert). The basic idea is as follows. First note that a large container contains only one item. Hence, the size of the container can be shrunk to that of the item. Now, consider a wide container CWC_{W}. Items are lying one on top of another inside CC. So, h(CW)h(C_{W}) can be expressed as the sum of heights of all the items. Also, w(cW)w(c_{W}) can be expressed as the maximum among all the widths of items in the container. If there are at most 1/ε1/\varepsilon number of items in CWC_{W}, then h(CW)h(C_{W}) can belong to a set containing at most n1/εn^{1/\varepsilon} values. If CWC_{W} has more than 1/ε1/\varepsilon number of items, then we consider the tallest 1/ε1/\varepsilon number of items in CWC_{W}. Let this set be TT. There must certainly exist an item iTi\in T whose profit is at most εp(CW)\varepsilon p(C_{W}). We remove the item ii from the container and readjust the height of CWC_{W} so that its height belongs to a polynomial set of values. Now consider an area container CAC_{A}. Since all items in CAC_{A} are ε\varepsilon-small with respect to the dimensions of CAC_{A}, we can leave out a subset of items carrying a very marginal profit and create some space in both the horizontal and vertical directions so that the width and height of CAC_{A} can be readjusted. For full proof one can refer to [9]. This proves Theorem 4.

Figure 2: Division of box into smaller boxes: The dark item is the item in 𝒦(t)\mathcal{K}(t) that overlaps with the box. The dashed lines are the extended edges and the grey items are those that will be included in K(t+1)K(t+1)

3.3 Container Packing Problem and Vector-Max-GAP

From now on, our main goal would be to derive an algorithm to construct the nice structure as in Theorem 4. We first formally define the problem of packing items into containers which we call the container packing problem. We then model the container packing problem as an instance of the Vector-Max-GAP problem. Since we have a PTAS for the Vector-Max-GAP problem, it follows that there exists a PTAS for the container packing problem.

Let II be a set of items and let w,h,p,v\overrightarrow{w},\overrightarrow{h},\overrightarrow{p},\overrightarrow{v} denote the associated widths, heights, profits and weights respectively.

Let CC be a given set of containers such that the number of containers is constant. Out of CC, let CA,CH,CV,CLC_{A},C_{H},C_{V},C_{L} denote area, wide, tall and large containers respectively.

In the Container Packing Problem, we would like to pack a subset of II into these containers such that

  • A large container can either be empty or can contain exactly one item.

  • In a wide (resp. tall) container, all the items must be stacked up one on top of another (resp. arranged side by side).

  • The total area of items packed in an area container must not exceed (1ε)2(1-\varepsilon^{\prime})^{2} times the area of the container itself (assume that ε\varepsilon^{\prime} is a constant given as a part of the input).

  • The total weight of items packed in all the containers in any dimension j{1,,d}j\in\{1,\dots,d\} should not exceed one.

We denote an instance of the container packing problem by the tuple (I,w,h,p,v,C,ε)(I,\overrightarrow{w},\overrightarrow{h},\overrightarrow{p},\overrightarrow{v},C,\varepsilon^{\prime}).

Now, let us define the Vector-Max-GAP problem. Let II be a set of nn items and let us say, we have kk machines such that the jthj^{\textrm{th}} machine has a capacity MjM_{j}. An item ii has a size of sj(i)s_{j}(i), value of valj(i)\mathrm{val}_{j}(i) in the jthj^{\textrm{th}} machine and weight wq(i)w_{q}(i) in the qthq^{\textrm{th}} dimension. The objective is to assign a maximum value subset of items III^{\prime}\subseteq I, each item to a machine, such that the total size of items in a machine does not exceed the capacity of that machine. We also require that the total weight of II^{\prime} does not exceed WqW_{q} (a non-negative real) in any dimension q[d]q\in[d].

Let M=[M1,M2,,Mk]\overrightarrow{M}=[M_{1},M_{2},\dots,M_{k}], W=[W1,W2,,Wd]\overrightarrow{W}=[W_{1},W_{2},\dots,W_{d}], w(i)=[w1(i),w2(i),,wd(i)]\overrightarrow{w}(i)=[w_{1}(i),w_{2}(i),\dots,w_{d}(i)], s(i)=[s1(i),s2(i),,sk(i)]\overrightarrow{s}(i)=[s_{1}(i),s_{2}(i),\dots,s_{k}(i)], val(i)=[val1(i),val2(i),,valk(i)]\overrightarrow{\mathrm{val}}(i)=[\mathrm{val}_{1}(i),\mathrm{val}_{2}(i),\dots,\mathrm{val}_{k}(i)].

Also, let s=[s(1),s(2),,s(n)]\overrightarrow{s}=[\overrightarrow{s}(1),\overrightarrow{s}(2),\dots,\overrightarrow{s}(n)], w=[w(1),w(2),,w(n)],val=[val(1),val(2),,val(n)]\overrightarrow{w}=[\overrightarrow{w}(1),\overrightarrow{w}(2),\dots,\overrightarrow{w}(n)],\overrightarrow{\mathrm{val}}=[\overrightarrow{\mathrm{val}}(1),\overrightarrow{\mathrm{val}}(2),\dots,\overrightarrow{\mathrm{val}}(n)]. We denote an instance of Vector-Max-GAP by (I,val,s,w,M,W)(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}).

3.4 Reduction of Container Packing Problem to Vector-Max-GAP

Let 𝒞=(I,w,h,p,v,C,ε)\mathcal{C}=(I,\overrightarrow{w},\overrightarrow{h},\overrightarrow{p},\overrightarrow{v},C,\varepsilon^{\prime}) denote an instance of the container packing problem. In this subsection, we show how to reduce 𝒞\mathcal{C} to an instance 𝒢=(I,val,s,w,M,W)\mathcal{G}=(I,\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{w},\overrightarrow{M},\overrightarrow{W}) of the Vector-Max-GAP problem.

We retain II from 𝒞\mathcal{C}. Since we have unit vector constraints over all the containers combined in the container packing problem, we initialize W\overrightarrow{W} to be the vector of all ones. We choose the number of machines in 𝒢\mathcal{G} to be same as the number of containers in 𝒞\mathcal{C}. Let |C|=k\left\lvert C\right\rvert=k and |I|=n\left\lvert I\right\rvert=n. The vectors val,s,M\overrightarrow{\mathrm{val}},\overrightarrow{s},\overrightarrow{M} are defined as follows:

sj(i)\displaystyle s_{j}(i) ={1if Cj is a large container and i can fit in inside Cjif i can not fit in inside Cjh(i)if Cj is a wide container and i fits in inside Cjw(i)if Cj is a tall container and i fits in inside Cjw(i)h(i)if Cj is an area container and i is ε-small for Cjif Cj is an area container but i is not ε-small for Cj\displaystyle=\begin{cases}1&\textup{if $C_{j}$ is a large container and $i$ can fit in inside $C_{j}$}\\ \infty&\textup{if $i$ can not fit in inside $C_{j}$}\\ h(i)&\textup{if $C_{j}$ is a wide container and $i$ fits in inside $C_{j}$}\\ w(i)&\textup{if $C_{j}$ is a tall container and $i$ fits in inside $C_{j}$}\\ w(i)h(i)&\textup{if $C_{j}$ is an area container and $i$ is $\varepsilon^{\prime}$-small for $C_{j}$}\\ \infty&\textup{if $C_{j}$ is an area container but $i$ is not $\varepsilon^{\prime}$-small for $C_{j}$}\\ \end{cases}
Mj\displaystyle M_{j} ={1if Cj is a large containerh(Cj)if Cj is a wide containerw(Cj)if Cj is a tall container(1ε)2h(Cj)w(Cj)if Cj is an area container\displaystyle=\begin{cases}1&\textup{if $C_{j}$ is a large container}\\ h(C_{j})&\textup{if $C_{j}$ is a wide container}\\ w(C_{j})&\textup{if $C_{j}$ is a tall container}\\ (1-\varepsilon^{\prime})^{2}h(C_{j})w(C_{j})&\textup{if $C_{j}$ is an area container}\\ \end{cases}
valj(i)\displaystyle\mathrm{val}_{j}(i) =p(i)\displaystyle=p(i)
wq(i)\displaystyle w_{q}(i) =vq(i)\displaystyle=v_{q}(i)

In the above definitions of sj(i),Mj,valj(i)s_{j}(i),M_{j},\mathrm{val}_{j}(i) and wq(i)w_{q}(i), ii varies from 1 to nn, jj varies from 1 to kk and qq varies from 1 to dd.

Let II^{\prime} denote a subset of II packed in a feasible solution to 𝒞\mathcal{C}. Then II^{\prime} can also be feasibly assigned to the machines of our Vector-Max-GAP problem: Just assign all the items in a container CjC_{j} to the jthj^{\textrm{th}} machine.

  • If CjC_{j} is a large container, then the only item packed into it has size 1 in machine MjM_{j} and capacity of MjM_{j} is also 1 and hence assigning this item to the jthj^{\textrm{th}} machine is feasible.

  • If CjC_{j} is a wide (resp. tall) container, the items packed in CjC_{j} are wide and stacked up (resp. tall and arranged side by side). Hence their total height (resp. width), which is the total size of items assigned to the jthj^{\textrm{th}} machine, does not exceed the total height (resp. width) of the container, which is the capacity of the jthj^{\textrm{th}} machine.

  • If CjC_{j} is an area container, the total area of items packed in BjB_{j} does not exceed (1ε)2a(Cj)(1-\varepsilon^{\prime})^{2}\cdot a(C_{j}) which yields that the total size of items assigned to the jthj^{\textrm{th}} machine does not exceed the capacity of the jthj^{\textrm{th}} machine.

The total weight of all the items assigned to machines does not exceed W\overrightarrow{W} (which is equal to the all ones vector) as we did not change v\overrightarrow{v} while reducing 𝒞\mathcal{C} to 𝒢\mathcal{G}. This proves that the optimal value obtainable for 𝒢\mathcal{G} is at least as much as that of the container packing problem 𝒞\mathcal{C}.

On the other hand, consider any feasible assignment of a subset of items JIJ\subseteq I to the machines in our instance 𝒢\mathcal{G}. Let JjJ_{j} be the subset of items assigned to the jthj^{\textrm{th}} machine. We can pack JjJ_{j} into container CjC_{j} in the following way: Since the assignment is feasible, the size of all items in JjJ_{j} does not exceed the capacity of MjM_{j}. If CjC_{j} is wide (resp. tall), iJjh(i)h(Cj)\sum_{i\in J_{j}}h(i)\leq h(C_{j}) (resp. iJjw(i)w(Cj)\sum_{i\in J_{j}}w(i)\leq w(C_{j})). Hence, all the items in JjJ_{j} can be stacked up (resp. arranged side by side) inside the container CjC_{j}. If CjC_{j} is an area container, then JjJ_{j} consists of only small items which are ε\varepsilon^{\prime}-small for CjC_{j} and a(Jj)(1ε)2a(Cj)a(J_{j})\leq(1-\varepsilon^{\prime})^{2}\cdot a(C_{j}). Hence, by Lemma 15, we can pack the set JjJ_{j} into CjC_{j} using NFDH. If an item is assigned to a large container, then it occupies the whole capacity (since item size and machine capacity are both equal to 1) and hence, only a single item can be packed in a large container.

The above arguments prove that the container packing problem is a special instance of the Vector-Max-GAP problem. Hence, we can use the PTAS for the Vector-Max-GAP problem from Section 2 to obtain a PTAS for the container packing problem.

The reduction in the case when rotations are allowed is exactly the same except for the values of sj(i)s_{j}(i) in the reduction of Container Packing Problem to an instance of the Vector-Max-GAP problem: If CjC_{j} is a tall (resp. wide) container,

sj(i)\displaystyle s_{j}(i) ={if i can fit neither with rotation nor without rotationw(i)(resp.h(i))if i fits without rotation but not with rotationh(i)(resp.w(i))if i fits with rotation but not without rotationmin{w(i),h(i)}if i fits both with and without rotation\displaystyle=\begin{cases}\infty&\textup{if $i$ can fit neither with rotation nor without rotation}\\ w(i)\>(\mathrm{resp.}\>h(i))&\textup{if $i$ fits without rotation but not with rotation}\\ h(i)\>(\mathrm{resp.}\>w(i))&\textup{if $i$ fits with rotation but not without rotation}\\ \min\{w(i),\>h(i)\}&\textup{if $i$ fits both with and without rotation}\\ \end{cases}

If CjC_{j} is a large container, we set sj(i)=s_{j}(i)=\infty if ii does not fit in CjC_{j} with or without rotations. Otherwise we set sj(i)s_{j}(i) to 1. In case of CjC_{j} being an area container, sj(i)s_{j}(i) is same as the case without rotations. The correctness of the reduction follows by similar arguments as above.

Theorem 13.

There exists a PTAS for the container packing problem with or without rotations.

3.5 Algorithm

Our main goal is to search for the container packing structure in Theorem 4.

For this we need to guess the set of containers used to pack the items in IoptI^{\prime}_{\operatorname*{opt}} of (1). As mentioned in Section 3.2, the number of containers used is at most a constant (let this number be denoted by cc) and they have to be picked from a set whose cardinality is in poly(|I|)\operatorname{poly}(\left\lvert I\right\rvert) (let this cardinality be denoted by q(|I|)q(\left\lvert I\right\rvert)). Therefore, the number of guesses required is (q(|I|)+cc)\binom{q(\left\lvert I\right\rvert)+c}{c} which is in turn in poly(|I|)\operatorname{poly}(\left\lvert I\right\rvert).

Once we have the containers, we need to guess which of them are large containers, wide containers, tall containers and area containers. The number of guesses required is at most (c+4c)\binom{c+4}{c} which is a constant.

Then we use the PTAS of the container packing problem with approximation factor (1εcont)(1-\varepsilon_{\mathrm{cont}}), and since the optimal profit of the container packing problem is at least (1/2εstruct)OPTGVKS(I)(1/2-\varepsilon_{\mathrm{struct}})\cdot\operatorname{OPT}_{\mathrm{GVKS}}(I), by choosing εcont:=ε\varepsilon_{\mathrm{cont}}:=\varepsilon and εstruct:=ε/2\varepsilon_{\mathrm{struct}}:=\varepsilon/2, we get the desired approximation factor of (1/2ε)(1/2-\varepsilon) for the (2, dd) knapsack problem.

4 Conclusion

We study the (2,d)(2,d) Knapsack problem and design a (2+ε)(2+\varepsilon) approximation algorithm using corridor decomposition and the PTAS for Vector-Max-GAP problem, which could be of independent interest. We believe that the approximation ratio might be improved to 1.891.89, however, it will require involved applications of complicated techniques like LL-packings as described in [9]. One might also be interested in studying a further generalization of the problem, the (dG,dV)(d_{G},d_{V}) Knapsack where items are dGd_{G} dimensional hyper-rectangles with weights in dVd_{V} dimensions. One major application of our result will be in designing approximation algorithms for (2,d)(2,d) Bin Packing problem, a problem of high practical relevance. In [19], we use the presented approximation algorithm for (2,d)(2,d) Knapsack as a subroutine to obtain an approximation algorithm for the (2,d)(2,d) Bin Packing problem.

References

  • [1] Anna Adamaszek and Andreas Wiese. A quasi-PTAS for the two-dimensional geometric knapsack problem. In SODA, pages 1491–1505, 2015.
  • [2] Nikhil Bansal, Alberto Caprara, Klaus Jansen, Lars Prädel, and Maxim Sviridenko. A structural lemma in 2-dimensional packing, and its implications on approximability. In ISAAC, pages 77–86, 2009.
  • [3] Nikhil Bansal, Marek Eliás, and Arindam Khan. Improved approximation for vector bin packing. In SODA, pages 1561–1579, 2016.
  • [4] Nikhil Bansal and Arindam Khan. Improved approximation algorithm for two-dimensional bin packing. In SODA, pages 13–25, 2014.
  • [5] Henrik I. Christensen, Arindam Khan, Sebastian Pokutta, and Prasad Tetali. Approximation and online algorithms for multidimensional bin packing: A survey. Computer Science Review, 24:63–79, 2017.
  • [6] Edward G. Coffman, Jr, 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.
  • [7] A. M. Frieze and M. R. B. Clarke. Approximation algorithms for the mm-dimensional 010-1 knapsack problem: worst-case and probabilistic analyses. EJOR, 15:100–109, 1984.
  • [8] Waldo Gálvez, Fabrizio Grandoni, Afrouz Jabal Ameli, Klaus Jansen, Arindam Khan, and Malin Rau. A tight (3/2+ε\varepsilon) approximation for skewed strip packing. In APPROX/RANDOM, volume 176, pages 44:1–44:18, 2020.
  • [9] Waldo Gálvez, Fabrizio Grandoni, Sandy Heydrich, Salvatore Ingala, Arindam Khan, and Andreas Wiese. Approximating geometric knapsack via l-packings. In FOCS, pages 260–271, 2017.
  • [10] Waldo Gálvez, Fabrizio Grandoni, Salvatore Ingala, and Arindam Khan. Improved pseudo-polynomial-time approximation for strip packing. In FSTTCS, pages 9:1–9:14, 2016.
  • [11] Waldo Galvez, Fabrizio Grandoni, Arindam Khan, Diego Ramirez-Romero, and Andreas Wiese. Improved approximation algorithms for 2-dimensional knapsack: Packing into multiple l-shapes, spirals, and more. In Symposium on Computational Geometry (SoCG), page To appear, 2021.
  • [12] Fabrizio Grandoni, Stefan Kratsch, and Andreas Wiese. Parameterized Approximation Schemes for Independent Set of Rectangles and Geometric Knapsack. In ESA, volume 144, pages 53:1–53:16, 2019.
  • [13] Sandy Heydrich and Andreas Wiese. Faster approximation schemes for the two-dimensional knapsack problem. In SODA, pages 79–98, 2017.
  • [14] Oscar H. Ibarra and Chul E. Kim. Fast approximation algorithms for the knapsack and sum of subset problems. J. ACM, 22(4):463–468, October 1975.
  • [15] Hans Kellerer, Ulrich Pferschy, and David Pisinger. Knapsack problems. Springer, 2004.
  • [16] Arindam Khan. Approximation algorithms for multidimensional bin packing. PhD thesis, Georgia Institute of Technology, Atlanta, GA, USA, 2016.
  • [17] Arindam Khan, Arnab Maiti, Amatya Sharma, and Andreas Wiese. On guillotine separable packings for the two-dimensional geometric knapsack problem. In Symposium on Computational Geometry (SoCG), page To appear, 2021.
  • [18] Arindam Khan and Madhusudhan Reddy Pittu. On guillotine separability of squares and rectangles. In APPROX/RANDOM, volume 176, pages 47:1–47:22, 2020.
  • [19] Arindam Khan, Eklavya Sharma, and K. V. N. Sreenivas. Geometry meets vectors: Approximation algorithms for multidimensional packing. In Manuscript, 2021.
  • [20] Ariel Kulik and Hadas Shachnai. There is no eptas for two-dimensional knapsack. Information Processing Letters, 110(16):707–710, 2010.
  • [21] Eugene L. Lawler. Fast approximation algorithms for knapsack problems. In FOCS, pages 206–213, 1977.
  • [22] Tobias Mömke and Andreas Wiese. Breaking the barrier of 2 for the storage allocation problem. In ICALP, volume 168 of LIPIcs, pages 86:1–86:19, 2020.

Appendix A Appendix

A.1 Next Fit Decreasing Heights (NFDH)

NFDH, introduced in [6], is a widely used algorithm to pack rectangles in a bigger rectangular bin. It works as follows. First, we order the rectangles in the decreasing order of their heights. We then place the rectangles greedily on the base of the bin until we do not cross the boundaries of the bin. At this point, we “close” the shelf and shift the base to top edge of the first rectangle and continue the process. For an illustration of the algorithm, see Fig. 3.

Figure 3: The NFDH Algorithm. After packing the first two items on the base of the bin, the third item can’t be packed on the same level. Hence, we close the shelf and create a new shelf.

Now, we state a well-known and important lemma about NFDH.

Lemma 14.

[2]. Let SS be a set of rectangles and let ww and hh denote the largest width and largest height in SS, respectively. Consider a bin of dimensions W×HW\times H. If a(S)(Ww)(Hh)a(S)\leq(W-w)(H-h), then NFDH packs all the rectangles into the bin.

The above lemma suggests that NFDH works very well if all the rectangles are small compared to the biun dimensions. The following lemma will be crucial for our purposes.

Lemma 15.

Consider a set of rectangles SS with associated profits and a bin of dimensions W×HW\times H and assume that that each item in SS has width at most εW\varepsilon W and height at most εH\varepsilon H. Suppose opt\operatorname*{opt} denotes the optimal profit that can be packed in the bin. Then there exists a polynomial time algorithm that packs at least (12ε)opt(1-2\varepsilon)\operatorname*{opt} profit into the bin.

Proof.

Let us first order the rectangles in the decreasing order of their profit/area ratio. Then pick the largest prefix of rectangles TT such that a(T)(1ε)2WHa(T)\leq(1-\varepsilon)^{2}WH. By the above lemma, NFDH must be able to pack all the items in TT into the bin. On the other hand, since each rectangle has area at most ε2WH\varepsilon^{2}WH, it follows that a(T)(12ε)WHa(T)\geq(1-2\varepsilon)WH. Furthermore, since TT contains the highest profit density items, it follows that p(T)(12ε)optp(T)\geq(1-2\varepsilon)\operatorname*{opt}. ∎