Approximation Algorithms for Rectangle Packing Problems (PhD Thesis)

by   Salvatore Ingala, et al.

In rectangle packing problems we are given the task of placing axis-aligned rectangles in a given plane region, so that they do not overlap with each other. In Maximum Weight Independent Set of Rectangles (MWISR), their position is given and we can only select which rectangles to choose, while trying to maximize their total weight. In Strip Packing (SP), we have to pack all the given rectangles in a rectangular region of fixed width, while minimizing its height. In 2-Dimensional Geometric Knapsack (2DGK), the target region is a square of a given size, and our goal is to select and pack a subset of the given rectangles of maximum weight. We study a generalization of MWISR and use it to improve the approximation for a resource allocation problem called bagUFP. We revisit some classical results on SP and 2DGK, by proposing a framework based on smaller containers that are packed with simpler rules; while variations of this scheme are indeed a standard technique in this area, we abstract away some of the problem-specific differences, obtaining simpler algorithms that work for different problems. We obtain improved approximations for SP in pseudo-polynomial time, and for a variant of 2DGK where one can to rotate the rectangles by 90. For the latter, we propose the first algorithms with approximation factor better than 2. For the main variant of 2DGK (without rotations), a container-based approach seems to face a natural barrier of 2 in the approximation factor. Thus, we consider a generalized kind of packing that combines container packings with another packing problem that we call L-packing problem, where we have to pack rectangles in an L-shaped region of the plane. By finding a (1 + ϵ)-approximation for this problem and exploiting the combinatorial structure of 2DGK, we obtain the first algorithms that break the barrier of 2 for the approximation factor of this problem.


page 19

page 22

page 25


Improved Pseudo-Polynomial-Time Approximation for Strip Packing

We study the strip packing problem, a classical packing problem which ge...

Geometry Meets Vectors: Approximation Algorithms for Multidimensional Packing

We study the generalized multidimensional bin packing problem (GVBP) tha...

A PTAS for Packing Hypercubes into a Knapsack

We study the d-dimensional hypercube knapsack problem where we are given...

Approximating Geometric Knapsack via L-packings

We study the two-dimensional geometric knapsack problem (2DK) in which w...

Approximation Algorithms for ROUND-UFP and ROUND-SAP

We study ROUND-UFP and ROUND-SAP, two generalizations of the classical B...

Closing the gap for pseudo-polynomial strip packing

We study pseudo-polynomial Strip Packing. Given a set of rectangular axi...

Applying Gene Expression Programming for Solving One-Dimensional Bin-Packing Problems

This work aims to study and explore the use of Gene Expression Programmi...

1.1 Approximation algorithms

In this section, we introduce some fundamental definitions and concepts in the field of approximation algorithms.

Informally, an NP-Optimization problem is either a minimization or a maximization problem. defines a set of valid instances, and for each instance , a non-empty set of feasible solutions. Moreover an objective function value is defined that, for each feasible solution , returns a non-negative real number, which is generally intended as a measure of the quality of the solution. The goal is either to maximize or minimize the objective function value, and we call a maximization problem or a minimization problem, accordingly. A solution that maximizes (respectively minimizes) the objective function value is called optimal solution; for the problems that we are interested in, finding an optimal solution is NP-hard. For simplicity, from now on we simply talk about optimization problems. We refer the reader, for example, to v01 for a formal definition of NP-optimization problems.

Definition 1.

A polynomial-time algorithm for an optimization problem is an -approximation algorithm if it returns a feasible solution whose value is at most a factor away from the value of the optimal solution, for any input instance.

In this work, we follow the convention that , both for minimization and maximization problems.

Thus, with our convention, if is the objective function value of the optimal solution, an algorithm is an -approximation if it always returns a solution whose value is at most for a minimization problem, or at least for a maximization problem.111For the case of maximization problems, another convention which is common in literature is to enforce , and say that an algorithm is an -approximation if the returned solution has value at least .

Note that could, in general, be a growing function of the input size, and not necessarily a constant number.

For some problems, it is possible to find approximate solutions that are arbitrarily close to the optimal solution. More formally:

Definition 2.

We say that an algorithm is a polynomial time approximation scheme (PTAS) for an optimization problem if for every fixed and for any instance , the running time of is polynomial in the input size , and it returns a solution whose value is at most a factor away from the value of the optimal solution.

Definitions 1 and 2 can be generalized in the obvious way to allow for non-deterministic algorithms. In particular, we call an algorithm an expected -approximation if the expected value of the output solution satisfies the above constraints.

Observe that the running time is polynomial for a fixed , but the dependency on can be arbitrarily large; in fact, running times of the form for some functions and that are super-polynomial with respect to are indeed very common. If the function is a constant not depending on , the algorithm is called Efficient PTAS (EPTAS); if, moreover, is polynomial in , then it is called a Fully Polynomial Time Approximation Scheme (FPTAS). In some sense, -hard problems admitting an FPTAS can be thought as the easiest hard problems; one such example is the Knapsack Problem.

