Approximation Algorithms for Two-Dimensional Geometrical Knapsack

Approximation Algorithms for
Two-Dimensional Geometrical Knapsack
Lars Prädel
Supervisor
Prof. Dr. Jansen
Ralf Thöle
Theory of Parallelism
Department of Computer Science
Christian-Albrechts-University to Kiel
Acknowledgements
I would like to express profound gratitude to my advisor, Prof. Dr. Jansen for his support,
encouragement and useful suggestions throughout this work. I am also highly thankful
to Ralf Thöle for many fruitful discussions and helpful advisements. Furthermore, I
would like to thank Ulrich Schwarz and Florian Diedrich for the encouragement and the
willingness to help answering all my questions.
I am highly thankful to my parents Maren and Dietmar Prädel for their moral and financial
support during my studies. I am quite aware that I would not have reached this point
without them.
Abstract
The Knapsack problem consists of a set of items, which have a weight and a profit. It
is desired to find a subset of these items suchlike the total weight is less than a specified
capacity and the profit is maximal.
For the Two-Dimensional Geometrical Knapsack problem there is an instance of rectangles
with profits. The objective is to find a subset of these rectangles which fit into a specified
bin and have maximal profit. A polynomial time approximation scheme for this problem
is presented where the profit of each rectangle equals his area.
Contents
1 Introduction
1
1.1
Defining the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
1.2
Some General Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2 Large Optimal Value
9
2.1
Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
2.2
Analysis of an Optimal Solution . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.1
Analysis of the Gap-Rectangles . . . . . . . . . . . . . . . . . . . . 15
2.2.2
Analysis of the Original Rectangles . . . . . . . . . . . . . . . . . . 25
2.3
Guessing the Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.4
Selecting Rectangles and Filling the Gap Rectangles . . . . . . . . . . . . . 34
2.5
Packing the Slim Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.6
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3 Small Optimal Value
43
3.1
Analysis of the Optimal Solution . . . . . . . . . . . . . . . . . . . . . . . 43
3.2
Rebuild the Optimal Solution . . . . . . . . . . . . . . . . . . . . . . . . . 50
4 Conclusion
56
Chapter 1
Introduction
The objective of the classical Knapsack problem is to select a set of items with profits and
weights so that the items in this selection have a total weight less than a specified capacity
and the total profit is maximal. This problem is a so-called optimization problem which
has some relevance in the economy. There are two kinds of optimization problems, the
maximization and the minimization problem. The Knapsack problem is a maximization
problem, as the total profit has to be maximized. Hence solving an optimization problem
is equal to finding the best solution from all feasible solutions.
For some optimization problems there does not exist an efficient algorithm. In this context
an algorithm is called efficient if its run time is polynomial in the length of the instance.
There is a class of optimization problems for which it is not known whether an efficient
algorithm exists. This class is called non-deterministic polynomial time (N P). On the
contrary, the class of problems which are solved by a polynomial time algorithm is called
polynomial time (P). It is not known yet, if the classes are equal (P = N P), but the
general presumption is that this is not the case. There is a subclass of the class N P containing N P-hard problems. One attribute of the N P-hard problems is if one N P-hard
problem can be computed in polynomial time there exists a polynomial time algorithm
for all problems in the class N P and therefore it would hold P = N P.
The Knapsack problem is N P-hard even when the weights of each item is equal to its
profit. This restricted Knapsack problem is called the subset sum problem [16]. So there
exists no polynomial time algorithm for computing an optimal set of items yet. Therefore,
it is interesting to find so-called approximation algorithms which compute a solution for
this problem in polynomial time but maybe not the optimal solution. In order to yield
good results, we need an approximation ratio, which describes the value of the solution
computed by the approximation algorithm.
Let r be the approximation ratio for an approximation algorithm for some maximization
1
CHAPTER 1. INTRODUCTION
2
problem. Then the solution computed by the algorithm is larger than the optimal solution
divided by r.
For example, if we have an 2-approximation algorithm for the Knapsack problem (r = 2),
the algorithm computes for all instances a solution, where the total weight is less than
the specified capacity and the total profit larger than half of the optimal value.
For a minimization problem an approximation algorithm with ratio r computes a solution
which is smaller than r times the optimal value. It is desired to find approximation algorithms for some optimization problems in the class N P, which have an approximation
ratio close to 1.
For the Knapsack problem there exist algorithms with very good approximation ratios.
More precisely this means for each ε larger than 0, there exists an algorithm with run time
polynomial in the length of the instance and in 1/ε and with approximation ratio 1 − ε
[8]. This family of algorithms is called a fully polynomial time approximation scheme
(FPTAS), where the run time is polynomial in 1/ε and in the length of the instance and
with ratio 1 − ε for a maximization problem and 1 + ε for a minimization problem. Such
families of algorithms are desired to find, because we can decide how good the computed
solution should be. On the other hand, if we want a fast computation but it is not important if this solution is good, we can select a large precision because the algorithms have a
longer run time when the precision ε is getting smaller. There are two other characterizations of such families of approximation algorithms, the polynomial time approximation
scheme (PTAS), where the run time does not have to be polynomial in 1/ε and the efficient
polynomial time approximation scheme (EPTAS), where the run time is bounded by a
function f (1/ε) multiplied by some polynomial in the length of the instance.
There are some optimization problems for which there exists no FPTAS unless P = N P.
One of these problems is the Multiple Knapsack problem where the objective is to pack
the items in more than one knapsack. For this problem there exists a PTAS from Chekuri
and Khanna [3] and an EPTAS from Jansen [9].
The instance for the two-dimensional geometrical version of the Knapsack problem is a
set of rectangles with profits and a larger rectangle called bin. The objective is to find a
subset of these rectangles for a non-overlapping package of the bin with maximal profit.
With some simple scaling we can assume that the bin has width and height of 1 and we
allow just axis parallel packing without rotation.
There are some different rectangle packing problems, for example the Strip Packing problem. For this problem there is a set of rectangles and a strip of width 1 and infinite height.
The objective here is to find a package of these rectangles with minimal height, so this
is a minimization problem. There are results from Coffman et al. [4] for example with
approximation ratio of 3 for the so called level orientated algorithm Next Fit Decreasing
CHAPTER 1. INTRODUCTION
3
Height (NFDH) and an approximation ratio of 2.7 for the algorithm First Fit Decreasing
Height (FFDH) for the Strip Packing problem. The approximation ratio of 2 has been
improved independently by Schiermeyer [19] and by Steinberg [20]. For the Strip Packing
problem there exists also no FPTAS unless P = N P [6].
For the Strip Packing problem exists no PTAS yet, but algorithms with approximation
ratio of (1 + ε) and an additive value for all ε, that means that the height of the packing
is (1 + ε) times the optimal height plus some value. This construction is called asymptotic polynomial time approximation scheme (APTAS). It has the same restrictions like
a PTAS, but the approximation ratio may have an additive value. There exists also the
family of asymptotic fully polynomial time approximation schemes (AFPTAS), which are
like an APTAS, but the run time has to be polynomial in 1/ε.
The APTAS from Kenyon and Rémila [17] computes a package with additive constant in
O(1/ε2 ) and the APTAS from Jansen and Solis-Oba [10] has a performance bound by an
additive constant in O(1). The latter algorithm uses an PTAS for the two-dimensional
Geometrical Knapsack problem, where the bin is augmented in one direction by ε.
There are some results for the Geometrical Knapsack problem where the rectangles are
squares. There is an asymptotic (4/3)-approximation algorithm where a set of squares
with unit profits is packed into a bin [1], a PTAS with the same restrictions by Jansen
and Zhang [13], a (5/4 + ε)-approximation algorithm for packing squares with arbitrary
profits found by Harren [7] and recently a PTAS for packing squares with arbitrary profits
by Solis-Oba and Jansen [11]. There also exists a (2 + ε)-approximation algorithm for
packing rectangles with arbitrary profits [14] by Zhang and Jansen.
For the Three-Dimensional Geometrical Knapsack problem the objective is to pack cubes
into a specified square. There is a 7 + ε algorithm [5].
The main result of this work is a PTAS for the Geometrical Knapsack problem, where the
rectangles have profits equal to their area. In other words we want to reduce the free space
of the bin. This problem has some applications like VLSI layout, internet advertisement
and logistics.
In the first part of this work, we define the Geometrical Knapsack problem and formally
introduce the corresponding instances. Some of these definitions will be used later in the
analysis of the algorithm. Then we show, that there exists no FPTAS for this problem
unless P = N P. After this we start with the analysis of the algorithm.
In this algorithm we lose some small profit which cannot be estimated by the optimum.
Hence the algorithm is divided into two parts. In the first part we assume that we have
an optimal profit larger than some value which depends on the precision of the algorithm.
Because we lose just a small amount of profit which depends not on this optimal solution,
it is sufficient that the optimal value is larger than some small value. We will describe
CHAPTER 1. INTRODUCTION
4
this value with εc , where c := 31 (see Theorem 58).
To distinguish between the two cases, we have to look at the items of the instance. If
one of these items has a profit larger than εc , or if we can guess a subset of the instance,
where all rectangles have total height or width less than 1 and a larger profit than this
value, we are in the first case. Otherwise if all rectangles in the instance have total profit
less than this amount, we are surely in the second case. If we are not able to distinguish
between these cases, we can simply run the first part. If the output of the first part is
larger than εc , we can keep this output, otherwise we run the second part and take the
solution with the largest profit.
In each part, we first look at the structure of an optimal solution. We modify this solution
in getting a simple structure. Then we are able to rebuild this modified solution with
some guessing which means we try a discrete number of possibilities.
After analysing the two parts of the algorithm we finish this work with a short conclusion.
1.1
Defining the Problem
For defining the problem we start with the mathematical definition of a rectangle. Then
we define a construction of the bin and what is meant with packing a rectangle. In this
section we have some helpful definitions and notations as well.
Definition 1 (Rectangle). A rectangle is a tuple (w,h), w,h ∈ R, which are the width
and height of the rectangle. For a rectangle rl we say, that wl is the width and hl is the
height of rl .
We want to pack a rectangle into a bin. We can assume that the bin has width and
height 1, otherwise we could scale the bin and the rectangles with some value. We set
a coordinate system over the bin, where the point (0,0) is at the lower left corner of the
bin.
Definition 2 (Bin). A bin is a coordinate system, so that the lower left corner has
coordinates (0,0) and the upper right corner has coordinates (1,1).
A bin can be seperated in strips and squares.
Definition 3 (Strip). We call the area [0,1] × [i · δ, (i + 1) · δ] the ith horizontal strip
and the area [i · δ, (i + 1) · δ] × [0,1] the ith vertical strip for i ∈ {0, . . . ,1/δ − 1}, for some
specified δ < 1, where 1/δ is an integer.
CHAPTER 1. INTRODUCTION
5
The crossing area of two strips is a square.
Definition 4 (δ×δ Square). The δ×δ square (i,j) is the cross section of the ith horizontal
strip and the jth vertical strip, for i,j ∈ {0, . . . ,1/δ − 1} for some specified δ < 1.
The rectangles will be packed into the bin by setting some coordinates. This means the
lower left corner of the rectangle is mapped to some coordinates of the bin.
Definition 5 (Packed Rectangle). A packed rectangle is a rectangle, with two coordinates
(x,y) for x,y ∈ R. This means the lower left corner of the rectangle is packed at position
(x,y). For a packed rectangle rl we say xl and yl are the coordinates of rl .
Two packed rectangles lying next to each other or on top of each other with their positions
is defined as follows.
Definition 6 (On top). A packed rectangle ri lies on top of another packed rectangle rj
if yi = yj + hj and xi ≤ xj < xi + wi or xj ≤ xi < xj + wj .
Definition 7 (At the right side). A packed rectangle ri lies at the right side of a packed
rectangle rj , if xi = xj + wj and yi ≤ yj < yi + hi or yj ≤ yi < yj + hj .
Our problem has an instance of rectangles, so it is useful that we have a notation for the
set of rectangles which are in the instance of our problem:
Notation 8 (Instance L). Let L = {r1 , . . . ,rn } be a set of n rectangles, with ri = (wi ,hi ),
for i ∈ {1, . . . ,n}. This set is the instance of our algorithm.
The rectangles of the instance shall be packed into the bin, so that the rectangles are not
intersecting each other. We have to define what the meaning of a non-overlapped packing
is.
Definition 9 (Non-overlapped). A non-overlapped packing of a set of packed rectangles,
{r1 , . . . ,rm } is a packing with xi ≥ xj + wj ∨ xi + wi ≤ xj ∨ yi ≥ yj + hj ∨ yi + hi ≤ yj ∀i,j ∈
{1, . . . ,m}.
For the analysis of an optimal solution we need a notation for the set of packed rectangles
which are in this solution.
Notation 10 (Optimal Sets). For a given sublist S of rectangles in L, let S ∗ be the
sublist of S where the rectangles are in an optimal but fixed, solution. These rectangles
are already packed into the bin, so they have coordinates.
CHAPTER 1. INTRODUCTION
6
P
Definition 11 (Area). Let S be a subset of L. We describe with A (S) := ri ∈S wi · hi
the total area of the rectangles in S. Because in our problem the profit equals the area of
the rectangles, we call it also its profit.
Now we can define the problem we have to deal with.
Definition 12 (Geometrical Knapsack). Find a sublist of L, so that there is a nonoverlapped packing into a bin of width and height 1 and with maximal profit.
Before we start with the algorithm we have some general results for this problem.
1.2
Some General Results
In the last section we defined the problem. It is N P-hard, because it is an extension of
the one dimensional Knapsack problem where the weights are equal to the profits. This
is proven by defining an instance of the Two-Dimensional Geometrical Knapsack from an
instance of the Knapsack problem where the profits equal the weight. The new defined
instance has rectangles with widths 1 and heights equal to the weights of the items divided
by the capacity of the knapsack. If we have a polynomial time algorithm which solves our
problem, it solves this Knapsack problem and with this it is P = N P. Hence there exists
no effizient algorithm unless P = N P. The desired result of this work is a polynomial time
approximation scheme (PTAS). This is a family of polynomial time algorithms (Aε )ε>0 ,
with an approximation ratio of at least (1 − ε) · OPT = (1 − ε) · A (L∗ ).
If the algorithms have polynomial time corresponding to 1/ε, we call them fully-polynomial
time approximation schemes (FPTAS). We will show that for our problem there exists no
FPTAS unless P = N P.
For this we need another problem called Equal Cardinality Partition which is N P-hard
[6].
Definition 13 (Equal Cardinality Partition). Given a finite set I of even cardinality
P
n containing positive integer numbers ai , i ∈ {1, . . . ,n}, with ni=1 ai = 2A, determine
if there exists a partition of I into two subsets I1 ,I2 such that |I1 | = |I2 | = n/2 and
P
P
i∈I1 ai =
i∈I2 ai = A.
We will show similar to [2], that if we have a FPTAS for our problem there is an exact
algorithm for the Equal Cardinality Partition problem.
Theorem 14. The Two-Dimensional Geometrical Knapsack problem with maximizing
the area of the rectangles admits no FPTAS unless P = N P
CHAPTER 1. INTRODUCTION
7
Proof. Given an instance of the Equal Cardinality Partition, we define an instance of the
Two-Dimensional Geometrical Knapsack problem, containing n rectangles with widths
2A+ai
wi := A(n+1)
and heights hi := 1/2 for all i ∈ {1, . . . ,n}. If there exists a partition with
equal cardinality and equal profit for the instance of the Equal Cardinality Partition, all
rectangles could be packed into the bin because the rectangles corresponding to the set
I1 or I2 have total width of
X
wi =
i∈I1
=
X 2A + ai
A (n + 1)
i∈I1
X
1
A (n + 1)
1
=
A (n + 1)
2A + ai
i∈I1
X
2n
A+
ai
2
i∈I
!
1
A (n + 1)
=
A (n + 1)
= 1.
Hence the rectangles corresponding to I1 could be packed at the bottom of the bin and
the rectangles of I2 could be packed at the top of the bin. Therefore we have a solution
with profit 1.
If we have a packing of the rectangles with profit 1, we can solve the Equal Cardinality
Partition, because all rectangles have height of 1/2 and so we have two rows of rectangles.
One row lies at the bottom of the bin and one at the top. We can set the corresponding
items to the rectangles in the lower row to set I1 and the remaining items to set I2 . The
items of each set have total weight of A otherwise the rectangles in one row would have
a width larger than 1.
If there would be a row with more than n/2 rectangles containing rectangles {rj1 , . . . ,rj n +1 }
2
then there would be a total width of at least
j n +1
2
X
i=j1
j n +1
2
X
2A + ai
wi =
A (n + 1)
i=j
1
jn
2 +1
X
1
=
2A + ai
A (n + 1) i=j
1
j n +1
2
A (n + 1) X
+
ai
=
A (n + 1) i=j
1
> 1,
CHAPTER 1. INTRODUCTION
8
which is a contradiction.
So we have seen, that if and only if we can partition the instance of Equal Cardinality
Partition, the optimal value of packed rectangles is 1.
Any non-optimal solution leaves at least one rectangle ri unpacked. We have a profit of
at most
2A
1
1
2A + wi 1
· <1−
· =1−
.
1−
A (n + 1) 2
A (n + 1) 2
n+1
If there exists an FPTAS for Two-Dimensional Geometrical Knapsack, the Equal Cardinality Partition problem could be solved with an ε < 1/n+1. Because the FPTAS would
have an run time polynomial in 1/ε, it would solve the Equal Cardinality Partition problem
in polynomial time in the length of the instance. This is a contradiction to P =
6 NP
We have seen that there exists no FPTAS for the Two-Dimensional Geometrical Knapsack
problem unless P = N P. Now we can start with defining our algorithm. In the following
we define a PTAS for the problem. In the first part we assume that the instance has
an optimal profit larger or equal than some specified value which was described in the
introduction with εc . In the second part we assume, that the instance has an optimal
profit less than this value.
Chapter 2
Large Optimal Value
In this chapter we have to deal with an optimal value which is larger or equal than εc .
Hence we are able to lose some profit which does not depend on this optimal solution.
In the first step we partition the set of rectangles into sets of fat, wide, long and slim
rectangles. For this partitioning we have to discard a small amount of rectangles. In the
next step we have a look on an optimal solution. We can modify this solution in creating
some so-called gap-rectangles, in which we pack the wide and long rectangles. We are
able to find an upper bound of the number of gap-rectangles and with this we have to
deal only with a constant number of rectangles. By modifying this solution we lose some
profit. Then we change the point of view by rebuilding this modified optimal solution.
Because we have a constant number of these gap-rectangles, we are able to guess which
rectangles are on the right side or at the top of each gap-rectangle. That means we can
guess the whole structure of the modified solution. Then we solve a Linear Program to
compute the coordinates of these gap-rectangles and getting the exact widths and heights
of them. In the last step we pack the remaining slim rectangles into the remaining free
space.
2.1
Partitioning
First of all we have to partition the set of rectangles from L in fat, long, wide and slim
rectangles and discard rectangles of the instance which are not in this partition. So we
have to ensure that the rectangles which will be discarded have a small profit. This step
is similar to the partitioning in [10].
We will start with defining a new value ε0 which depends on the precision of the algorithm
ε.
9
CHAPTER 2. LARGE OPTIMAL VALUE
10
Notation 15. Let
ε0 ≤ min {1/2,ε/4}
be the largest value with 1/ε0 being an even integer and ε the precision of the algorithm.
Define a sequence σ1 , . . . ,σ 40 +1 , with
ε
σ1 = ε0
and
12/σ
σk = σk−1k−1
+8
for k ∈ {2, . . . ,4/ε0 + 1}.
Discard the rectangles ri ∈ L, with σk−1 < wi ≤ σk or σk−1 < hi ≤ σk , for all k in the
sequence except the first member.
So the algorithm tries all different partitions and the solution with the largest profit will
be taken.
Lemma 16. Let Lk := {ri ∈ L|wi ∈ (σk+1 ,σk ] ∨ hi ∈ (σk+1 ,σk ]}and L∗k be the subset of
Lk with the rectangles of an fixed optimal solution.
There exists a k ∈ {2, . . . ,4/ε0 + 1} such that
A (L∗k ) ≤
ε0
A (L∗ ) .
2
Proof. Each rectangle belongs to at most two sets L∗k , so there is
X
A (L∗k ) ≤ 2 · A (L∗ ) .
k∈{2,...,4/ε0 +1}
Assume A (L∗k ) > 2ε A (L∗ ) for all k ∈ {2, . . . ,4/ε0 + 1}. Then it holds
X
k∈{2,...,4/ε0 +1}
A (L∗k ) >
4 ε
· A (L∗ ) = 2 · A (L∗ ) .
ε 2
This is a contradiction.
This shows that the loss of a set is small enough. With trying all different sets we will
have this set in one step.
Notation 17. Let L∗k be the set where the output of the algorithm has the largest profit,
then
δ := σk
CHAPTER 2. LARGE OPTIMAL VALUE
and
s :=
11
12
+ 8.
δ
Now we have the following partition of fat, wide, long and slim rectangles.
Definition 18 (fat, long, wide, slim rectangles). We partition the remaining items of the
instance in
• LF = {ri |ri ∈ L ∧ hi > δ ∧ wi > δ} the set of fat rectangles,
• LW = {ri |ri ∈ L ∧ hi ≤ δ s ∧ wi > δ} the set of wide rectangles,
• LL = {ri |ri ∈ L ∧ hi > δ ∧ wi ≤ δ} the set of long rectangles and
• LS = {ri |ri ∈ L ∧ hi ≤ δ s ∧ wi ≤ δ s } the set of slim rectangles.
Therefore, we can guess some value δ, where we lose some small profit in respective to an
optimal solution. Now we have just rectangles which are tall or very small in the width
and height or rectangles which have a tall side and a very small side.
2.2
Analysis of an Optimal Solution
In the first step we analyse the structure of an optimal solution. We modify this solution
so it is easier to compute. That means, we change the positions of some rectangles or
round and classify them. After this modification we are able to compute this solution.
We will lose some profit by changing the solution, but we are able to estimate the loss.
Consider an optimal solution. We will give an overview over the modification steps. After
this we estimate the loss of profit. For describing the modification steps we assume that a
strip of the optimal solution is like in Figure 2.1. We delete all slim rectangles in it. Now
wide rectangle
long rectangle
fat rectangle
Figure 2.1: Strip of an optimal solution
CHAPTER 2. LARGE OPTIMAL VALUE
12
wide rectangle
long rectangle
fat rectangle
Figure 2.2: Discard the slim rectangles
we have just fat, long and wide rectangles in it (see Figure 2.2). Then we take the wide
rectangles out of this solution, leading us to a solution with just long and wide rectangles
(see Figure 2.3). We draw a horizontal line at the bottom and top edge of each long and
gap rectangle
long rectangle
fat rectangle
Figure 2.3: Take the wide rectangles of the solution
fat rectangle, until the line hits another rectangle, or the border of the bin. These lines
build rectangles which we will call wide gap-rectangles (see Figure 2.4). In the next step
gap rectangle
long rectangle
fat rectangle
Figure 2.4: Optimal solution with gap-rectangles
we repack the original wide rectangles. They are packed at the same positions like the
gap-rectangles. We will say, that the rectangles are in one gap-rectangle, if they intersect
the same space. Consider that the rectangles could intersect with more than one gaprectangle, so we cut the rectangles (see Figure 2.5). After this we take the gap-rectangles
and pack them sorted by width on a stack (see Figure 2.6). We cut the stack in a constant
CHAPTER 2. LARGE OPTIMAL VALUE
13
gap rectangle
long rectangle
fat rectangle
Figure 2.5: Repack the wide rectangles into the gap-rectangles
Figure 2.6: Gap-rectangles on a stack
number of parts of the same height, and round the width of each rectangle of each part
to the width of the widest rectangle in this part.
At this step we want to create an integral solution of the cut rectangles in the gaprectangles. For this we merge all gap-rectangles in one group. Then we take the cut
rectangles out of the solution and put the rectangles on a stack as we handled the gaprectangles before. We cut also this stack in a constant number of parts, and round up each
rectangle to the width of the widest group. We delete the largest group and repack each
rectangle at the space of the next wider group. Therefore, we have to cut the rectangles
again. Now we have the stack of the gap-rectangles and in each part are now fractional
rectangles with a constant number of different widths. In the next step we build so-called
configurations, in which is described how many rectangles of each width are lying next
to each other at each height. We minimize the number of these configurations and delete
for each configuration the topmost rectangles.
Because we want to repack the gap-rectangles, we also have to delete the widest group
of the gap-rectangles, so the remaining rectangles still fit in the solution (see Figure
CHAPTER 2. LARGE OPTIMAL VALUE
14
2.7). Now we repack the gap-rectangles, where each gap-rectangle will be placed at a
Figure 2.7: Rounded gap-rectangles
position of a corresponding rectangle of the next wider group. At this step the original
rectangles could be cut again (see Figure 2.8). We change the positions of a few specific
gap rectangle
long rectangle
fat rectangle
Figure 2.8: Replace the gap-rectangles
gap-rectangles without changing the structure of the solution and merge some of them
with the same width (see Figure 2.9). After this step, we delete the cut rectangles and
gap rectangle
long rectangle
fat rectangle
Figure 2.9: Merge gap-rectangles
CHAPTER 2. LARGE OPTIMAL VALUE
15
have a solution with gap-rectangles in which the original rectangles are placed.
We do the same steps for the long rectangles. Now we can compute the total number of
the gap-rectangles and estimate the loss of profit. After this we have a discrete solution
with a constant number of rectangles.
2.2.1
Analysis of the Gap-Rectangles
Consider an optimal solution without the slim and wide rectangles, or slim rectangles and
wide gap-rectangles respectively.
We define the gap-rectangles by setting the surrounding gap-rectangles for each remaining
rectangle, that means for the long and fat rectangles or wide gap-rectangles and fat
rectangles respectively. For this we have to define the neighbourhood of each rectangle.
Definition 19 (Neighbour Rectangle). Let r1 , . . . ,rk be a set of packed rectangles for
k ∈ N and let i ∈ {1, . . . ,k}. Define the following sets for the upper left, upper right,
lower left, lower right, left and right neighbours of ri :
Niul := {rj |j ∈ {1, . . . ,k} ∧ xj + wj ≤ xi ∧ yj ≤ yi + hi ≤ yj + hj }
Niur := {rj |j ∈ {1, . . . ,k} ∧ xi + wi ≤ xj ∧ yj ≤ yi + hi ≤ yj + hj }
Nill := {rj |j ∈ {1, . . . ,k} ∧ xj + wj ≤ xi ∧ yj ≤ yi ≤ yj + hj }
Nilr := {rj |j ∈ {1, . . . ,k} ∧ xi + wi ≤ xj ∧ yj ≤ yi ≤ yj + hj }
Nil := {rj |j ∈ {1, . . . ,k} ∧ xj + wj ≤ xi ∧ yi ≤ yj ∧ yj + hj ≤ yi + hi } ∪ Niul ∪ Nill
Nir := {rj |j ∈ {1, . . . ,k} ∧ xi + wi ≤ xj ∩ yi ≤ yj ∧ yj + hj ≤ yi + hi } ∪ Niur ∪ Nilr
For a right neighbour rj of ri is
Bi,j := Nir ∩ Njl
the set of rectangles between ri and rj .
Now we can define the gap-rectangles because the coordinates of the rectangular space
can be defined from each rectangle and its surrounding rectangles. We define for each
rectangle in the solution 6 rectangles. The construction of these gap-rectangles are like
in the proof given later in Lemma 55.
Definition 20 (Gap-Rectangle). A gap-rectangle is a rectangular space, where no other
rectangles intersect. It is defined by its surrounding packed rectangles.
For this construction it is helpful to define some dummy rectangles for the wall of the bin
CHAPTER 2. LARGE OPTIMAL VALUE
16
with height or width equal to zero.
Let ri be a packed rectangle in the bin.
Let
rll ∈ Nill with xll + wll = max xj + wj
rj ∈Nill
rlr ∈ Nilr with xlr = min xj
rj ∈Nilr
rul ∈ Niul with xul + wll = max xj + wj
rj ∈Niul
rur ∈ Niur with xur = minur xl
rj ∈Ni
yl := max{yj + hj |rj ∈ Bll,lr ∧ yj + hj ≤ yi } ∪ {yll ,ylr }
yu := min{yj |rj ∈ Bul,ur ∧ yj ≥ yi + hi } ∪ {yul ,yur }
ymll := min{yj |rj ∈ Bll,i ∧ yi ≤ yj } ∪ {yll + hll ,yi + hi }
ymlr := min{yj |rj ∈ Bi,lr ∧ yi ≤ yj } ∪ {ylr + hlr ,yi + hi }
ymul := max{yj + hj |rj ∈ Bul,i ∧ yj + hj ≤ yi + hi } ∪ {yul ,yi }
ymur := max{yj + hj |rj ∈ Bi,ur ∧ yj + hj ≤ yi + hi } ∪ {yur ,yi }
(see Figure 2.10).
x1 := xll + wll
w1 := xlr − x1
y1 := yl
h1 := yi − y1
x2 := xll + wll
w2 := xi − x2
y2 := yi
h2 := ymll − y2
x3 := xi + wi
w3 := xlr − x3
y3 := yi
h3 := ymlr − y3
x4 := xul + wul
w4 := xi − x4
y4 := ymul
h4 := y1 + h1 − y4
x5 := xi + wi
w5 := xur − x5
y5 := ymur
h5 := y1 + h1 − y5
x6 := xul + wul
w6 := xur − x6
y6 := yu
h6 := yu − y6
Because it is possible that we define a wide gap-rectangle with width less than δ or a long
gap-rectangle with height less than δ we have to discard them, before rounding them. We
round the gap-rectangles as in the algorithm in [17]. Because we need this technique more
than one time, we define an algorithm round (L0 ,K) where L0 is a set of packed rectangles
and K is the number of rounded widths.
The round algorithm is:
CHAPTER 2. LARGE OPTIMAL VALUE
17
ru
r6
rul
r4
rmul
rll
r5
rmll
rur
rmur
ri
rmlr
r3
r2
rlr
r1
rl
Figure 2.10: Gap-rectangles from ri
• Sort the rectangles by non-increasing width.
• Put the rectangles on a stack.
• Let H be the height of this stack.
H
• Cut the stack at height i · K+1
for i ∈ {1, . . . ,K} and get K + 1 parts with fractional
rectangles.
• Round the rectangles in each part to the width of the widest rectangle.
• Eliminate the rectangles in the part with the widest width.
• Repack the remaining rectangles at the space where a rectangle in the next wider
part has lain, cut them if necessary.
If we round the heights we use the same algorithm but exchange width with height and
the x-coordinate with the y-coordinate.
It is useful to define a notation for the number of width classes and height classes of the
gap-rectangles. We set this value later in Lemma 34.
Notation 21. Let K be the number of the different widths W1 , . . . ,WK of the wide gaprectangles and K 0 be the number of the different heights H1 , . . . ,HK 0 of the long gaprectangles. Let HW be the height of the stack with the wide gap-rectangles and HL be the
height of the stack with the long gap-rectangles. We will call each part of the stack a block.
CHAPTER 2. LARGE OPTIMAL VALUE
18
After this we estimate the loss profit with the round algorithm for the gap-rectangles.
Lemma 22. By using the round algorithm we lose a profit of at most
by discarding the largest part.
1
δ·(K+1)
+
1
δ·(K 0 +1)
Proof. We only prove the lemma for the wide gap-rectangles. The proof for the long
gap-rectangles is analogous.
The height of the stack with the wide gap-rectangles HW is at most 1/δ, because the gaprectangles have a width of at least δ and the total area is bounded by 1.
So we lose an area of
1
HW
≤
.
K +1
δ · (K + 1)
Consider that this is not the total loss of profit we have to deal with. We discarded the
original wide and long rectangles from the solution but we want to pack them at the space
of the gap-rectangles which are defined at the same place where the original rectangle has
lain. The original rectangles could have lain at the place intersecting now more than one
rectangle, so the original rectangle could belong to two rectangles of different classes. We
have to compute the total number of gap-rectangles before we can estimate the loss of
profit. First we want modify the stacks, so that we can guess the widths and heights of
the different classes later.
Lemma 23. We can modify the stack of the wide gap-rectangles, such that each group
has width of kj + ij δ s , where k is the width of the maximal width of wide rectangles lying
in a gap-rectangle of each group j ∈ {1, . . . , K} and ij ∈ {0, . . . , δ1s } with losing a profit
of 2 · δ s−1 .
Proof. Remember that in the space of each wide gap-rectangle are wide rectangles and slim
rectangles. Take the slim rectangles of the gap-rectangles and move the wide rectangles
horizontal to the left until they touch each other. Now the width of the used place is
a combination of the width of wide rectangles. We can round the width of each block
to a value iδ s for i ∈ {0, . . . , δ1s } by deleting the rightmost slim rectangles. Because the
gap-rectangles have a width of at least δ and the total area is bounded by 1 the stack has
a height of at most 1/δ. The slim rectangles have a width of at most δ s so we lose slim
rectangles at each height of the right side with width of at most 2δ s . Altogether we lose
at most 2 · δ s · 1/δ.
The same proof holds for the long rectangles, so this yields the following lemma.
CHAPTER 2. LARGE OPTIMAL VALUE
19
Lemma 24. We can modify the stack of the long gap-rectangles, such that each group has
a height of kj + ij δ s , where k is the height of the maximal height of long rectangles lying
in a gap-rectangle of each group j ∈ {1, . . . , K 0 } and ij ∈ {0, . . . , δ1s } with losing a profit
of 2 · δ s−1 .
We can also modify the heights of the stacks by deleting some rectangles.
Lemma 25. We round the heights of the stacks by losing a total profit of at most K · 2δ s
and K 0 · 2δ s respectively so that the height is iδ s · K for i ∈ {0, . . . , δs+11 ·K } and jδ s · K 0 for
j ∈ {0, . . . , δs+11·K 0 } respectively.
Proof. The heights of the stacks are in [0,1/δ], otherwise the total area of all rectangles in
this stack would be larger than one. If we round the heights of these stacks, we have to
delete the topmost rectangles in each block. We lose a total profit of at most K · 2 · δ s and
K 0 · 2 · δ s respectively by deleting the topmost rectangles of each group until we create a
gap of at least δ s .
After this rounding step, we merge some gap-rectangles and change the positions of gaprectangles without changing the structure of the optimal solution. This yields a simpler
structure of the solution and we can count the number of the gap-rectangles in the solution.
Consider the packing after rounding the wide and long gap-rectangles. We change the
packing with the following steps:
1. Shift the wide gap-rectangles vertically down if possible.
2. Shift wide gap-rectangles, which are lying on top of each other horizontally, so that
they have the same x-coordinate if possible.
3. If there are three wide gap-rectangles r1 ,r2 ,r3 on top of each other with x1 = x2 = x3
and w1 > w2 and w3 > w2 and h2 < δ, then if w3 ≤ w1 , set y3 := y2 and y2 := y3 +h3 ,
otherwise y2 := y1 and y1 := y2 + h2 . That means we change the position of the
rectangle in the middle with the smaller rectangle at the outside.
4. Merge two gap-rectangles of the same width which are lying on top of each other at
the same x-coordinate.
5. Repeat these steps until there is no change.
We will treat the walls of the bins also as rectangles of width 1 and height 0, so that no
rectangle of height less than δ lies between the wall and a wider rectangle.
CHAPTER 2. LARGE OPTIMAL VALUE
20
The third step can be done because in the remaining space between the rectangles at the
outsides lies no long or fat rectangle, because the height of the free space is less than δ
and because of the construction of the gap-rectangles there can be no other wide gaprectangle.
These steps also can be done for the long gap-rectangles by exchanging the x-coordinate
and y-coordinate and the width and length.
After this step we introduce the following notation for the merged gap-rectangles.
Notation 26. Let GW be the set of gap-rectangles which represent the wide rectangles
and let GL be the set of gap-rectangles which represent the long rectangles.
Now we estimate an upper bound for the number of gap-rectangles in GW and GL . For
this we define a so-called stair. Intuitively, a stair is a set of long or wide rectangles lying
next to each other, where the position of the upper edge of these rectangles is getting
larger or smaller.
Definition 27 (Step). A step is a set of coordinates. An up going step of two wide
rectangles r1 ,r2 lying on top of each other is the set {(x,y2 ) |x1 ≤ x < x2 }. A down going
step of these rectangles is {(x,y2 ) |x1 + w2 < x ≤ x2 + w2 }. An up going step of two side by
side lying long rectangles r1 ,r2 is {(x,y) |x1 ≤ x < x1 + w1 ∧ y = y1 + h1 }, where y2 +h2 >
y1 + h1 .
Definition 28 (Stair). A stair is a set of up going (down going) steps of long or wide
rectangles unified by the set of coordinates of the upper edge of the top most rectangle (see
Figure 2.11).
Figure 2.11: Up going stairs with 5 steps
Now we give a definition of rectangles which starts or ends in a specified strip or square.
Definition 29 (Start, End). A wide rectangle starts in a specified area if the x-coordinate
is in this area and it ends in this area, if its x-coordinate plus its width is within this area.
CHAPTER 2. LARGE OPTIMAL VALUE
21
A long rectangle starts in this area, if the y-coordinate is in this area and ends if its
y-coordinate plus its height is in this area.
Now we can bound the number of gap-rectangles. We will do this with an inductive
argument over the horizontal strips and starting with the lowest strip.
Lemma 30. In each δ × δ square (x,0), x ∈ {0, . . . ,1/δ} there are at most K wide gaprectangles.
Proof. In the lowest strip a wide gap-rectangle can only lie on top of a wide gap-rectangle
with a larger width. If a gap-rectangle would lie on top of a gap-rectangle with lesser
width, it would overlap and there would be a gap where no long gap-rectangle or fat
rectangle would fit. This cannot happen because we changed the position in the algorithm
above. The same would happen if two gap-rectangles of the same width would lie on
different x-coordinates. So there are at most K wide gap-rectangles on top of each other,
the widest at the bottom and the smallest at top (see Figure 2.12). It is not possible,
that two wide gap-rectangles lie side by side because of the construction of the gaprectangles.
y
1
2
x1
Figure 2.12: Lowest strip
After the first strip we have a look at a strip above this and assume that we have a fixed
number of wide gap-rectangles in the strip below it. We start with counting the long
gap-rectangles which could start in this strip.
Lemma 31. From a δ × δ square (i,j) with a stair of maximal M wide gap-rectangles
start at most M ·K 0 +3·K 0 long gap-rectangles, with i ∈ {1, . . . ,1/δ}. These gap-rectangles
build a stair of at most M · K 0 + 2 · K 0 steps.
For i = 0 there are M · K 0 + 2 · K 0 long gap-rectangles, these build a stair of at most
M · K 0 + K 0 steps.
CHAPTER 2. LARGE OPTIMAL VALUE
22
Proof. On the top of one rectangle there could start at most 2 · K 0 long gap-rectangles
because otherwise there would be a gap-rectangle between two taller gap-rectangles. This
is not possible because of the algorithm above. They have to lay side by side, so that the
shortest gap-rectangles are at the outsides and the taller in the middle. They build an up
going and down going stair of at most K 0 rectangles.
Consider that we have a δ × δ square with a stair of maximal M wide gap-rectangles.
It could be, that there are two fat rectangles in this square, so we have two steps more.
These fat rectangles have to end in this square to build steps, so there are at most two
fat rectangles because there could lie just two fat rectangles intersecting this square side
by side. We have to deal with M + 2 steps. Let us assume that these steps form a down
going stair. If the long gap-rectangles starting in this square build an up going stair, then
on this stair start at most K 0 gap-rectangles, but if they build a down going stair then
there could start on each step at most K 0 gap-rectangles. With this we have at most
(M + 2) · K 0 gap-rectangles forming a down going stair. K 0 long gap-rectangles could
build an up going stair at the left side of the gap-rectangles. Hence there could start
M · K 0 + 3K 0 long gap-rectangles (see Figure 2.13). In the first strip there are no fat
rectangles which could build a step, but we have the bottom of the bin as step. With this
there are K 0 fewer steps.
Figure 2.13: Start of long rectangles
In replacing the long with the wide gap-rectangles the following lemma holds.
Lemma 32. From a δ × δ square with a down going stair of at most L long gap-rectangles
CHAPTER 2. LARGE OPTIMAL VALUE
23
start at most L·K +3·K wide gap-rectangles which building a stair of at most L·K +2·K
steps.
Now we are able to give an upper bound of gap-rectangles in one δ × δ square.
Theorem 33. In a δ × δ (i,j) square start and end at most (K + 1)j+1 · (K 0 + 1)j wide
gap-rectangles.
Proof. For the first strip j = 0 we use Lemma 30, so we have in the lowest strip in each
square at most K wide gap-rectangles. Then we use Lemma 31 and getting, that from a
square in the first strip start at most (K + 2) · K 0 long gap-rectangles which building a
stair of at most (K + 1) · K 0 steps. From Lemma 32 we know that from this stair starts
at most (K + 1) · K 0 · K + 3K wide gap-rectangles.
Because K > 1 We have
(K + 1) · K 0 · K + 3K ≤ (K + 1) · K 0 · K + (K + 1) · K 0 + (K + 1) · (K + 1)
= (K + 1) · (K 0 · K + K 0 + (K + 1))
= (K + 1) · (K 0 · (K + 1) + (K + 1))
= (K + 1) · (K 0 + 1) · (K + 1)
= (K + 1)2 · (K 0 + 1)
wide gap-rectangles in the second strip j = 1. Now let j ≥ 2 and in the δ ×δ square i,j −1
are at most (K + 1)j · (K 0 + 1)j−1 wide gap-rectangles. These gap-rectangles build a stair
of at most (K + 1)j · (K 0 + 1)j−1 steps, where each gap-rectangle builds a step. From
Lemma 31 we know that we have (K + 1)j · (K 0 + 1)j−1 · K 0 + 2K 0 long gap-rectangles
which build a stair. We have at most
(K + 1)j · (K 0 + 1)
j−1
· K 0 + 2K 0 ≤ (K + 1)j · (K 0 + 1)
j
long gap-rectangles building a stair in the strip j.
From Lemma 32 we know that we have less than (K + 1)j · (K 0 + 1)j · K + 3K wide
gap-rectangles in this square.
Altogether we have
j
j
(K + 1)j · (K 0 + 1) · K + 3K ≤ (K + 1)j · (K 0 + 1) · K + (K + 1)2 · (K 0 + 1)
j
≤ (K + 1)j · (K 0 + 1) · K + (K + 1)j · (K 0 + 1)
j
= (K + 1)j · (K 0 + 1) · (K + 1)
j
CHAPTER 2. LARGE OPTIMAL VALUE
24
We can estimate the number of gap-rectangles by setting K and K 0 . We will do this in
the following lemma.
Lemma 34. For K = K 0 = (1/δ)2 − 1 we have less or equal than δ 2−s/2 gap-rectangles in
an optimal solution.
Proof. From Theorem 33 we know that we have less than
1/δ −1
1/δ −1
1/δ
X
(K + 1)
i+1
0
i
· (K + 1) =
1/δ
· (K + 1)
X
(K + 1)i · (K 0 + 1)
i
i=0
i=0
wide gap-rectangles in the solution. Because K = K 0 we have the same number for
the long gap-rectangles, by using the Theorem 33, in replacing the wide gap-rectangles
with the long gap-rectangles or turn the bin on the left side. Thus the total number of
gap-rectangles is at most
1/δ −1
X
2/δ · (K + 1)
(K + 1)2i .
i=0
From the geometric series we know that
1/δ −1
X
i=0
(K + 1) /δ − 1
(K + 1) ≤
(K + 1)2 − 1
2
2i
is. Because (K + 1)2 − 1 is larger than 1 we know, that
(K + 1) /δ − 1
2
2
< (K + 1) /δ − 1 < (K + 1) /δ .
2
(K + 1) − 1
2
With this we can bound the number of gap-rectangles.
1/δ −1
2/δ
· (K + 1)
X
(K + 1)2
i
2
< 2/δ · (K + 1) · (K + 1) /δ
i=0
≤ 2/δ · (K + 1) /δ
3/δ
1
2
≤ /δ ·
δ2
6/δ
1
2
= /δ ·
δ
3
CHAPTER 2. LARGE OPTIMAL VALUE
25
We can replace the exponent with s and eliminate the term 2/δ.
6/δ
12/(2·δ)
1
1
2/δ ·
= 2/δ ·
δ
δ
12 ·( 12δ +8−8)
1
= 2/δ ·
δ
12 ·(s−8)
1
= 2/δ ·
δ
12 ·(s−4)−2
1
= 2/δ ·
δ
(s−4)
2
1
=2·δ·
δ
(s−4)
2
1
≤
δ
This is the desired solution.
We have estimated the total number of gap-rectangles we have to deal with. Hence
we can estimate the loss of profit of the rectangles which intersect with two different
gap-rectangles. We will do this in the next section, where we have a closer look at the
rectangles which are replaced with the gap-rectangles. We create in this section a solution
of the long and wide rectangles, so that they are lying in the gap-rectangles without being
cut.
2.2.2
Analysis of the Original Rectangles
In this step we compute the loss of profit of the original rectangles. We built the wide
gap-rectangles at the space of the wide rectangles, the long gap-rectangles at the space
where the long rectangles have lain. We say that a rectangle belongs to a gap-rectangle,
if the rectangle intersects the space of this gap-rectangle. We treat the gap-rectangles
as bins, where rectangles lies. Consider that it is possible, that a rectangle belongs to
more than one gap-rectangles, with other words we cut the rectangles of the instance
by building the gap-rectangles. Then we put the gap-rectangles on a stack and rounded
them. In this step we cut the gap-rectangles and with this the containing rectangles again.
The objective is to compute at this moment an integral solution of the rectangles, while
they are in the gap-rectangles, while the gap-rectangles are lying on the stacks before
CHAPTER 2. LARGE OPTIMAL VALUE
26
eliminating the largest group.
After this step we put the gap-rectangles back into the solution and with this the integral
rectangles containing in the gap-rectangles. In this step we cut the gap-rectangles and
with this the rectangles containing in the gap-rectangles again, but we know the number
of gap-rectangles and with this we can estimate the loss of profit, when we discard the
new cutted rectangles.
The main problem is to create the integral solution. We take the fractional rectangles from
the gap-rectangles. Then we round the fractional rectangles by using the same rounding
technique like in Section 2.2.1.
We say, that we use m different width classes for it for a constant m. We cut the stack in
m + 1 parts and by eliminating the largest group there remain m groups. In this rounding
step we lose a small profit which depends on the optimal. After this step we repack the
fractional rounded rectangles into the gap-rectangles while the gap-rectangles are lying
on the stacks. Then we build so-called configurations and merge the fractional rectangles.
Notation 35. Let m := 1/δ2 be the different heights of the long and width of the wide
rectangles after rounding them.
Now we have the following lemma.
Lemma 36. In rounding the widths of the wide rectangles in m different widths and
discarding the largest group we lose a profit of at most A (L∗W ) · δ.
Proof. Consider the stack of the wide rectangles in m + 1 groups. Let hW be the height
of this stack. It is
A (L∗W ) ≥ hW · δ
because all rectangles have width of at least δ. Let Linf
W be the set of rounded rectangles
without the largest group.
We have
hW
∗
A Linf
W ≥ A (LW ) −
m+1
hW
≥ A (L∗W ) −
m
A
(L∗W )
≥ A (L∗W ) −
δ·m
A (L∗W ) · δ 2
∗
= A (LW ) −
δ
∗
= A (LW ) · (1 − δ) .
CHAPTER 2. LARGE OPTIMAL VALUE
27
With other words the remaining rectangles have profit of at least A (L∗W ) · (1 − δ) so we
lose a profit of at most A (L∗W ) · δ.
The proof for the long rectangles is analogous, so we have the following lemma.
Lemma 37. In rounding the heights of the long rectangles in m different heights we lose
a profit of at most A (L∗L ) · δ.
Similar to modifying the heights of the stacks with the gap-rectangles we can modify the
heights of the stacks with the original rectangles.
Lemma 38. We can modify the heights of the stacks so that they are a value i · mδ s for
i ∈ {1, . . . ,δ 1−s } by losing a profit of at most 4δ s−2
Proof. Analogous to Lemma 25.
After building the stacks we introduce the following notation for the different widths and
heights of the parts and the heights of the stacks.
Notation 39. Let hW be the height of the stack of wide rectangles and hL be the height of
the stack of long rectangles. Let w1 , . . . ,wm be the different widths of the wide rectangles
and h1 , . . . ,hm be the heights of the long rectangles.
Now we repack the fractional rectangles into the gap-rectangles while the gap-rectangles
lying on the stacks. Consider that we treat each block of gap-rectangles as one gaprectangle.
We draw a horizontal line at each bottom and top edge of each fractional rectangle. Each
strip defines a configuration of rectangles. The following technique is from the work [15].
Definition 40 (Configuration). A configuration Cil in block l of the stack with the gap
rectangles is a vector a1 , . . . ,a1/δ2 , where ai represents the number of rectangles of width
P1/δ2
wi , which are lying in this configuration. The width of a configuration is i=1
ai · wi .
Notation 41. Let q (l) the set of configurations with width less or equal than Wl , where
Wl is the width of the lth block of wide gap-rectangle (see Notation 21).
Now we minimize the number of configurations. We merge two equal configuration in the
same part of the gap-rectangles. With this there are just the topmost rectangles in each
configuration fractional. We show, that the minimal number of configurations is less than
2/δ 2 + 1 in the whole stack.
CHAPTER 2. LARGE OPTIMAL VALUE
28
Lemma 42. The minimal number of different configurations in one stack of gap-rectangles
is less than 2/δ2 + 1.
(l)
Proof. Consider the following Linear Program, where xi is the height
of
configuration
(l)
is the number
i ≤ ql in the block l of the stack with the wide gap-rectangles and a j,Ci
(l)
of rectangles of width wj in configuration Ci .
(l)
q
X
(l)
xi ≤
i=1
HW
K +1
∀l ∈ {0, . . . ,K}
hw
m+1
∀j ∈ {1, . . . ,m}
(l)
qi
K X
X
(l)
(l)
a j,Ci · xi =
l=0 i=1
(l)
xi ≥ 0
∀l ∈ {0, . . . ,K} and ∀j ∈ {1, . . . ,m}
This Linear Program fills the stack of the wide gap-rectangles.
Because the rank of the corresponding matrix is at most K + 1 + m a basic solution has at
most K +1+m non-zero values. With this we have less than K +m+1 = δ12 + δ12 +1 = δ22 +1
configurations in the solution.
The proof for the long rectangles is analogous. We get with this a result for creating an
integral solution of the original rectangles in the stack of the gap-rectangles.
Lemma 43. We can create an integral solution of rectangles in the stacks of the gaprectangles by losing a profit of at most 5δ s−2 .
Proof. In each stack, we have at most m + K + 1 = 2/δ2 different configurations. By deleting the topmost rectangles for each configuration we get from the fractional an integral
solution and we lose a profit for each configuration of at most δ s . Altogether, we lose for
each stack 2δs/δ2 + δ s and so for both stacks
4δ s/δ 2
+ 2δ s = 4δs/δ2 + 2δδ s−1 < 5δ s−2 .
In the next step we eliminate the largest group. We have already estimated the loss of
profit in this step. Then we repack the gap-rectangles and simplify the packing.
We have to eliminate for each new gap-rectangle the topmost rectangles, because we could
have cut them.
CHAPTER 2. LARGE OPTIMAL VALUE
29
Lemma 44. In creating an integral packing of the rectangles inside the packed gaprectangles we lose a profit of at most δ s/2+2 .
Proof. Because we have at most δ 2−s/2 gap-rectangles we lose
δ 2− /2 · δ s = δ /2+2
s
s
Altogether we have the following:
Theorem 45. We can modify an optimal solution, so that we have a discrete number of
heights and widths of the stacks for the long and wide gap-rectangles and heights of the
wide and long rectangles, where no rectangles intersect in two different gap-rectangles by
losing a total profit of A (L∗W ∪ L∗L ) δ + 3 · δ.
Proof. We will prove this step by step. In the first step we put the gap-rectangles on a
stack and part this stack for rounding the gap-rectangles. The long and wide rectangles
which are inside the gap-rectangles are stacked on similar stacks. We eliminate the largest
group of the original rectangles and lose a profit of at most
A (L∗W ∪ L∗L ) · δ
(see Lemma 36 and Lemma 37). After this we can round the remaining heights of these
stacks so that they are of the form i · m · δ s for i ∈ {1, . . . ,δ 1−s }. We lose in this step a
profit of at most
4δ s−2
(see Lemma 38).
After repacking the original rectangles into the gap-rectangles, we built an integral solution. We have seen, that we are able to create an integral solution of the rectangles while
they are packed into the stacked gap-rectangles by losing a profit of at most
5δ s−2
(see Lemma 43).
After this step we eliminate the largest groups of the gap-rectangles by losing a profit of
at most
2δ
CHAPTER 2. LARGE OPTIMAL VALUE
30
(see Lemma 22).
Then we round the heights and widths of the stacks of the gap-rectangles, by losing a
profit of
2 · Kδ s + 2 · K 0 δ s + 4δ s−1 = 4 · δ s−2 + 4δ s−1 ≤ 4 · δ s−2 + δ s−2 = 5δ s−2
(see Lemma 23, Lemma 24 and Lemma 25).
We repack the gap-rectangles and merge some of them. We can estimate after this step
the number of gap-rectangles in it. In repacking the gap-rectangles we cut the original
rectangles in the gap-rectangles again. We lose a profit of at most
δ /2+2
s
by deleting the cut rectangles (see Lemma 44).
Altogether we lose
A (L∗W ∪ L∗L ) δ + 4δ s−2 + 5δ s−2 + 2δ + 5δ s−2 + δ /2+2 .
s
We can add some of the terms with δ s−2 and get
4δ s−2 + 5δ s−2 + 5δ s−2 = 14δ s−2 .
Because δ < 1/14 we can bound this term by 14δ·δ s−3 ≤ δ s−3 . Furthermore is s−3 > s/2 +2,
because s > 10 and so
s
s
δ s−3 + δ /2+2 < 2δ /2+2 < δ.
It follows, that the loss of profit is less than
A (L∗W ∪ L∗L ) · δ + 3δ
and with this the assumption.
This closes the analysis and the modification of this optimal solution. Now we have
a solution with a bounded number of long and wide gap-rectangles. The number of
fat rectangles is also bounded so that we have a solution with a constant number of
fat rectangles. The gap-rectangles are like bins where we have packed the long and wide
rectangles. When we know the number and the heights and widths of these gap-rectangles
we can pack each gap-rectangle with long or wide rectangles. Because we modified the
heights and widths of these gap-rectangles it is possible to try a constant number of
CHAPTER 2. LARGE OPTIMAL VALUE
31
different possibilities for computing these gap-rectangles. We will start with these steps
in the next section, where we start with guessing the structure of an optimal solution.
2.3
Guessing the Structure
In the last section we modified an optimal solution to get a discrete structure. We built
gap-rectangles as placeholders for the wide and long rectangles, and we modified them
so that we have a constant number of them. In the next step we change the point of
view. Instead of modifying an optimal solution we want to rebuild it. Because we have a
constant number of gap-rectangles and fat rectangles it is possible to guess the structure
of the package of the gap-rectangles, what means we try every possibility. In the first step
we guess the fat rectangles which are in the optimal solution.
1
Lemma 46. There are less than n δ2 +1 possibilities for selecting the fat rectangles in L∗F .
Proof. Because the width and height of each rectangle is larger than δ we have at most
1/δ 2 fat rectangles in the solution. There are n possibilities to choose k items from n.
k
Altogether we have
2
2
1/δ X
n
k=0
k
≤
1/δ
X
nk
k=0
1/δ 2 +1
≤
n
−1
n−1
≤ n /δ
1
2 +1
possibilities.
We can try all possibilities for selecting the fat rectangles. In the next step we guess the
heights and the widths of the stacks of the gap-rectangles.
2
2
Lemma 47. There are n δ3 + δ2 · ( δ1s + 1) · (2δ 1−s + 1) possibilities for guessing the widths
of the wide gap-rectangles, the heights of the long gap-rectangles and the heights of the
stacks.
Proof. From Lemma 23 and Lemma 24 we know that the width and the height respectively from the part j is of the form kj + iδ s , where kj is the sum of widths of a set of
wide rectangles and heights of long rectangles respectively and i ≤ 1/δs an integer. For
computing the value kj we have to select at most 1/δ wide rectangles and sum up their
CHAPTER 2. LARGE OPTIMAL VALUE
32
widths. To select k rectangles of n we have nk possibilities. Altogether, we have almost
the same proof as in Lemma 46. With this we have
1/δ X
n
k=0
k
≤ n /δ+1
1
possibilities. Altogether we have
n /δ+1
1
2/δ2
2
2
= n δ3 + δ2
possibilities for computing all widths and heights of the gap-rectangles. For guessing the
integer i we have 1/δs + 1 possibilities.
From Lemma 25 we know the stacks have heights of the form i · Kδ s = i · δ s−2 for
i ∈ {0, . . . , δs+11 ·K }. With other words we have δ 1−s + 1 possibilities for guessing the height
of one stack.
Altogether we have
2
2
1
+
n δ3 δ2 ·
+ 1 · (2δ 1−s + 2)
s
δ
possibilities.
Now we have the fat rectangles the widths of the wide gap-rectangles and the heights of
the long gap-rectangles and the total heights of the stacks and with this the heights of each
part of the stack. Now we want to guess the structure of the optimal solution. Because
we have just a constant number of rectangles in the solution we can try all possibilities.
3/δs/2 +6/δ4 +1
Lemma 48. There are less than δ22
possibilities for all sets Ri and Ti of
gap-rectangles or fat rectangles which start at the top and at the right side of a fat or
gap-rectangle gi .
Proof. First of all we guess the rectangle which is in the lower left corner of the bin. There
are at most δ22 + δ12 = δ32 possibilities, because we have δ12 different wide gap-rectangles
and long gap-rectangles and δ12 different fat rectangles.
From this rectangle we guess the gap-rectangles which are at the right side of this rectangle
and on the top of this rectangle. If we have a wide gap-rectangle or a fat rectangle there
could start at most 1δ · δ22 long gap-rectangles and 1δ wide gap-rectangles or fat rectangles
P2/δ2 +1/δ 2
1 i
on top of this rectangle. We have altogether less than i=0
+
possibilities.
2
2
δ
δ
The same number of possibilities holds for the gap-rectangles which start at the right side
of each long gap-rectangle or fat rectangle.
At the right side of each wide gap-rectangle is a long gap-rectangle or fat rectangle so the
CHAPTER 2. LARGE OPTIMAL VALUE
33
different possibilities are δ12 + δ12 . The same holds for the top of each long gap-rectangle.
We do this step for all neighbours of the first rectangle and so on. We have
3
i δX
i
3 −2 X 2
3
1
+ 2 ≤
2
δ
δ
δ2
i=0
i=0
3
3 3/δ −1
−1
2
≤ δ 3
−1
δ2
3/δ3 −1
3
≤
δ2
2/δ 3 +1/δ
possibilities for guessing the neighbourhood of a gap-rectangle and hence we have for all
gap-rectangles less than
3
δ2
3/δ2 −1
1
1
+ 2+ 2
δ
δ
!
1
s
δ /2−2
=
3
δ2
3/δ2 −1
2
+ 2
δ
!
1
s
δ /2−2
1
3/δ2 ! δs/2−2
3
≤
δ2
s3/2
3 δ
=
δ2
possibilities.
P2/δ3 +1/δ
For the fat rectangles we have at the top and at the right side less than i=0
possibilities. So we have for all fat rectangles less than
2
δ2
3/δ2 −1 ! δ22
2
δ2
+
1 i
2
δ
3/δ2 ! δ22
2
≤
δ2
6/δ4
2
=
δ2
possibilities for computing the neighbours.
In using this guessing step we have altogether
2
·
δ2
3
δ2
3/δs/2 6/δ4 3/δs/2 +6/δ4 +1
2
2
·
≤
2
δ
δ2
possibilities.
Now we know the structure of the packing, the heights of the long gap-rectangles and
CHAPTER 2. LARGE OPTIMAL VALUE
34
the widths of the wide gap-rectangles. We have to compute the height of each wide gaprectangle and the width of each long rectangle.
Therefore we use a Linear Program. We use for each gap-rectangle gw ∈ GW three
variables xw , yw , hw which are the x and y coordinate and the height of this gap-rectangle,
for each long gap-rectangle gl ∈ GL we use xl ,yl ,wl where wl stands for the width of this
gap-rectangle. For the fat rectangles rf ∈ LF we use two variables xf ,yf for the position.
xi − xw ≥ Ww
∀gi ∈ Rw and gw ∈ GW
xi − xw ≥ wf
∀gi ∈ Rf and rf ∈ L∗F
xi − xl − wl ≥ 0
∀gi ∈ Rl and gl ∈ GL
yi − yw − hw ≥ 0
∀gi ∈ Tw and gw ∈ GW
y i − y l ≥ Hl
∀gi ∈ Tl and gl ∈ GL
yi − yl ≥ hf
∀gi ∈ Tl and rf ∈ L∗F
xl + wl ≤ 1
xw ≤ 1 − Ww
∀gw ∈ GW
xf ≤ 1 − wf
∀rf ∈ L∗F
yw + hw ≤ 1
X
∀gl ∈ GL
∀gw ∈ GW
y l ≤ 1 − Hl
∀gl ∈ GL
yf ≤ 1 − hf
∀rf ∈ L∗F
hw = HW/K+1
∀i ∈ {1, . . . ,K}
wl = HL/K 0 +1
∀i ∈ {1, . . . ,K 0 }
gw ∈GWi
X
gl ∈GLi
0 ≤ xi ,yi ,hi ,wi ≤ 1
This program computes the positions of all gap-rectangles and fat rectangles, and the
heights of each wide gap-rectangle and the width of each long gap-rectangle.
2.4
Selecting Rectangles and Filling the Gap Rectangles
After guessing the structure of the gap-rectangles of an optimal solution we have to fill
the gap-rectangles. In the analysis of the rectangles of an optimal solution we rounded
CHAPTER 2. LARGE OPTIMAL VALUE
35
the widths and the heights respectively of the rectangles by using the round algorithm
in Section 2.2.1. We have to guess the structure of the stacks used by this round algorithm containing the wide and long rectangles. We do this step similar to guessing the
structure of the stacks of the wide and long gap-rectangles. The main difference here is
that we have to guess just one rectangle for each width and height class in contrary to
the gap-rectangles which could contain more than one rectangle.
After this step we compute the configurations for packing the rectangles into the gaprectangles. It is sufficient that we have at most δ22 different configurations and the rectangles are all covered up, for repacking them. For this step we will use a modified Kenyon/Rémila [17] algorithm like in [12].
2
Lemma 49. There are n2/δ · 2δ 1−s + 1 possibilities for the widths of the stack with the
wide rectangles, the heights of the long rectangles and for the heights of the stacks.
Proof. The proof is almost analogous to the proof of Lemma 47. The main difference is,
that we have to select just one rectangle for each width and height class instead of 1δ . So
we have at most n1/δ possibilities for selecting the rectangles which represent a class. The
heights hW and hL of the stacks can be computed analogous to Lemma 47.
After guessing the heights and the widths of the stacks, we have to fill them.
Lemma 50. We can select a set of wide and long rectangles with a profit of at least
A(L∗L ) + A(L∗W ) − 2 · δ s−2
Proof. We order the wide rectangles by width and pack the stack with a Next-Fit algorithm.
For each part of the stack we select rectangles which have a width less or equal than the
width of this part. We fill the part of the stack with the rectangles. Because we sorted
the rectangles by width it is not possible to get more profit into this part, but at the
top we have some remained space, where we lose some profit. This profit is bounded by
δ s , because each rectangle has height at most δ s and if there would remain more space,
another wide rectangle would fit into this space. If there is no wide rectangle left we
selected all rectangles and with this the optimal subset.
So we lose profit just in the topmost strip of width δ s . Hence we lose at most
m · δs =
1 s
· δ = δ s−2
2
δ
profit in contrary to the optimal solution. The selection of the long rectangles is analogous.
CHAPTER 2. LARGE OPTIMAL VALUE
36
After selecting the long and wide rectangles we have to compute configurations to pack
these rectangles into the gap-rectangles. We will do this with the same Linear Program as
in the proof of Lemma 42. After packing the rectangles into the stack of the gap-rectangles
we have to cut them in the number of gap-rectangles and for each configuration we have
to eliminate the cutted rectangles. Because we already estimated the loss of profit in
Section 2.2, we can start with packing the slim rectangles.
2.5
Packing the Slim Rectangles
Now we have to pack the slim rectangles. Consider, that the slim rectangles are packed into
the gap-rectangles and into the remaining space between them. The first step therefore is
to compute the remaining free space in the gap-rectangles and the remaining space where
no gap-rectangles lies. Then we use a Knapsack algorithm to select them.
Lemma 51. We can select slim rectangles with a profit of at least (1 − ε0 ) · A(L∗S ) − 3δ 2s .
Proof. The remaining space in the solution containing the fat, long and wide rectangles
is an upper bound for A(L∗S ). So we have to select the slim rectangles in contrary to
the remaining space. Let A be this space. Create an instance for a Knapsack algorithm
where we set an item for each slim rectangle, which has the size equal to the area of
this slim rectangle. The capacity of the knapsack is A. There exists a FPTAS for the
Knapsack problem [18], which we use with a precision of ε0 . After computing the set of
slim rectangles we have to partition it into three groups. The rectangles in the first group
have to be packed into the remaining space of the wide gap-rectangles, the second group
will be packed into the remaining space of the long gap-rectangles and the third group will
be packed into the remaining space of the bin. We lose three rectangles for this partition
and with this a profit of at most 3δ 2s .
We will pack the slim algorithm with a modified Next Fit Decreasing Height algorithm [4].
It is a 3·OPT algorithm for the Strip Packing problem. We can give here another analysis
of this algorithm, because we have just slim rectangles to pack here. The modification is,
that we use more than one area where we pack the rectangles.
The algorithm is:
1. Sort the rectangles by height.
2. Repeat the following steps for all defined areas.
CHAPTER 2. LARGE OPTIMAL VALUE
37
(a) Draw a groundline at the border of the area.
(b) Pack the slim rectangles rightmost of the groundline, until the next rectangle
does not fit.
(c) Draw a new groundline at the top of the first, what means the highest rectangle
and repeat the last step until the height is exceeded.
Next we give a short analysis of this algorithm.
Lemma 52. Let A := {A1 , . . . ,Al } be a set of areas with heights Hi and widths Wi for
all i ∈ {1, . . . ,l}. The loss of profit for packing the slim rectangles with the modified Next
P
Fit Decreasing Height algorithm into these areas is less than δ s li=1 (Hi + 2Wi )
Proof. We assume that there are slim rectangles, which cannot packed into one of these
areas. Otherwise we can pack all slim rectangles and with this we have for this part an
optimal solution for the slim rectangles.
In the following steps we compute the remaining space in the areas. This is a bound for
the loss of profits.
At the right side of each area, we have a free space of at most δ s otherwise we could pack
there a slim rectangle because each slim rectangle has a width less or equal than δ s . We
have there a free space of at most δ s · Hi for all areas.
We sort in the first step of the algorithm the rectangles by height. Hence the height of one
level, that means the height of the first rectangle, is smaller or equal than the height of
the smallest rectangle in the previous level. That means each level covers the area of the
following level, except some space at the right side of at most δ s , what we have already
estimated above. With other words, the area of packed rectangles in each level is larger
than the total area of the following level. So we have covered in each area all levels but
the first and we lose with this an area of δ s · Wi for all areas. At the top of each area
could be also a free space of at most δ s .
Altogether we have a free space of at most
l
X
i=1
s
s
(δ · Hi + 2δ · Wi ) = δ
s
l
X
(Hi + 2Wi )
i=1
With this analysis we have just to define the areas where we pack the slim rectangles.
We will start with defining the areas in the wide gap-rectangles which is analogous to the
definition of the long gap-rectangles.
CHAPTER 2. LARGE OPTIMAL VALUE
(l)
38
(l)
(l)
Definition 53. For each configuration Ci with height xi and width wi define the area
(l)
(l)
(l)
(l)
Ai which is the free area on the right side. Hence Ai := Wl − wi × xi .
Pq(l) (l) For each block let A(l) := HW/K+1 − i=1
xi × Wl be the free space at the top of each
configuration.
After running the algorithm with these areas we can estimate the loss of profit.
Lemma 54. While packing the slim rectangles into the gap-rectangles we lose a profit of
at most 14δ s−2 .
Proof. The total height of the areas is bounded by 1δ , because the heights of the stacks
have at most this height. We have at most m + K configurations and K blocks. That
means we have m + 2K areas. Because the width of each area is less than 1 the total
width of all areas is less than m + 2K ≤ δ12 + δ22 = δ32 .
From Lemma 52 we know that the we lose a profit bounded by two times the sum of the
widths plus the sum of the heights of the areas times δ s . Hence we lose a profit bounded
by
3
1
7
s
+ 2 · 2 ≤ δs · 2 .
δ ·
δ
δ
δ
The same holds for the space in the long gap-rectangles by replacing the widths with
heights. With this we have a total loss of
2 · δs ·
7
= 14δ s−2 .
δ2
Now we have to pack the rectangles into the remaining space outside the gap rectangles
in the bin. We can estimate the total number of areas with free space, because we know
the number of rectangles which are already inside the bin.
Lemma 55. The number of areas with free space in the bin is less than 8 · δ
4−s
2
Proof. Consider a bin with k rectangles. Draw at the height of the top edge and at the
bottom edge of each rectangle a horizontal line, until it hits another rectangle. The bin is
now completely separated in rectangular areas. We have at most 2k horizontal lines. Each
line, which was drawn at the bottom of one rectangle is the top edge of one rectangular
area and the bottom edge of two rectangular areas, at the left and at the right of the
rectangle. Each line at the top edge of a rectangle is the bottom edge of one rectangular
area and the top edge of two rectangular areas. The border of the bin is also a border
CHAPTER 2. LARGE OPTIMAL VALUE
39
edge of one rectangular area and the top wall a top edge of a rectangular area. So we
have 3k + 1 border and top edges of rectangles and so we have 3k + 1 ≤ 4k rectangular
free area.
4−s
There are at most δ12 fat rectangles in the solution (see Lemma 46) and δ 2 gap-rectangles
(see Lemma 34). With this we have at most
4·
4−s
1
+δ 2
2
δ
≤8·δ
4−s
2
rectangular areas with free space in the bin.
For the analysis of the loss of profit of these areas we estimate the widths and heights of
each area with 1. With this we have the following lemma.
Lemma 56. We lose a profit of at most 24 · δ
remaining gaps of the bin.
4+s
2
by packing the slim rectangles into the
4−s
Proof. We have at most 8·δ 2 rectangular areas in the bin with free area left (see Lemma
55). We know that the width and the height of each area is bounded by 1. So we have
with Lemma 52 a loss of profit of at most
δs · 8 · δ
4−s
2
· 3 = 24 · δ
4−s
2
· δ s = 24δ
4+s
2
.
Now we look on a summary for this section.
Theorem 57. We have a total profit of the slim rectangles of at least (1 − ε0 ) · A(L∗S ) − δ.
Proof. The selected slim rectangles by the Knapsack algorithm has a profit of at least
(1 − ε0 ) · A(L∗S ) − 3δ 2s (see Lemma 51). From Lemma 54 we know we lose a profit of at
most 14δ s−2 . The remaining slim rectangles are packed into the remaining gaps. We lose
CHAPTER 2. LARGE OPTIMAL VALUE
in this step an area of at most 24δ
4+s
2
40
(see Lemma 56). Altogether we have
A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 14δ s−2 − 3δ 2s
=A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 14δ s−2 − 3δ · δ 2s−1
≥A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 14δ s−2 − δ 2s−1
≥A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 14δ s−2 − δ s−2
=A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 15δ s−2
≥A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− 15δ · δ s−3
≥A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
− δ s−3
≥A(L∗S ) · (1 − ε0 ) − 24δ
4+s
2
−δ
=A(L∗S ) · (1 − ε0 ) − 25δ
4+s
2
4+s
2
≥A(L∗S ) · (1 − ε0 ) − 1δ.
With the slim rectangles we have packed all rectangles into the bin. We finish the analysis
of this part of the algorithm with a summary.
2.6
Summary
Altogether the Algorithm AOPT>ε31 is:
1. Guess the value δ, and with this s.
2. Partition the rectangles of L in fat, wide, long and slim rectangles and discard the
rectangles which are not in one of the partitions.
3. Guess the fat rectangles.
4. Guess the structure of the stacks for the wide and long gap-rectangles.
5. Guess the neighbourhood of each gap-rectangle and fat rectangle.
6. Solve the Linear Program in getting the heights of the width and the widths of the
height classes of the gap-rectangles and the exact positions of the gap-rectangles
and the fat rectangles.
CHAPTER 2. LARGE OPTIMAL VALUE
41
7. Guess the structure of the stacks for the wide and long rectangles.
8. Select the wide and long rectangles.
9. Compute configurations for packing the long and wide rectangles into the gaprectangles with a Linear Program.
10. Use a Knapsack algorithm for selecting the slim rectangles and partition them.
11. Fill the gap-rectangles and delete all cutted long and wide rectangles.
12. Pack the remaining slim rectangles into the gaps.
Because all guessing steps are polynomial in n, the length of the instance, we have a
polynomial run time algorithm. The algorithm is not polynomial in 1/ε, but we already
showed, that if we would have such an algorithm we would have shown that we have an
(FPTAS) and so P = N P. The total loss of profit is given in the next theorem.
Theorem 58. If OPT ≥ ε31 we have a total profit of at least (1 − ε)OPT
Proof. We will start with the loss by modifying the optimal solution. From Theorem 45
we know we lose a total profit of
A(L∗W ∪ L∗L ) · δ + 3δ
for modifying the optimal solution. On the other hand the selected long and wide rectangles have a profit of at least
A(L∗L ) + A(L∗W ) − 2δ s−2 ≥ A(L∗L ) + A(L∗W ) − δ = A(L∗W ∪ L∗L ) − δ
(see Lemma 50). With this the total profit of the wide and long rectangles in the solution
is at least
A(L∗W ∪L∗L )−δ −A(L∗W ∪L∗L )·δ −3δ = (1−δ)·A(L∗W ∪L∗L )−4δ > (1−ε0 )·A(L∗W ∪L∗L )−4δ.
The total profit of the slim rectangles is at least
A(L∗S ) · (1 − ε0 ) − δ
(see Theorem 57) and we select all fat rectangles of L∗F in Lemma 46 and have with this
a profit of
A(L∗F ) ≥ (1 − ε0 ) · A(L∗F ).
CHAPTER 2. LARGE OPTIMAL VALUE
42
Furthermore we discarded the rectangles of L∗k in Section 2.1. The optimal profit is
A(L∗ ) = A(L∗F ) + A(L∗L + A(L∗W ) + A(L∗S ) + A(L∗k )
and hence the output of our algorithm is larger than
(1−ε0 )·A(L∗W ∪L∗L )−4δ+A(L∗S )·(1−ε0 )−δ+(1−ε0 )·A(L∗F )−A(L∗k ) > (1−ε0 )·A(L∗ )−5δ−2A(L∗k ).
In using Lemma 16 we have
2A(L∗k ) ≤ 2 ·
ε0
A(L∗ ) = A(L∗ ) · ε0
2
and with this
(1 − ε0 ) · A(L∗ ) · −2A(L∗k ) − 5δ ≥ (1 − 2ε0 ) · A(L∗ ) − 5δ.
We set ε0 in Notation 15 to a value less or equal than ε/4. It follows, that
ε
.
A(L∗ ) · (1 − 2ε0 ) ≥ A(L∗ ) · 1 −
2
With the definition of the value δ in Section 2.1 and because ε0 ≤ 1/2 we know that
5δ < 5
ε 12/ε0 +8
4
≤5
ε 32
4
<
1 32
·ε .
2
With the condition, that A(L∗ ) ≥ ε31 we have
1 32 ε 32 ε
· ε = · ε ≤ · A(L∗ )
2
2
2
and with this
ε
ε
ε
(1 − ) · A(L∗ ) − 5δ ≥ (1 − ) · A(L∗ ) − · A(L∗ ) = (1 − ε) · A(L∗ ).
2
2
2
We have seen that we can modify an optimal solution of an instance. At this step we lose
some profit, which can be estimated. We have with this a solution which can be guessed
by our algorithm, because we have just a fixed number of rectangles in the new solution.
By selecting the rectangles we lose again some small profit. This profit has just some
affect, if the value of this optimal solution is very small.
Chapter 3
Small Optimal Value
In this section we have to deal with a small optimal profit that means OPT < εc . In the
first moment it seems easy to compute a solution, because just a small area of the bin is
filled with rectangles. But we will see some instances which are difficult to compute.
We will start with analysing an optimal solution and modifying this solution to a discrete
structure. After this step our algorithm guesses this structure and computes with a Linear
Program the positions of the rectangles. The rectangles will be selected with a greedy
algorithm.
3.1
Analysis of the Optimal Solution
The most difficult instances are, if we have very long and very wide rectangles, because it
could be that we cannot modify an optimal solution. For example if one wide rectangle
have to lie at the lower left corner, one long rectangle lies at the right side and one
on the top at the left side of this rectangle and another wide rectangle lies above the
long rectangle at the right side (see Figure 3.1). Furthermore, there could be many
different solutions which are unique except symmetry (see Figure 3.2). By eliminating
one rectangle it is possible that we lose a too large amount. The optimal solution could
have more constructions of the above described solution (see Figure 3.2), so it is rather
hard to compute them. If we have just items with a small width or height, we can pack
them for example with a Next Fit algorithm. So we have to consider that we have an
optimal solution which contains wide and long rectangles. In the first step, we partition
the instance in three different sets. Instead of eliminating one group like we did in the
part with the large optimal value we keep all rectangles.
43
CHAPTER 3. SMALL OPTIMAL VALUE
Figure 3.1: An optimal solution with long and wide rectangles
Figure 3.2: An optimal solution with long and wide rectangles
Definition 59. We partition the set of rectangles in
• LS := {ri ∈ L|wi ≤ 1 − 3εc/2 ∧ hi ≤ 1 − 3εc/2 } called slim rectangles,
• LW := {ri ∈ L|wi > 1 − 3εc/2 } called wide rectangles and
• LL := {ri ∈ L|hi > 1 − 3εc/2 } called long rectangles.
44
CHAPTER 3. SMALL OPTIMAL VALUE
45
This is a partition, because there exist no rectangle in LW ∩ LL , since it would have profit
larger than εc .
Consider now an optimal package which contains only the rectangles in L∗W ∪ L∗L .
We want to simplify the structure of the package. Because we have rectangles with a large
width and rectangles with a large height in the package we can shove the rectangles so
that they lie near to the wall of the bin. We want a rectangular free space in the middle
of the bin with width and height of 1 − 2εc/2 . Into this area we will pack the rectangles of
LS later. We can pack the rectangles of L∗W ∪ L∗L into the frame around the bin of width
εc/2 .
Lemma 60. We can modify the structure of the optimal package, so that all wide and
long rectangles lying parallel to the wall of the bin in a distance of at most εc/2 that means
that the wide rectangles have an y-coordinate less than εc/2 or larger than 1 − εc/2 . The
long rectangles have an x-coordinate less than εc/2 or larger than 1 − εc/2 .
Proof. Consider that the total height of all wide rectangles are smaller than εc . The same
is with the width of all long rectangles, otherwise we would have a profit larger than the
optimum.
There could lie either long or wide rectangles in the bin with a distance of more than
1 − 3εc/2 to its parallel walls, because otherwise they would overlap. These rectangles
could be shoved to one side of the bin, so that they all have a distance smaller than εc/2
to a wall. Assume, that this is not possible, then they would have a profit of more than
εc and this is a contradiction to the assumption that we have a total profit of less than
this amount.
Lemma 61. There exists a structure of the optimal package, so that there is no wide
rectangle between a wide rectangle with a larger width and the nearest parallel wall and
that there is no long rectangle between a long rectangle with a larger height and the nearest
parallel wall.
Proof. From Lemma 60 we know that all rectangles could be packed at the outsides of the
bin, that means in the frame of width εc/2 around the bin. Let ri ,rj ∈ L∗W be rectangles
which are lying at the same side of the bin and with width wi > wj . Furthermore is rj
lying at the outside of the bin, with other words | 12 − yi | < | 12 − yj | then we can exchange
the positions of these rectangles.
The rectangle ri has to fit at the position of xj , because all long rectangles, which are
lying at the left and right sides of rj lying also on the left and right sides of ri since the
CHAPTER 3. SMALL OPTIMAL VALUE
46
distance |yi − yj | < εc/2 and the rectangles on each side are rectangles of L∗L which have
height larger than 1 − 3εc/2 . Hence there is enough space for ri (see Figure 3.3). We can
successively exchange the positions of the rectangles, so that the wide rectangles lying at
the outsides of the bin. The same can be done for the long rectangles.
Figure 3.3: Changing the positions of wide rectangles
Now we have modified the structure of the optimal solution but we can still have a difficult
package of the rectangles like for example in Figure 3.4. The next target is to round the
widths and heights of the wide and long rectangles. For this we take a constant number
of rectangles with the largest profits from the solution, because we lose in the rounding
step some rectangles and we want to ensure that the profit of these rectangles we lose is
small. The remaining rectangles will be put on stacks and the widths and heights will
be rounded with the rounding algorithm in Section 2.2.1. We define now a set for the
rectangles with the largest profit and a value m which represent the number of rounded
widths and heights in the solution.
Notation 62. Let m be the smallest integer with m ≥
Definition 63. Let L∗B be the set with the
profit.
12m
ε
4
.
(1−3εc/2 )ε
rectangles from L∗L ∪ L∗W with the largest
If there are less than 12m
long and wide rectangles in the solution we can compute an
ε
optimal solution of these rectangles by trying all possibilities.
Now we can estimate the profit of the remaining rectangles of L∗L ∪ L∗W .
Lemma 64. Each rectangle of (L∗L ∪ L∗W ) \ L∗B has a profit of at most
Proof. Assume a rectangle rj ∈ (L∗L ∪ L∗W ) \ L∗B has profit larger than
ε
A(ri ) ≥ 12m
OPT for all ri ∈ L∗B it is
X
ri ∈L∗B
A(ri ) + A(rj ) ≥
ε
OPT.
12m
ε
OPT.
12m
12m
ε
+1 ·
OPT > OPT.
ε
12m
Because
CHAPTER 3. SMALL OPTIMAL VALUE
47
Figure 3.4: A hard to computing optimal solution
This is a contradiction.
Thus the remaining rectangles have profit less than
ε
OPT.
12m
Altogether we get the following result.
Theorem 65. We can modify the solution, that all wide and long rectangles lying at
the outsides of the bin, where the rectangles getting smaller and shorter respectively to
the middle of the bin and we can round the widths and heights of these rectangles, but
12m
rectangles of largest profit, to m widths and heights, with losing a profit of at most
ε
5/6 · ε · OPT.
Proof. From Lemma 60 and Lemma 61 we can modify the structure of the optimal package
with long and wide rectangles, so that all rectangles are lying at the outsides and getting
smaller or shorter to the middle of the bin.
Put the wide and long rectangles which are not in L∗B on stacks sorted by width and
height respectively. We round up the widths of the wide rectangles on the stack and the
heights of the long rectangles on the other stack. This procedure is similar to the round
algorithm in Section 2.2.1.
Split up the stack in m + 1 parts of height H/m+1, where H is the height of this stack.
We split at most m rectangles. We discard these rectangles from the solution and losing
ε
OPT because each rectangle has a profit of less than 12m
OPT
a profit of at most m 12m
ε
(see Lemma 64). We round up the width of each rectangle to the width of the widest
CHAPTER 3. SMALL OPTIMAL VALUE
48
rectangle in each part of the stack. We discard the group with the largest width from the
solution, hence the remaining rounded rectangles still fit into the bin. We lose a profit of
H/m+1
< H/m ≤
H
4
(1−3εc/2 )ε
=
H(1 − 3εc/2 )ε
OPT · ε
≤
,
4
4
because the optimal value is larger than the height of the stack times (1 − 3εc/2 ).
Now we can repack the rounded rectangles fractional. We pack the rectangles at the space
of the rectangles in the next larger class. Consider that the rectangles in the solution are
sorted by width and height respectively that means the wider and higher rectangles are
at the outsides. With other words the rectangles of each class are on top of each other
in at most two different parts. For the wide rectangles there could be rectangles of the
same class lying at the top of the bin or at the bottom of the bin. We can repack the
rectangles at the place where the rectangles of the next larger class have been with losing
ε
OPT by discarding
just one rectangle for each class. We lose a profit of at most m 12m
these splitted rectangles.
It could be that a rectangle of L∗B lies at some area, where rectangles of one class will
be packed. But the rectangles of the class have to be smaller than the rectangle of L∗B ,
because the wide rectangles are smaller than the rectangles, which are packed at the same
place before which are now in the next wider group. The main point is, that it is possible
to resort the rectangles and shove the rectangle to the outside at the position, where the
widest rectangle of the class has lain and with this lying the rectangles of the class on top
of each other.
The same can be done for the long rectangles. Altogether we lose
2·
OPT · ε OPT · ε OPT · ε
+
+
4
12
12
5
= εOPT
6
We have seen that we can modify the optimal solution to a solution where we have to
deal with 4m + 12m/ε rectangles, if we merge the rectangles of the same width and height
class, which are at the same side. For this merging step we give some definitions.
Definition 66 (Rectangle Classes). We define new rectangles which represent one class
of rectangles at each side of the bin,
• {rt1 , . . . ,rtm } are wide rectangles, where rti stands for the rectangle representing the
ith width class which are packed at the top of the bin,
CHAPTER 3. SMALL OPTIMAL VALUE
49
• {rb1 , . . . ,rbm } are the wide rectangles representing the width classes at the bottom of
the bin,
• {rl1 , . . . ,rlm } are the long rectangles representing the height classes at the left side
of the bin and
• {rr1 , . . . ,rrm } are the long rectangles representing the height classes at the right side
of the bin.
The height of the new wide rectangles are the sum of the heights of the rectangles corresponding to the width class and the side of the bin, and the width of the new rectangles is
the width of width class. For the long rectangles is this vice versa. If there is a class, in
which no rectangle is at one side of the bin, we treat the new wide rectangle with height
and the new long rectangle the width equals to zero. We have also sets T op, Btm, Lf t, Rgt
containing the new rectangles and the rectangles of L∗B which are at the top, bottom, left
and right side of the bin without the new rectangles with width and height equals to zero.
Now we need a notation for the structure of the package. For this we can assume that
we draw a horizontal line at the top and border edge of each wide rectangle and count
the long rectangles which intersecting these lines and we draw vertical lines at the right
and left edge of each long rectangle and count all wide rectangles which are intersecting
them. With these sets we can compute the whole solution.
Definition 67 (Structure). Let Lk ⊆ {rl1 , . . . ,rlm ,rr1 , . . . ,rrm } and Bk ⊆ L∗B be the long
rectangles which are intersecting the same y-coordinates at the right or left side of a wide
rectangle rk for k ∈ {t1 , . . . ,tm ,b1 , . . . ,bm }. That means, that this is a set of long rectangles
intersecting an y-coordinate between yk and yk + hk .
Furthermore let Wk ⊆ {rt1 , . . . ,rtm ,rb1 , . . . ,rbm } and Bk ⊆ L∗B be the wide rectangles
which are intersecting the same x-coordinates at the top or below a long rectangle rk ∈
{rl1 , . . . ,rlm ,rr1 , . . . ,rrm }. That means, that this is a set of wide rectangles intersecting an
x-coordinate between xk and xk + wk .
Let Lbi ⊆ {rl1 , . . . ,rlm ,rr1 , . . . ,rrm } and Bbi ⊆ L∗B be the long rectangles which are intersecting the same y-coordinates at the right or left side from a wide rectangle ri ∈ L∗B ,
analogous let Wbi ⊆ {w1 , . . . ,w2m } and Bbi ⊆ L∗B be the rectangles at the top or below a
long rectangle bi ∈ L∗B .
These definitions describes the whole structure of this modified optimal solution. We
have defined new rectangles, which stand for the classes of rectangles. We merged the
rectangles of the same class at the same side of the bin. Now we have a solution with a
CHAPTER 3. SMALL OPTIMAL VALUE
50
constant number of rectangles.
In the next section we have to guess these sets. From these sets we can compute the
whole structure of the package. That means we finish the analysis of an optimal solution
and start with rebuilding the modified solution.
3.2
Rebuild the Optimal Solution
Now we want to rebuild the structure of this optimal solution. For this we have to guess
the 12m/ε rectangles with the largest profit, then we have to guess the widths of the m
width classes and the heights of the m height classes from the proof of Theorem 65. Then
we guess the structure of the package and compute the heights of the width classes and
the widths of the height classes at each side of the bin. If there are less than 12m/ε wide
and long rectangles in the optimal solution we guess them and guess the structure without
the classes. From this structure we can compute the optimal solution.
Lemma 68. There are less than n12m/ε+2m possibilities for selecting the set L∗B of the 12m/ε
rectangles with the largest profit and the rectangles which represent the widths and heights
of the classes.
Proof. To select a set of rectangles with less or equal than
without laying back we have
12m/ε+2m
X
k=0
12m/ε
+ 2m rectangles from n
12mX
/ε+2m
n
≤
nk
k
k=0
n12m/ε+2m+1 − 1
≤
n−1
12m/ε+2m+1
≤n
Now we have to guess the structure of the package. We have to guess which rectangles
are on the left and right side of each wide rectangle, and which rectangles are above and
below each long rectangle. From Theorem 65 we know that we have to deal with just
12m/ε rectangles with the original heights and widths, and with m wide rectangles at the
bottom and top of the bin and m long rectangles at the left and right side of the bin.
Altogether we have to deal with 4m + 12m/ε rectangles.
CHAPTER 3. SMALL OPTIMAL VALUE
51
12m/ε+1
Lemma 69. There are less than 32m · 212m/ε · (8m + 24m/ε)
the structure of the optimal solution.
possibilities for guessing
Proof. In the first step, we have to guess if a rectangle of each width class lies at the top
of the bin or at the bottom of the bin or both and if a rectangle of each height class lies at
the right or left side of the bin. It means that we have three possibilities for each width
and height class with this we have 32m possibilities.
A rectangle of L∗B can only lie at the bottom or at the top if it is a wide rectangle or at the
left or right side of the bin otherwise. For these rectangles we have just two possibilities.
Altogether we have 212m/ε possibilities, because we have 12m/ε rectangles in L∗B .
We guessed sets T op,Btm,Lf t,Rgt containing rectangles, which are lying at the top, at
the bottom, at the left and the right side of the bin.
Now we know which class of rectangles lies at each side of the bin. We know also that the
rectangles getting smaller to the middle of the bin, and with this we know already how
the rectangles are packed. What we not know is, which rectangles lies at each side of one
rectangle.
We want to guess the sets of Definition 67 with long rectangles which are lying at the left
and right side of each class i of wide rectangles lying at the bottom and top of the bin
and wide rectangles lying under and above each class i of long rectangles at the left and
right side. The same with the 12m/ε long and wide rectangles of L∗B .
Altogether we have less than 4m + 12m/ε sets in which we have 2m + 1 and 4m + 12m/ε sets
in which we have 12m/ε + 1 possibilities of different rectangles. With this we have less than
12m
(8m + 24m/ε) /ε+1 possibilities for computing the structure and hence we have altogether
less than
12m
12m
32m · 2 /ε · (8m + 24m/ε) /ε+1
possibilities.
Now we have guessed the structure of the package. That means, we have guessed the set
L∗B and we know at which side the rectangles of this set lie, furthermore we guessed the
width of each width class and the height of each height class. We also know from each
class, if there are rectangles at one side of the bin with the sets T op,Btm,Lf t,Rgt. We
know from each wide rectangle which long rectangles are at the left and right side of this
rectangle and for each long rectangle we know the wide rectangles below and above it in
the modified solution.
We do not know the heights of the width classes and the widths of the height classes. For
this we use a Linear Program. When we have these values we can compute a package of
these rectangles because we already know that the rectangles are smaller in the middle of
CHAPTER 3. SMALL OPTIMAL VALUE
52
the bin. The cost function is to maximize the widths of the height classes and the heights
of the width classes. As constraints we have that the rectangles still fits into the bin,
that all rectangles which are not at one side have width and height respectively equals to
zero and that all width classes have the same height and all height classes have the same
width.
The Linear Program is.
max ht1 + hb1 + wl1 + wr1
s.t.
X
wi ≤ 1 − wk −
ri ∈Lk
X
wi
∀k ∈ {t1 , . . . ,tm ,b1 , . . . bm }
hi
∀k ∈ {l1 , . . . ,lm ,r1 , . . . rm }
wi
∀ri ∈ L∗B ∩ LW
hi
∀ri ∈ L∗B ∩ LL
ri ∈Bk
X
hi ≤ 1 − hk −
ri ∈Wk
X
X
ri ∈Bk
wi ≤ 1 − ri −
ri ∈Lbi
X
ri ∈Bbi
X
hi ≤ 1 − ri −
X
ri ∈Bbi
ri ∈Wbi
hti = 0
/ T op
∀i ∈ {1, . . . ,m} ∧ rti ∈
hbi = 0
∀i ∈ {1, . . . ,m} ∧ rbi ∈
/ Btm
wri = 0
∀i ∈ {1, . . . ,m} ∧ rri ∈
/ Rgt
wli = 0
∀i ∈ {1, . . . ,m} ∧ rli ∈
/ Lf t
hti + hbi − hti+1 − hbi+1 = 0
∀i ∈ {1, . . . ,m − 1}
wli + wri − wli+1 − wri+1 = 0
∀i ∈ {1, . . . ,m − 1}
hi ≥ 0
∀i ∈ {t1 , . . . ,tm ,b1 , . . . ,bm }
wi ≥ 0
∀i ∈ {l1 , . . . ,lm ,r1 , . . . ,rm }
Now we have the structure of the solution with all positions and widths and heights of the
long and wide rectangles. In the next step we have to select the long and wide rectangles,
which are in the classes. We do this in a greedy manner.
Lemma 70. We select rectangles with a profit of A(L∗L ∪ L∗W ) − 6ε · OPT.
Proof. We select the wide and long rectangles for each of the m classes of the wide and
long rectangles.
First we have to delete the already selected rectangles of L∗B of the sets LL and LW , then
we sort all rectangles of LL by height and all rectangles of LW by width. Let rw1 , . . . ,rwm
CHAPTER 3. SMALL OPTIMAL VALUE
53
be the already guessed representative rectangles of the wide rectangles and rl1 , . . . ,rlm be
the representative rectangles of the long rectangles.
We build 2m sets of wide and long rectangles. Let for an i ≤ m
Wi := {ri ∈ LW |wwi < wi < wwi+1 }
and
Wwi := {ri ∈ LW |wi = wwi }
and for the long rectangles
Li := {ri ∈ LL |hli < hi < hli+1 }
and
Lli := {ri ∈ LL |hi = hli }
be the sets of wide and long rectangles. We have to partition these rectangles in this way,
because the rectangles of Wwi and Lli could be packed into the class i + 1 and into the
class i for i ∈ {1, . . . ,m − 1}. The rectangles of Wi and Li will be packed into the class i.
We sort in each set Wi the rectangles by width and in each set Li the rectangles by height.
The rectangles in Wwi will be sorted by height and the rectangles of Lli will be sorted by
width.
We pack each class separately, beginning with the largest class. We pack the rectangles of
Wwi or Lli respectively into the class i, then we pack the rectangles of Wi or Li respectively
into the class, if there is remaining space. If all rectangles of Wi or Li respectively are
packed and there is remaining space in the class, we will start packing rectangles of Wwi+1
or Lli+1 respectively.
If all rectangles of Wwi+1 or Lli+1 respectively are packed into the ith class we have selected
all possible rectangles and with this the largest possible profit of this part.
When the class is filled with rectangles and there remain rectangles we start packing the
next class with the remaining rectangles of Wwi+1 or Lli+1 respectively.
We lose at most one rectangle for each class, because we sorted the rectangles in a manner
that we select first the rectangles with the largest profit. There is a space left which is
ε
OPT (see Lemma
smaller than the next rectangle. Hence the space is smaller than 12m
64) this is the profit we lose in this class.
Altogether we have
ε
ε
2m ·
OPT = OPT.
12m
6
CHAPTER 3. SMALL OPTIMAL VALUE
54
We have packed the wide and long rectangles. There remain the slim rectangles. We
will pack them into the middle of the bin. That is possible, because we shoved all wide
and long rectangles to the outsides so that we have a free space in the middle of the bin.
We will pack all slim rectangles into the bin. Because we have a small total profit we
know that we can pack them all (see Lemma 71). We define three sets for packing them,
one set is for the wider slim rectangles one for the higher slim rectangles and one for the
remaining slim rectangles. We will pack the wider rectangles at the bottom of the bin
the higher at the right side and the remaining rectangles with NFDH into the remaining
space (see Figure 3.5).
Lemma 71. We pack all slim rectangles.
Proof. Part the rectangles of LS in three partitions. The first partition is the set with
the rectangles, which have a height hi ≥ εc/2 . The rectangles in the second partition have
heights less than hi < εc/2 , but widths wi ≥ εc/2 and the third partition are the remaining
rectangles.
The rectangles of the first partition can be packed into an area of εc/2 × (1 − 3εc/2 ), because
we can pack the long rectangles side by side into this area, if they would have a width
larger than εc/2 they would have filled a total area of more than εc .
The rectangles of the second partition can be packed into an area of (1 − 3εc/2 ) × (εc/2 ).
Because the rectangles have a width between εc/2 ≤ wi ≤ (1 − 3εc/2 ) we can stack them
on top of each other. They reach not the height with the same reason like in the case of
the first partition.
The remaining rectangles have width wi < εc/2 and height wi < εc/2 . We can pack these
rectangles into an area of (1 − 3εc/2 ) × 20εc/2 with NFDH. We can use the proof of Lemma
52. There is at the right side and on the top of the area a free space of at most εc/2 and
so we lose this amount. Because each level covers the area of the following level the space
is sufficient. If not we would have covered an area of
(1 − 4ε /2 ) · 18ε /2 > 18ε /2 − 16εc > 2ε /2 > OPT
c
c
c
c
This is a contradiction.
These areas can be packed into the middle of the bin, in packing the first area at the left
side, the second area right orientated at the bottom and the third area above the second
area (see Figure 3.5).
Now we have selected and packed all rectangles in each partition. We need just to sum
up the profits which we are losing and have already estimated.
CHAPTER 3. SMALL OPTIMAL VALUE
55
c
ε
c
2
ε2
c
2 · ε2
c
2 · ε2
Figure 3.5: All rectangles have width less than 1 − 3εc/2
Theorem 72. If OPT < ε31 the given algorithm computes a solution with profit of (1 −
ε) · OPT and has a run time polynomial in n
Proof. Because all guessing steps are polynomial in n and just exponential in ε the run
time is polynomial in the length of the instance.
From Theorem 65 we know we lose a profit of at most 5/6 · ε · OPT. We can pack all
rectangles of LS in Lemma 71 and lose no profit in this step. From Lemma 70 we know
that the selected long and wide rectangles have a profit of at least A(L∗L ∪L∗W )− 1/6 ·ε·OPT.
Altogether we have a profit of at least
A(L∗S ∪ L∗L ∪ L∗W ) − ε · OPT = (1 − ε)OPT.
This finishes the analysis of the algorithm. We have seen, that in each part we have a profit
of at least (1 − ε)OPT and a run time polynomial in the length of the instance. Hence
we have a polynomial time approximation scheme for the Two-Dimensional Geometrical
Knapsack problem where the profits of the rectangles equals their area.
Chapter 4
Conclusion
We presented a PTAS for the Two-Dimensional Geometrical Knapsack problem where the
area equals the profit of the rectangles. With other words, the objective was to maximize
the used area. We presented also, that there exists no FPTAS for this problem unless
P = N P, so it is not possible to find an algorithm which has a run time poynomial in the
precision. But the run time of this algorithm is very large in dependency of the precision,
so it is interesting if there exists a PTAS for this problem, where the run time is faster in
dependency of ε.
Another interesting question is to find a PTAS for the general Two-Dimensional Geometrical Knapsack problem. Our algorithm uses at several points that the profit equals
the area of the rectangles so it is necessary to create a completely different algorithm.
But maybe some of the techniques could be used, like defining the gap-rectangles. Our
algorithm could partially used for the variant where the profits of the rectangles are a
function in the area of the rectangles.
Another interesting variant of this problem is when the profits of all rectangles are 1.
The objective of this algorithm would be to maximize the number of rectangles. The fat
rectangles and rectangles with a large area are not useful for this problem, but the slim
rectangles. This is a completely different point of view.
We can assume other restrictions for this problem, for example that we have more assumptions on the kinds of rectangles. The instance could have just squares or just rectangles
with width larger than the height. Another interesting variant is that the rectangles could
be rotated. This variant is more difficult than axis parallel packing, because there exists
some solutions where the rectangles are rotated with some angle.
In the logistic it would be useful to find an algorithm, which solves the Three-Dimensional
Geometrical Knapsack problem. Instead of rectangles the instance is a set of cubes.
Maybe there is a way to use the techniques described in this work for this problem.
56
Bibliography
[1] B. S. Baker, A. R. Calderbank, E. G. Coffman, Jr., and J. C. Lagarias. Approximation
algorithms for maximizing the number of squares packed into a rectangle. SIAM
Journal on Algebraic and Discrete Methods, 4(3):383–397, 1983.
[2] A. Caprara, H. Kellerer, and U. Pferschy. The multiple subset sum problem. SIAM
Journal on Optimization, 11, 2000.
[3] C. Chekuri and S. Khanna. A PTAS for the multiple knapsack problem. In Symposium on Discrete Algorithms, pages 213–222, 2000.
[4] E. G. Coffman Jr., M. R. Garey, D. S. Johnson, and R. E. Tarjan. Performance
bounds for level-oriented two-dimensional packing algorithms. SIAM Journal of
Computing, 9(4):808–826, 1980.
[5] F. Diedrich, R. Harren, K. Jansen, R. Thöle, and H. Thomas. Approximation algorithms for 3d orthogonal knapsack. In Theory and Applications of Models of Computation, pages 34–45, 2007.
[6] M. R. Garey and D. S. Johnson. Computers and Intractability; A Guide to the Theory
of NP-Completeness. W. H. Freeman & Co., 1990.
[7] R. Harren. Approximating the orthogonal knapsack problem for hypercubes. In
33rd International Colloquium on Automata, Languages and Programming (ICALP),
volume 4051 of LNCS, pages 238–249. Springer, 2006.
[8] 0. H. Ibarra and C. E. Kim. Fast approximation algorithms for the knapsack and
sum of subset problems. Journal of the ACM, 22(4):463–468, 1975.
[9] K. Jansen. Parameterized approximation scheme for the multiple knapsack problem.
unpublished, 2008.
57
BIBLIOGRAPHY
58
[10] K. Jansen and R. Solis-Oba. New approximability results for 2-dimensional packing
problems. In Mathematical Foundations of Computer Science, volume 4708 of Lecture
Notes in Computer Science, pages 103–114. Springer, 2007.
[11] K. Jansen and R. Solis-Oba. A polynomial time approximation scheme for the square
packing problem. In Integer Programming and Combinatorical Optimization, pages
184–198, 2008.
[12] K. Jansen and R. Thöle. Approximation algorithms for scheduling parallel jobs:
Breaking the approximation ratio of 2. In International Colloquium on Automata,
Languages and Programming, pages 234–245, 2008.
[13] K. Jansen and G. Zhang. Maximizing the number of packed rectangles. In Scandinavian Workshop on Algorithm Theory, pages 362–371, 2004.
[14] K. Jansen and G. Zhang. On rectangle packing: maximizing benefits. In Algorithmica, volume 4, pages 323–342, 2007.
[15] N. Karmarkar and R. M. Karp. An efficient approximation scheme for the one
dimensional bin packing problem. In 23rd Annual Symposium on Foundations of
Computer Science, pages 312–320. IEEE Computer Society, 1982.
[16] R. Karp. Reducibility among combinatorial problems. In R. Miller and J. Tatcher,
editors, Complexity of Computer Computations, pages 85–103. Plenum Press, 1972.
[17] C. Kenyon and E. Rémila. A near optimal solution to a two-dimensional cutting
stock problem. Mathematics of Operations Research, 25:645–656, 2000.
[18] E. L. Lawler. Fast approximation algorithms for knapsack problems. Mathematics
of Operation Research, 4(4):339–356, 1979.
[19] I. Schiermeyer. Reverse-fit: A 2-optimal algorithm for packing rectangles. In Proceedings of the Second Annual European Symposium on Algorithms, pages 290–299.
Springer-Verlag, 1994.
[20] A. Steinberg. A strip-packing algorithm with absolute performance bound 2. SIAM
Journal of Computing, 26(2):401–409, 1997.