It is also interesting to consider a relaxation of Definition 2 that allows for a slightly larger running time: a Quasi-Polynomial Time Approximation Scheme (QPTAS) is define exactly as above, except that is allowed quasi-polynomial time 222The notation means that the implicit constant hidden by the big O notation can depend on .

The class of problems that admit a constant factor approximation is called APX. Clearly, all problems that admit a PTAS are in APX, but the converse is not true if .

For some problems, better approximation ratios can be found if one assumes that the solution is large enough. Formally, for a minimization problem , the asymptotic approximation ratio of an algorithm is defined as:

where and are, respectively, the objective function value of the solution returned by on the instance , and that of an optimal solution to .

Similarly to the definition of PTAS, we say that an algorithm is an Asymptotic PTAS or APTAS for problem if is an asymptotic -approximation for any fixed .

1.2 Lower bounds

An approximation algorithm, by definition, proves that a certain approximation factor is possible for a problem; thus, it provides an upper bound on the best possible approximation factor.

Starting with the seminal work of sg76, a significant amount of research has been devoted to a dual kind of result, that is, proofs that certain approximation ratios are not possible (under the assumption that or analogous assumptions). These results provide a lower bound on the approximation factor.

Some problems are known to be APX-hard. If a problem is APX-hard, then the existence of a PTAS for it would imply the existence of a PTAS for every problem in APX. Thus, being APX-hard is considered a strong evidence that the problem does not admit a PTAS.

For many problems, lower bounds are known that rely only on the assumption that . For example, the Bin Packing problem can easily be showed to be impossible to approximate to a factor for any constant , which follows from the NP-hardness of the Partition problem.

Starting from the late 1990s, many other inapproximability results were proven as consequences of the celebrated PCP theorem and its more powerful versions; for example, ds05 proved that it is not possible to obtain a -approximation for Vertex Cover, unless .

Stronger results can often be provided by making stronger assumptions; for example, many hardness results have been proven under the assumption that , or the stronger (that is, NP-hard problems cannot be solved in quasi-polynomial time); more recently, hardness results have been proved under the Exponential Time Hypothesis (ETH), that is, the assumption that SAT cannot be solved in sub-exponential time. Another strong hardness assumption is the Unique Games Conjecture (UGC), proposed by k02. Clearly, stronger assumptions might lead to stronger results, but they are also considered less likely to be true; hence, there is a strong push for results that are as strong as possible, while relying on the weakest possible assumption (ideally, ).

Table 1.1 presents some classical problems together with the best known upper and lower bounds.

Problem Upper bound Lower bound
Knapsack FPTAS Weakly NP-hard
Vertex Cover if
under UGC
Set Cover if
Independent Set if 333ZPP is the class of problems admitting randomized algorithms in expected polynomial time.
Table 1.1: Examples of known upper and lower bounds. The notation hides poly-logarithmic factors.

The existence of a QPTAS for a problem is sometimes seen as a hint that a PTAS might exist: in fact, it implies that the problem is not APX-hard unless .

1.3 Pseudo-polynomial time

One of the ways to cope with NP-hard problems is to allow running times that are not strictly polynomial. For problems that have numeric values in the input (that we consider to be integers for the sake of simplicity), one can consider pseudo-polynomial time algorithms, whose running time is polynomial in the values of the input instance, instead of their size. More formally:

Definition 3.

An algorithm is said to run in pseudo-polynomial time (PPT) if its running time is bounded by , where is the maximum absolute value of the integers in the instance, and is the size of the instance.

Equivalently, an algorithm runs in PPT if it runs in polynomial time in the size of the input when all the number in the input instance are represented in unary notation.

Clearly, this is a relaxation of the polynomial time requirement; thus, a problem might become significantly easier if PPT is allowed. For example, the knapsack problem is NP-hard, but a classical Dynamic Programming approach can solve it exactly in PPT.

A problem that is NP-hard but can be solved in PPT is called weakly NP-hard. A problem that does not admit an exact PPT algorithm unless is called strongly NP-hard.

Studying PPT algorithms is interesting also in the context of approximation algorithms, and it has recently been a more frequent trend in the research community. Note that the standard hardness result do not always apply. Some problem, nonetheless, are hard to solve even in this relaxed model; one such problem is the Strip Packing problem, which we introduce in the next section and will be discussed in detail in Chapter 3.

1.4 Rectangle packing problems

In this section we introduce several geometric packing problems involving rectangles. In all of them, we are given as input a set of rectangles, and we are assigned the task of placing all or a subset of them into one or more target regions, while making sure that they are completely contained in the assigned region and they do not overlap with each other.

Given a set of rectangles and a rectangular box of size , we call a packing of a pair for each , with and , meaning that the left-bottom corner of is placed in position and its right-top corner in position . This packing is feasible if the interior of the rectangles is disjoint in this embedding (or equivalently rectangles are allowed to overlap on their boundary only). More formally, the packing is feasible if for every two distinct rectangles , we have that or .

Note that the above definition only admits orthogonal packings, that is, every rectangle is always axis-parallel in the packing, as in Figure 1.0(a). It has been long known that orthogonal packings are not necessarily optimal, even in very restricted cases like in packing equal squares into bigger squares; see Figure 1.0(b) for an example. Nevertheless, orthogonal packings are much simpler to handle mathematically, and the additional constraint is meaningful in many possible applications of the corresponding packing problems, and it is the focus of most of the literature on such optimization problems.

There is only one case of rectangle rotations that is compatible with orthogonal packings: rotations. In fact, for the packing problems that we consider, there are two variations: one where rotations are not allowed, as in the definition of packing given above; and one where rotations are allowed, that is, one is allowed to swap width and height of a rectangle in the packing.

(a) Example of an orthogonal packing. All the packed rectangles are axis-parallel and non-overlapping.
(b) A non-orthogonal packing. With an orthogonal packing, only of the rectangles can be placed instead.
Figure 1.1: Orthogonal and non-orthogonal packings.

There is another interesting variant of these packing problem, where we are interested in packings that can be separated via the so called guillotine cuts, that is, edge-to-edge cuts parallel to an edge of the box. See Figure 1.2 for a comparison between a packing with guillotine cuts and a generic packing. Such constraints are common in scenarios where the packed rectangles are patches of a material that must be cut, where the availability of a guillotine cutting sequence simplify the cutting procedure, thereby reducing costs; see for example prk04 and s88.

Figure 1.2: A guillotine packing on the left, and packing that cannot be a guillotine packing on the right.

1.4.1 Strip Packing

In the Strip Packing problem, we are given a parameter and a set of rectangles, each one characterized by a positive integer width , , and a positive integer height . Our goal is to find a value and a feasible packing of all the rectangles in in a rectangle of size , while minimizing .

The version with rotations is also considered.

Figure 1.3: An instance of Strip Packing and corresponding feasible packings for the cases without (left) and with rotations (right).

Strip packing is a natural generalization of one-dimensional bin packing (obtained when all the rectangles have the same height; see cecgmv13) and makespan minimization (obtained when all the rectangles have the same width; see cb76). The problem has lots of applications in industrial engineering and computer science, specially in cutting stock, logistics and scheduling (kr00; hjpv14). Recently, there have been several applications of strip packing in electricity allocation and peak demand reductions in smart-grids; see for example thlw13, kskl13 and rks15.

A simple reduction from the Partition problem shows that the problem cannot be approximated within a factor for any in polynomial-time unless . This reduction relies on exponentially large (in ) rectangle widths, and it also applies for the case with rotations.

Let denote the optimal height for the considered strip packing instance , and (respectively, ) be the largest height (respectively, width) of any rectangle in . Most of the literature on this problem is devoted to the case without rotations. Observe that, for this case, , and we can assume that without loss of generality. The first non-trivial approximation algorithm for strip packing, with approximation ratio 3, was given by bcr80. The First-Fit-Decreasing-Height algorithm (FFDH) by cgjt80 gives a 2.7-approximation. s80 gave an algorithm that generates a packing of height , hence achieving a 2.5-approximation. Afterwards, s97 and s94 independently improved the approximation ratio to 2. hv09 first broke the barrier of 2 with their 1.9396 approximation. The present best -approximation is due to hjpv14.

nw16 overcame the -inapproximability barrier by presenting a -approximation algorithm running in pseudo-polynomial-time (PPT). More specifically, they provided an algorithm with running time , where 444For the case without rotations, the polynomial dependence on can indeed be removed with standard techniques.. In ggik16, we improved the approximation factor to , also generalizing it to the case with rotations; this result is described in Chapter 3. For the case without rotations, an analogous result was independently obtained by jr17.

As strip packing is strongly NP-hard (see gj78), it does not admit an exact pseudo-polynomial-time algorithm. Moreover, very recently akpp17 proved that it is -hard to approximate Strip Packing within a factor for any constant in PPT, and this lower bound was further improved to in hjrs17. This rules out the possibility of a PPT approximation scheme.

The problem has been also studied in terms of asymptotic approximation, where the approximability is much better understood. For the case without rotations, cgjt80 analyzed two algorithms called Next Fit Decreasing Height (NFDH) and First Fit Decreasing Height (FFDH), and proved that their asymptotic approximation ratios are 2 and 1.7, respectively. bcr80 described another heuristic called Bottom Leftmost Decreasing Width (BLWD), and proved that it is an asymptotic 2-approximation. Then kr00 provided an AFPTAS, that is, an asymptotic -approximation for any . The additive constant of was improved by js09, who achieved an AFPTAS with additive constant only . s12 obtained a polynomial time algorithm that returns a solution with height at most .

The analysis for the asymptotic 2-approximations (for example by NFDH) also apply to the case with rotations. mw04 improved this to a 1.613-approximation, and then ev04a proved a 1.5-approximation. Finally, jv05 obtained an AFPTAS also for this variation of the problem.

The natural generalization of Strip Packing in 3 dimensions has been considered for the first time by lc90, who obtained an asymptotic -approximation. In lc92, they further improved it to an asymptotic ratio , where is the so called harmonic constant in the context of bin packing. bhisz07 provided an asymptotic -approximation. More recently, jp14 obtained the currently best known asymptotic -approximation. In terms of absolute approximation, the above mentioned result of lc90 also implies a -approximation, which was improved to in dhjtt08.

1.4.2 2-Dimensional Geometric Knapsack

2-Dimensional Geometric Knapsack (2DGK) is a geometric generalization of the well studied one-dimensional knapsack problem. We are given a set of rectangles , where each is an axis-parallel rectangle with an integer width , height and profit , and a knapsack that we assume to be a square of size for some integer .

A feasible solution is any axis-aligned packing of a subset into the knapsack, and the goal is to maximize the profit .

Like for Strip Packing, the variant with rotations of the problem is also considered, where one is allowed to rotate the rectangles by .

Figure 1.4: An instance of 2-Dimensional Geometric Knapsack, and corresponding feasible packing without (left) and with rotations (right); for simplicity, rectangle profits are not represented. Note that, unlike Strip Packing, it is not required that all the rectangles are packed.

The problem is motivated by several practical applications. For instance, one might want to place advertisements on a board or a website, or cut rectangular pieces from a sheet of some material (in this context, the variant with rotations is useful when the material does not have a texture, or the texture itself is rotation invariant). It can also model a scheduling setting where each rectangle corresponds to a job that needs some “contiguous amount” of a given resource (memory storage, frequencies, etc.). In all these cases, dealing only with rectangular shapes is a reasonable simplification.

cm04 gave the first non-trivial approximation for the problem, obtaining ratio ; this result builds on the -approximation for Strip Packing in s97. jz07 obtained an algorithm with approximation factor , which is currently the best known in polynomial time; in jz04 they also gave a simpler and faster -approximation for the special case in which all the rectangles have profit (cardinality case).

On the other hand, the only known hardness was given in ltwyc90, who proved that an FPTAS is impossible even in the special case of packing squares into a square. Note that this does not rule out a PTAS.

Better results are known for many special cases. If all the rectangles are squares, h06 obtained a -approximation, and js08 showed that a PTAS is possible; very recently, hw17 obtained an EPTAS. fgjs08 gave a PTAS for rectangles in the relaxed model with resource augmentation, that is, where one is allowed to enlarge the width and the height of the knapsack by a factor. js09 showed that the same can be achieved even if only the width (or only the height) is augmented; we prove a slightly modified version of this result in Lemma 14 in Section 2.5. bcjps09 proved that a PTAS is possible for the special case in which the profit of each rectangle equals its area, that is, , for both the cases with or without rotations. fgj05 presented a PTAS for the special case where the height of all the rectangles is much smaller than the height of the knapsack.

By using a structural result for independent set of rectangles, aw15 gave a QPTAS for the case without rotations, with the assumption that widths and heights are quasi-polynomially bounded. acckpsw15 extended the technique to obtain a similar QPTAS for the version with guillotine cuts (with the same assumption on rectangle sizes).

In Chapter 4 we show how to obtain a polynomial-time algorithm with approximation factor for the case without rotations, which we further improve to for the cardinality case. This is the first polynomial time algorithm that breaks the barrier of for this problem.

In Chapter 5 we consider the case with rotations, and obtain a -approximation for the general case, and a -approximation for the cardinality case.

The results in Chapters 4 and 5 are published in gghikw17.

1.4.3 Related packing problems

Maximum Weight Independent Set of Rectangles (MWISR)

is the restriction of the well known Independent Set problem to the intersection graphs of 2D rectangles. We are given a set of axis-aligned rectangles as above, but this time the coordinates of the bottom-left corner of each rectangle are given as part of the input. The goal is to select a subset of rectangles of pairwise non-overlapping rectangles, while maximizing the total profit of the selected rectangles.

Figure 1.5: An instance of the Independent Set of Rectangles problem. Since the red rectangles are pairwise non-overlapping, they are a feasible solution to the problem.

While the Independent Set problem on general graphs is hard to approximate to for any fixed , much better results are known for MWISR.

The best known approximation for general rectangles was given by ch12 and has ratio , slightly improving several previous -approximations (avs98; bdmr01; c04). More recently, a breakthrough by aw13 showed that a QPTAS is possible. Since only NP-hardness is known as a lower bound, this could suggest that a PTAS is possible for this problem, despite even a constant factor approximation is still not known.

Better results are known for many special cases of the problem. For the unweighted case, cc09 obtained a -approximation. A PTAS is known for the special case when all the rectangles are squares (ejs01). acw15 gave a PTAS for the relaxation of the problem when rectangles are allowed to be slightly shrunk (more precisely, each rectangle is rescaled by a factor for an arbitrarily small ).

In Chapter 6, we consider a generalization of MWISR where the input rectangles are partitioned into disjoint classes (bags), and only one rectangle per class is allowed in a feasible solution.

Storage Allocation Problem (SAP)

is a problem that arises in the context of resource allocation, but it still has a geometric nature. This problem is similar to 2DGK, with two important modifications:

  • the horizontal position of each rectangle is fixed and given as part of the input (that is, the rectangle is only allowed to be moved vertically);

  • the target region where each selected rectangle must be packed is the set of points in the positive quadrant that are below a given positive capacity curve .

See Figure 1.6 for an example. This problems models the allocation of a resource that has a contiguous range and that varies over time, like bandwidth or disk allocation. Each rectangle represents a request to use the resource, starting at some specified time (the starting -coordinate of the rectangle) and for a duration equal to the width of the rectangle. The height of the rectangle represents the amount of the resource that is requested.

Figure 1.6: An instance and a feasible solution of the Storage Allocation Problem; two rectangles are not packed. Selected rectangles can only be moved vertically.

bbr13 gave the first constant factor approximation for this problem, with ratio ; the best known result, with approximation factor , is due to mw15.

See Chapter 6 for more related scheduling problems.

-Dimensional Geometric Bin Packing

is another important geometric packing problem, generalizing the well studied bin packing problem, which is its -dimensional counterpart. Here, we are given an instance as in 2DGK, but we want to pack all the given rectangles in square knapsacks of size ; our goal is to minimize the number of knapsacks used. As for the other problems, both the variants with or without rotations are considered.

There is an extensive literature regarding asymptotic approximation algorithms. The first results were obtained by cgj82, who provided a -approximation. The approximation ratio was improved to in kr00, and then further reduced to by c02, where is the so-called harmonic constant. bcs09 improved the approximation ratio to , using a general framework known as Round-and-Approx. Then, jp13 obtained a -approximation, which was improved to by bk14 with the Round-and-Approx framework. bcks06 proved that an asymptotic PTAS is impossible, unless ; cc06 extended this result to the case with rotations, and also proved explicit lower bounds, showing that it is impossible to approximate -Dimensional Geometric Bin Packing with an asymptotic ratio smaller than for the version without rotations, and smaller than , for the versions with rotations.

For the special case of squares, fmw98 obtained a -approximation, which was improved to a -approximation by kmrw04 and sv02. An algorithm analyzed by c02 is shown to have an approximation ratio between and , although the proof conditionally depends on a certain conjecture. ev04b obtained a -approximation. bcks06 proved that an APTAS is possible for squares (and, more generally, for the -dimensional generalization of the problem). They gave an exact algorithm for the relaxation of the problem on rectangles with resource augmentation, that is, where the bins are augmented by a factor . Moreover, they provided a PTAS on the related problem of placing a set of rectangles in a minimum-area enclosing rectangle.

Fewer results ar known regarding absolute approximations. As shown by ltwyc90, even if the problem is restricted to squares, it is -hard to distinguish if or bins are needed. z05 obtained a -approximation for the case without rotations, and v04 showed that a -approximation is possible for the case of squares. Then, hv12 showed that a -approximation is possible for general rectangles if rotations are allowed. Note that, due to the -hardness mentioned above, an absolute ratio of is the best possible for any of these problems.

bls05 proved the surprising result that an asymptotic PTAS is possible for the version of the problem with guillotine cuts.

Many results are also known in the online version of the above problems; we omit them here. A recent review of these and other related problems can be found in ckpt17.

1.5 Summary of our results and outline of this thesis

In Chapter 2, we review some preliminary results and develop some useful tools for rectangle packing problems.

Many results in this area of research are obtained by showing that a profitable solution exists that presents a special, simplified structure: namely, the target area where the rectangles are packed is partitioned into a constant number of rectangular regions, whose sizes are chosen from a polynomial set of possibilities. Thus, such simplified structures can be guessed555As it is common in the literature, by guessing we mean trying out all possibilities. In order to lighten the notation, it is often easier to think that we can guess a quantity and thus assume that it is known to the algorithm; it is straightforward to remove all such guessing steps and replace them with an enumeration over all possible choices. efficiently, and then used to guide the subsequent rectangle selection and packing procedure.

Following the same general approach, we will define one such special structure that we call container packings, which we define in Section 2.4. Then, in Sections 2.3 and 2.4.1

we show that there is a relatively simple PTAS for container packings based on Dynamic Programming. Notably, this PTAS does not require the solution of any linear program and is purely combinatorial, and it is straightforward to adapt it to the case with


Container packings are a valuable black box tool for rectangle packing problems, generalizing several other such simplified structures used in literature. In Section 2.5 we reprove a known result on 2DGK with Resource Augmentation in terms of container packings. We use this modified version in several of our results.

In Chapter 3, we present our new -approximation for Strip Packing in pseudo-polynomial time. The results of this chapter are based on ggik16, published at the 36th IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science, December 13–15 2016, Chennai, India. This result improves on the previously best known -approximation by nw16 with a novel repacking lemma which is described in Section 3.2. Moreover by using container packings, we obtain a purely combinatorial algorithm (that is, no linear program needs to be solved), and we can easily adapt the algorithm to the case with rotations.

Chapters 4 and 5 present our results on 2DGK and 2DGKR from gghikw17, published at the 58th Annual IEEE Symposium on Foundations of Computer Science, October 15–17 2017, Berkeley, California.

In Chapter 4, we present the first polynomial time approximation algorithm that breaks the barrier of for the 2DGK problem (without rotations). Although we still use container packings, a key factor in this result is a PTAS for another special packing problem that we call L-packing, which does not seem to be possible to solve with a purely container-based approach. Combining this PTAS with container packing will yield our main result, which is an algorithm with approximation ratio . For the unweighted case, we can further refine the approximation ratio to by means of a quite involved case analysis.

In Chapter 5, we focus on 2DGKR, and we show a relatively simple polynomial time -approximation for the general case; for the unweighted case, we improve it to in Section 5.2. In this case, we do not need L-packings, and we again use a purely container-based approach.

In Chapter 6, we study a generalization of the MWISR problem that we call bagMWISR, and we use it to obtain improved approximation for a scheduling problem called bagUFP. A preliminary version of these results was contained in giu15, published in the 13th Workshop on Approximation and Online Algorithms, September 14–18 2015, Patras, Greece. In Section 6.3 we show that we can generalize the -approximation for MWISR by ch12, which is based on the randomized rounding with alterations framework, to the more general bagMWISR problem, obtaining in turn an improved approximation ratio for bagUFP. Then, in Section 6.4, we turn our attention to the unweighted case of bagUFP, and we show that the special instances of bagMWISR that are generated by the reduction from bagUFP have a special structure that can be used to obtain a -approximation. This result builds on the work of aglw14.

2.1 Next Fit Decreasing Height

One of the most recurring tools used as a subroutine in countless results on geometric packing problems is the Next Fit Decreasing Height (NFDH) algorithm, which was originally analyzed in cgjt80 in the context of Strip Packing. We will use a variant of this algorithm to pack rectangles inside a box.

Suppose you are given a box of size , and a set of rectangles each one fitting in the box (without rotations). NFDH computes in polynomial time a packing (without rotations) of as follows. It sorts the rectangles in non-increasing order of height , and considers rectangles in that order . Then the algorithm works in rounds . At the beginning of round it is given an index and a horizontal segment going from the left to the right side of . Initially and is the bottom side of . In round the algorithm packs a maximal set of rectangles , with bottom side touching one next to the other from left to right (a shelf). The segment is the horizontal segment containing the top side of and ranging from the left to the right side of . The process halts at round when either all the rectangles have being packed or does not fit above . See Figure 2.1 for an example of packing produced by this algorithm.

Figure 2.1: A packing obtained using the classical Next Fit Decreasing Height algorithm.

We prove the following known result:

Lemma 1.

Let be a given box of size , and let be a set of rectangles. Assume that, for some given parameter , for each one has and . Then NFDH is able to pack in a subset of total area at least . In particular, if , all the rectangles in are packed.


The claim trivially holds if all rectangles are packed. Thus suppose that this is not the case. Observe that , otherwise the rectangle would fit in the next shelf above ; hence . Observe also that the total width of the rectangles packed in each round is at least , since , of width at most , does not fit to the right of . It follows that the total area of the rectangles packed in round is at least , and thus:

We can use NFDH as an algorithm for Strip Packing, where we work on a box of fixed with and unbounded height, and we pack all elements. In this context, the following result holds:

Lemma 2 (cgjt80).

Given a strip packing instance , the NFDH algorithm gives a packing of height at most .

2.2 Steinberg’s algorithm

The following theorem gives sufficient conditions to pack a given set of rectangles in a rectangular box. We denote .

Theorem 3 (s97).

Suppose that we are given a set of rectangles and a box of size . Let and be the maximum width and maximum height among the rectangles in respectively. If

then all the rectangles in can be packed into in polynomial time.

In particular, we will use the following simpler corollary:

Corollary 4.

Suppose that we are given a set of rectangles and a box of size . Moreover, suppose that each rectangle in has width at most (resp. each rectangle in has height at most ), and . Then all the rectangles in can be packed into in polynomial time.

2.3 The Maximum Generalized Assignment Problem

In this section we show that there is a PTAS for the Maximum Generalized Assignment Problem (GAP) if the number of bins is constant.

GAP is a powerful generalization of the Knapsack problem. We are given a set of bins, where bin has capacity , and a set of items. Let us assume that if item is packed in bin , then it requires size and has profit . Our goal is to select a maximum profit subset of items, while respecting the capacity constraints on each bin.

GAP is known to be APX-hard and the best known polynomial time approximation algorithm has ratio (fgms11; fv06). In fact, for an arbitrarily small constant (which can even be a function of ) GAP remains APX-hard even on the following very restricted instances: bin capacities are identical, and for each item and bin , , and or (ck05). The complementary case, where item sizes do not vary across bins but profits do, is also APX-hard. However, when all profits and sizes are the same across all the bins (that is, and for all bins ), the problem is known as multiple knapsack problem (MKP) and it admits a PTAS.

Let be the cost of the optimal assignment. First, we show that we can solve GAP exactly in pseudopolynomial time.

Lemma 5.

There is an algorithm running in time that finds an optimal solution for the maximum generalized assignment problem, where there are bins and each of them has capacity at most .


For each and for , let denote a subset of the set of items packed into the bins such that the profit is maximized and the capacity of bin is at most . Let denote the profit of . Clearly is known for all for . Moreover, for convenience we define if for any . We can compute the value of by using a dynamic program (DP), that exploits the following recurrence:

With a similar recurrence, we can easily compute a corresponding set .
Clearly, this dynamic program can be executed in time . ∎

The following lemma shows that we can also solve GAP optimally even in polynomial time, if we are allowed a slight violation of the capacity constraints (that is, in the resource augmentation model).

Lemma 6.

There is a time algorithm for the maximum generalized assignment problem with bins, which returns a solution with profit at least if we are allowed to augment the bin capacities by a -factor for any fixed .


In order to obtain a polynomial time algorithm from Lemma 5, we want to construct a modified instance where each capacity is polynomially bounded.

For each bin , let . For item and bin , define the modified size and . Note that , so the algorithm from Lemma 5 requires time at most .

Let be the solution found for the modified instance. Now consider the optimal solution for the original instance (that is, with the original item and bin sizes) . If we show that the same assignment of items to the bins is a feasible solution (with modified bin sizes and item sizes) for the modified instance, we obtain that and that will conclude the proof.

Let be the set of items packed in bin in . Since it is feasible, we have that . Hence,

Thus is a feasible solution for the modified instance and the above algorithm will return a packing with profit at least under -resource augmentation. ∎

Now we can show how to employ this result to obtain a PTAS for GAP without violating the bin capacities. We first prove the following technical lemma.

Lemma 7.

If a set of items is packed in a bin with capacity , then there exists a set of at most items , and a set of items with such that all items in have size at most .


Let be the set of items with . If , we are done by taking and . Otherwise, define and we continue the next iteration with the remaining items. Let be the items with size greater than in . If , we are done by taking . Otherwise define and we continue with further iterations till we get a set with . Note that we need at most iterations, since the sets are disjoint. Otherwise:

which is a contradiction. Thus, consider and . One has and . On the other hand, after removing , the remaining items have size smaller than . ∎

Lemma 8.

There is an algorithm for the maximum generalized assignment problem with bins that runs in time and returns a solution that has profit at least , for any fixed .


Consider a bin that contains the set of items in the optimal solution OPT, and let and the sets given by Lemma 7. Let be the residual capacity, so that each element in the set has size in smaller than . We divide the residual space into equally sized intervals of lengths . Let be the set of items intersecting the interval . As each packed item can belong to at most two such intervals, the cheapest set among has profit at most . Thus we can remove this set and reduce the bin size by a factor of .

Now consider the packing of the bins in the optimal packing . Let be the set of items packed in bin .

The algorithm first guesses all ’s, a constant number of items, in all bins. We assign them to corresponding bins, implying a factor in the running time. Then for bin we are left with capacity . From the previous discussion, we know that there is packing of of profit in a bin with capacity . Thus we can use the algorithm for GAP with resource augmentation provided by Lemma 6 to pack the remaining items in bins where for bin we use the original capacity to be for ; note that , so the solution is feasible with the capacities . As Lemma 6 returns the optimal packing on this modified bin sizes, we obtain a total profit of at least . The running time is the same as in Lemma 6 multiplied by the factor for the initial item guessing and assignment. ∎

2.4 Container packings

In this section we define the main concept of our framework: a container.

Many of the literature results on geometric packing problems follow (implicitly or explicitly) the following approach: since the number of possible packings is too big to be enumerated, a search algorithm is performed only on a restricted family of packings that have a special structure. Thus, the theoretical analysis aims to prove that there exists such a restricted packing that has a high profit.

We follow the same general framework, by defining what we call a container packing.

By container we mean a special kind of box to which we assign a set of rectangles that satisfy some constraints, as follows (see Figure 2.2):

  • A horizontal container is a box such that any horizontal line overlaps at most one rectangle packed in it.

  • A vertical container is a box such that any vertical line overlaps at most one rectangle packed in it.

  • An -granular area container is a box, say of size , such that all the rectangles that are packed inside have width at most and height at most . We will simply talk about an area container when the value of is clear from the context.

Figure 2.2: From left to right: a box, which is a rectangular region with arbitrary rectangles packed inside; a vertical container, which is a box where rectangles are piled from left to right; an area container, where width and height of the rectangles inside is much smaller than the width and height of the container, making it easy to pack them by NFDH.

A packing such that all the packed rectangles are contained in a container and all the area containers are -granular is called and -granular container packing; again, we will simply call it a container packing when the choice of is clear from the context.

Observe that for a horizontal or a vertical container, once a set of rectangles that can feasibly be packed is assigned, constructing a packing is trivial. Moreover, the next lemma shows that it is easy to pack almost all the rectangles assigned to an area container:

Lemma 9.

Suppose that a set of rectangles is assigned to an -granular area container , and . Then it is possible to pack in a subset of of profit at least .


If , then NFDH can pack all the rectangles by Lemma 1. Suppose that . Consider the elements of by non-increasing order of profit over area ratio. Let be the maximal subset of rectangles of in the specified order such that . Since for each , then , and then , which implies by the choice of . Since , then NFDH can pack all of inside by Lemma 1. ∎

In the remaining part of this section, we show that container packings are easy to approximate if the number of containers is bounded by some fixed constant.

2.4.1 Rounding containers

In this subsection we show that it is possible to round down the size of a horizontal, vertical or area container so that the resulting sizes can be chosen from a polynomially sized set, while incurring in a negligible loss of profit.

We say that a container is smaller than a container if and . Given a container and a positive , we say that a rectangle is -small for if and .

For a set of rectangles, we define and .

Given a finite set of real numbers and a fixed natural number , we define the set ; note that if , then . Moreover, if , then obviously , and if , then .

Lemma 10.

Let , and let be a set of rectangles packed in a horizontal or vertical container . Then, for any , there is a set with profit that can be packed in a container smaller than such that and .


Without loss of generality, we prove the thesis for an horizontal container ; the proof for vertical containers is symmetric. Clearly, the width of can be reduced to , and .

If , then and there is no need to round the height of down. Otherwise, let be the set of the rectangles in with largest height (breaking ties arbitrarily), let be the least profitable of them, and let . Clearly, . Since each element of has height at most , it follows that . Thus, letting , all the rectangles in fit in a container of width and height . Since , this proves the result. ∎

Lemma 11.

Let , and let be a set of rectangles that are assigned to an area container . Then there exists a subset with profit and a container smaller than such that: , , , and each is -small for .


Without loss of generality, we can assume that and : if not, we can first shrink so that these conditions are satisfied, and all the rectangles still fit in .

Define a container that has width and height , that is, is obtained by shrinking to the closest integer multiples of and . Observe that and . Clearly, , and similarly . Hence .

We now select a set by greedily choosing elements from in non-increasing order of profit/area ratio, adding as many elements as possible without exceeding a total area of . Since each element of has area at most , then either all elements are selected (and then ), or the total area of the selected elements is at least . By the greedy choice, we have that .

Since each rectangle in is -small for , this proves the thesis. ∎


Note that in the above, the size of the container is rounded to a family of sizes that depends on the rectangles inside; of course, they are not known in advance in an algorithm that enumerates over all the container packings. On the other hand, if the instance is a set of rectangles, then for any fixed natural number we have that and for any ; clearly, the resulting set of possible widths and heights has a polynomial size and can be computed from the input.

Similarly, when finding container packings for the case with rotations, one can compute the set , and consider containers of width and height in for a sufficiently high constant .

2.4.2 Packing rectangles in containers

In this section we prove the main result of this chapter: namely, that there is a PTAS for 2DGK for packings into a constant number of containers.

Theorem 12.

Let , and let be the optimal -granular container packing for a 2DGK instance into some fixed number of containers. Then there exists a polynomial time algorithm that outputs a packing such that . The algorithm works in both the cases with or without rotations.


Let be the rounded container packing obtained from after rounding each container as explained in Lemmas 10 and 11; clearly, . Moreover, the sizes of all the containers in and a feasible packing for them can be guessed in polynomial time.

Consider first the case without rotations. We construct the following instance of GAP (see Section 2.3 for the notation), where we define a bin for each container of .

For each horizontal (resp., vertical) container of size , we define one bin with capacity equal to (resp., ). For each area container of size , we define one bin with capacity equal to . For each rectangle we define one element , with profit . We next describe a size for every element-bin pair . If bin corresponds to a horizontal (resp., vertical) container of capacity , then (resp., ) if (resp., ) and otherwise. Instead, if corresponds to an area container of size , then we set if and , and otherwise.

By using the algorithm of Lemma 8, we can compute a ()-approximate solution for the GAP instance. This immediately induces a feasible packing for horizontal and vertical containers. For each area container, we pack the rectangles by using Lemma 9, where we lose another -fraction. Overall, we obtain a solution with profit at least .

In the case with rotations we use the same approach, but defining the GAP instance in a slightly different way. For a horizontal containers of size , we consider the same as before and update it to if , and . In the latter case, if element is packed into bin , then the rectangle is packed rotated inside the container . For vertical containers we perform a symmetric assignment.

For an area container of size , if according to the above assignment one has , then we update to if and . In the latter case, if element is packed into bin , then item is packed rotated inside . ∎

If we are allowed pseudo-polynomial time (or if all widths and heights are polynomially bounded), we can obtain the following result, that is useful when we want to pack all the given rectangles, but we are allowed to use a slightly larger target region.

Theorem 13.

Let , and let be a set of rectangles that admits a -granular container packing with containers into a knapsack. Then there exists a PPT algorithm that packs all the rectangles in into a (resp. ) knapsack. The algorithm works in both the cases with or without rotations.


We prove the result only for the target knapsack, the other case being symmetric.

Since we are allowed pseudo-polynomial time, we can guess exactly all the containers and their packing in the knapsack. Then, we build the GAP instance as in the proof of Theorem 12. This time, in pseudo-polynomial time, we can solve it exactly by Lemma 5, that is, we can find an assignment of all the rectangles into the containers.

We now enlarge the height of each area container by a factor , that is, if the container has size , we enlarge its size to