- Source: Strip packing problem
The strip packing problem is a 2-dimensional geometric minimization problem.
Given a set of axis-aligned rectangles and a strip of bounded width and infinite height, determine an overlapping-free packing of the rectangles into the strip, minimizing its height.
This problem is a cutting and packing problem and is classified as an Open Dimension Problem according to Wäscher et al.
This problem arises in the area of scheduling, where it models jobs that require a contiguous portion of the memory over a given time period. Another example is the area of industrial manufacturing, where rectangular pieces need to be cut out of a sheet of material (e.g., cloth or paper) that has a fixed width but infinite length, and one wants to minimize the wasted material.
This problem was first studied in 1980. It is strongly-NP hard and there exists no polynomial-time approximation algorithm with a ratio smaller than
3
/
2
{\displaystyle 3/2}
unless
P
=
N
P
{\displaystyle P=NP}
. However, the best approximation ratio achieved so far (by a polynomial time algorithm by Harren et al.) is
(
5
/
3
+
ε
)
{\displaystyle (5/3+\varepsilon )}
, imposing an open question of whether there is an algorithm with approximation ratio
3
/
2
{\displaystyle 3/2}
.
Definition
An instance
I
=
(
I
,
W
)
{\displaystyle I=({\mathcal {I}},W)}
of the strip packing problem consists of a strip with width
W
=
1
{\displaystyle W=1}
and infinite height, as well as a set
I
{\displaystyle {\mathcal {I}}}
of rectangular items.
Each item
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
has a width
w
i
∈
(
0
,
1
]
∩
Q
{\displaystyle w_{i}\in (0,1]\cap \mathbb {Q} }
and a height
h
i
∈
(
0
,
1
]
∩
Q
{\displaystyle h_{i}\in (0,1]\cap \mathbb {Q} }
.
A packing of the items is a mapping that maps each lower-left corner of an item
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
to a position
(
x
i
,
y
i
)
∈
(
[
0
,
1
−
w
i
]
∩
Q
)
×
Q
≥
0
{\displaystyle (x_{i},y_{i})\in ([0,1-w_{i}]\cap \mathbb {Q} )\times \mathbb {Q} _{\geq 0}}
inside the strip.
An inner point of a placed item
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
is a point from the set
i
n
n
(
i
)
=
{
(
x
,
y
)
∈
Q
×
Q
|
x
i
<
x
<
x
i
+
w
i
,
y
i
<
y
<
y
i
+
h
i
}
{\displaystyle \mathrm {inn} (i)=\{(x,y)\in \mathbb {Q} \times \mathbb {Q} |x_{i}
.
Two (placed) items overlap if they share an inner point.
The height of the packing is defined as
max
{
y
i
+
h
i
|
i
∈
I
}
{\displaystyle \max\{y_{i}+h_{i}|i\in {\mathcal {I}}\}}
.
The objective is to find an overlapping-free packing of the items inside the strip while minimizing the height of the packing.
This definition is used for all polynomial time algorithms. For pseudo-polynomial time and FPT-algorithms, the definition is slightly changed for the simplification of notation. In this case, all appearing sizes are integral. Especially the width of the strip is given by an arbitrary integer number larger than 1. Note that these two definitions are equivalent.
Variants
There are several variants of the strip packing problem that have been studied. These variants concern the objects' geometry, the problem's dimension, the rotateability of the items, and the structure of the packing.
Geometry: In the standard variant of this problem, the set of given items consists of rectangles.
In an often considered subcase, all the items have to be squares. This variant was already considered in the first paper about strip packing.
Additionally, variants where the shapes are circular or even irregular have been studied. In the latter case, it is referred to as irregular strip packing.
Dimension:
When not mentioned differently, the strip packing problem is a 2-dimensional problem. However, it also has been studied in three or even more dimensions. In this case, the objects are hyperrectangles, and the strip is open-ended in one dimension and bounded in the residual ones.
Rotation: In the classical strip packing problem, the items are not allowed to be rotated. However, variants have been studied where rotating by 90 degrees or even an arbitrary angle is allowed.
Structure:
In the general strip packing problem, the structure of the packing is irrelevant.
However, there are applications that have explicit requirements on the structure of the packing. One of these requirements is to be able to cut the items from the strip by horizontal or vertical edge-to-edge cuts.
Packings that allow this kind of cutting are called guillotine packing.
Hardness
The strip packing problem contains the bin packing problem as a special case when all the items have the same height 1.
For this reason, it is strongly NP-hard, and there can be no polynomial time approximation algorithm that has an approximation ratio smaller than
3
/
2
{\displaystyle 3/2}
unless
P
=
N
P
{\displaystyle P=NP}
.
Furthermore, unless
P
=
N
P
{\displaystyle P=NP}
, there cannot be a pseudo-polynomial time algorithm that has an approximation ratio smaller than
5
/
4
{\displaystyle 5/4}
, which can be proven by a reduction from the strongly NP-complete 3-partition problem.
Note that both lower bounds
3
/
2
{\displaystyle 3/2}
and
5
/
4
{\displaystyle 5/4}
also hold for the case that a rotation of the items by 90 degrees is allowed.
Additionally, it was proven by Ashok et al. that strip packing is W[1]-hard when parameterized by the height of the optimal packing.
Properties of optimal solutions
There are two trivial lower bounds on optimal solutions.
The first is the height of the largest item.
Define
h
max
(
I
)
:=
max
{
h
(
i
)
|
i
∈
I
}
{\displaystyle h_{\max }(I):=\max\{h(i)|i\in {\mathcal {I}}\}}
.
Then it holds that
O
P
T
(
I
)
≥
h
max
(
I
)
{\displaystyle OPT(I)\geq h_{\max }(I)}
.
Another lower bound is given by the total area of the items.
Define
A
R
E
A
(
I
)
:=
∑
i
∈
I
h
(
i
)
w
(
i
)
{\displaystyle \mathrm {AREA} ({\mathcal {I}}):=\sum _{i\in {\mathcal {I}}}h(i)w(i)}
then it holds that
O
P
T
(
I
)
≥
A
R
E
A
(
I
)
/
W
{\displaystyle OPT(I)\geq \mathrm {AREA} ({\mathcal {I}})/W}
.
The following two lower bounds take notice of the fact that certain items cannot be placed next to each other in the strip, and can be computed in
O
(
n
log
(
n
)
)
{\displaystyle {\mathcal {O}}(n\log(n))}
.
For the first lower bound assume that the items are sorted by non-increasing height. Define
k
:=
max
{
i
:
∑
j
=
1
k
w
(
j
)
≤
W
}
{\displaystyle k:=\max\{i:\sum _{j=1}^{k}w(j)\leq W\}}
. For each
l
>
k
{\displaystyle l>k}
define
i
(
l
)
≤
k
{\displaystyle i(l)\leq k}
the first index such that
w
(
l
)
+
∑
j
=
1
i
(
l
)
w
(
j
)
>
W
{\displaystyle w(l)+\sum _{j=1}^{i(l)}w(j)>W}
. Then it holds that
O
P
T
(
I
)
≥
max
{
h
(
l
)
+
h
(
i
(
l
)
)
|
l
>
k
∧
w
(
l
)
+
∑
j
=
1
i
(
l
)
w
(
j
)
>
W
}
{\displaystyle OPT(I)\geq \max\{h(l)+h(i(l))|l>k\wedge w(l)+\sum _{j=1}^{i(l)}w(j)>W\}}
.
For the second lower bound, partition the set of items into three sets. Let
α
∈
[
1
,
W
/
2
]
∩
N
{\displaystyle \alpha \in [1,W/2]\cap \mathbb {N} }
and define
I
1
(
α
)
:=
{
i
∈
I
|
w
(
i
)
>
W
−
α
}
{\displaystyle {\mathcal {I}}_{1}(\alpha ):=\{i\in {\mathcal {I}}|w(i)>W-\alpha \}}
,
I
2
(
α
)
:=
{
i
∈
I
|
W
−
α
≥
w
(
i
)
>
W
/
2
}
{\displaystyle {\mathcal {I}}_{2}(\alpha ):=\{i\in {\mathcal {I}}|W-\alpha \geq w(i)>W/2\}}
, and
I
3
(
α
)
:=
{
i
∈
I
|
W
/
2
≥
w
(
i
)
>
α
}
{\displaystyle {\mathcal {I}}_{3}(\alpha ):=\{i\in {\mathcal {I}}|W/2\geq w(i)>\alpha \}}
. Then it holds that
O
P
T
(
I
)
≥
max
α
∈
[
1
,
W
/
2
]
∩
N
{
∑
i
∈
I
1
(
α
)
∪
I
2
(
α
)
h
(
i
)
+
(
∑
i
∈
I
3
(
α
)
h
(
i
)
w
(
i
)
−
∑
i
∈
I
2
(
α
)
(
W
−
w
(
i
)
)
h
(
i
)
W
)
+
}
{\displaystyle OPT(I)\geq \max _{\alpha \in [1,W/2]\cap \mathbb {N} }{\Bigg \{}\sum _{i\in {\mathcal {I}}_{1}(\alpha )\cup {\mathcal {I}}_{2}(\alpha )}h(i)+\left({\frac {\sum _{i\in {\mathcal {I}}_{3}(\alpha )h(i)w(i)-\sum _{i\in {\mathcal {I}}_{2}(\alpha )}(W-w(i))h(i)}}{W}}\right)_{+}{\Bigg \}}}
, where
(
x
)
+
:=
max
{
x
,
0
}
{\displaystyle (x)_{+}:=\max\{x,0\}}
for each
x
∈
R
{\displaystyle x\in \mathbb {R} }
.
On the other hand, Steinberg has shown that the height of an optimal solution can be upper bounded by
O
P
T
(
I
)
≤
2
max
{
h
max
(
I
)
,
A
R
E
A
(
I
)
/
W
}
.
{\displaystyle OPT(I)\leq 2\max\{h_{\max }(I),\mathrm {AREA} ({\mathcal {I}})/W\}.}
More precisely he showed that given a
W
≥
w
max
(
I
)
{\displaystyle W\geq w_{\max }({\mathcal {I}})}
and a
H
≥
h
max
(
I
)
{\displaystyle H\geq h_{\max }(I)}
then the items
I
{\displaystyle {\mathcal {I}}}
can be placed inside a box with width
W
{\displaystyle W}
and height
H
{\displaystyle H}
if
W
H
≥
2
A
R
E
A
(
I
)
+
(
2
w
max
(
I
)
−
W
)
+
(
2
h
max
(
I
)
−
H
)
+
{\displaystyle WH\geq 2\mathrm {AREA} ({\mathcal {I}})+(2w_{\max }({\mathcal {I}})-W)_{+}(2h_{\max }(I)-H)_{+}}
, where
(
x
)
+
:=
max
{
x
,
0
}
{\displaystyle (x)_{+}:=\max\{x,0\}}
.
Polynomial time approximation algorithms
Since this problem is NP-hard, approximation algorithms have been studied for this problem.
Most of the heuristic approaches have an approximation ratio between
3
{\displaystyle 3}
and
2
{\displaystyle 2}
.
Finding an algorithm with a ratio below
2
{\displaystyle 2}
seems complicated, and
the complexity of the corresponding algorithms increases regarding their running time and their descriptions.
The smallest approximation ratio achieved so far is
(
5
/
3
+
ε
)
{\displaystyle (5/3+\varepsilon )}
.
= Bottom-up left-justified (BL)
=This algorithm was first described by Baker et al. It works as follows:
Let
L
{\displaystyle L}
be a sequence of rectangular items.
The algorithm iterates the sequence in the given order.
For each considered item
r
∈
L
{\displaystyle r\in L}
, it searches for the bottom-most position to place it and then shifts it as far to the left as possible.
Hence, it places
r
{\displaystyle r}
at the bottom-most left-most possible coordinate
(
x
,
y
)
{\displaystyle (x,y)}
in the strip.
This algorithm has the following properties:
The approximation ratio of this algorithm cannot be bounded by a constant. More precisely they showed that for each
M
>
0
{\displaystyle M>0}
there exists a list
L
{\displaystyle L}
of rectangular items ordered by increasing width such that
B
L
(
L
)
/
O
P
T
(
L
)
>
M
{\displaystyle BL(L)/OPT(L)>M}
, where
B
L
(
L
)
{\displaystyle BL(L)}
is the height of the packing created by the BL algorithm and
O
P
T
(
L
)
{\displaystyle OPT(L)}
is the height of the optimal solution for
L
{\displaystyle L}
.
If the items are ordered by decreasing widths, then
B
L
(
L
)
/
O
P
T
(
L
)
≤
3
{\displaystyle BL(L)/OPT(L)\leq 3}
.
If the item are all squares and are ordered by decreasing widths, then
B
L
(
L
)
/
O
P
T
(
L
)
≤
2
{\displaystyle BL(L)/OPT(L)\leq 2}
.
For any
δ
>
0
{\displaystyle \delta >0}
, there exists a list
L
{\displaystyle L}
of rectangles ordered by decreasing widths such that
B
L
(
L
)
/
O
P
T
(
L
)
>
3
−
δ
{\displaystyle BL(L)/OPT(L)>3-\delta }
.
For any
δ
>
0
{\displaystyle \delta >0}
, there exists a list
L
{\displaystyle L}
of squares ordered by decreasing widths such that
B
L
(
L
)
/
O
P
T
(
L
)
>
2
−
δ
{\displaystyle BL(L)/OPT(L)>2-\delta }
.
For each
ε
∈
(
0
,
1
]
{\displaystyle \varepsilon \in (0,1]}
, there exists an instance containing only squares where each order of the squares
L
{\displaystyle L}
has a ratio of
B
L
(
L
)
/
O
P
T
(
L
)
>
12
11
+
ε
{\displaystyle BL(L)/OPT(L)>{\frac {12}{11+\varepsilon }}}
, i.e., there exist instances where BL does not find the optimum even when iterating all possible orders of the items. In 2024 this lower bound has been improved by Hougardy and Zondervan to
B
L
(
L
)
/
O
P
T
(
L
)
>
4
3
+
ε
{\displaystyle BL(L)/OPT(L)>{\frac {4}{3+\varepsilon }}}
.
= Next-fit decreasing-height (NFDH)
=This algorithm was first described by Coffman et al. in 1980 and works as follows:
Let
I
{\displaystyle {\mathcal {I}}}
be the given set of rectangular items.
First, the algorithm sorts the items by order of nonincreasing height.
Then, starting at position
(
0
,
0
)
{\displaystyle (0,0)}
, the algorithm places the items next to each other in the strip until the next item will overlap the right border of the strip.
At this point, the algorithm defines a new level at the top of the tallest item in the current level and places the items next to each other in this new level.
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
log
(
|
I
|
)
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|\log(|{\mathcal {I}}|))}
and if the items are already sorted even by
O
(
|
I
|
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|)}
.
For every set of items
I
{\displaystyle {\mathcal {I}}}
, it produces a packing of height
N
F
D
H
(
I
)
≤
2
O
P
T
(
I
)
+
h
max
≤
3
O
P
T
(
I
)
{\displaystyle NFDH({\mathcal {I}})\leq 2OPT({\mathcal {I}})+h_{\max }\leq 3OPT({\mathcal {I}})}
, where
h
max
{\displaystyle h_{\max }}
is the largest height of an item in
I
{\displaystyle {\mathcal {I}}}
.
For every
ε
>
0
{\displaystyle \varepsilon >0}
there exists a set of rectangles
I
{\displaystyle {\mathcal {I}}}
such that
N
F
D
H
(
I
|
)
>
(
2
−
ε
)
O
P
T
(
I
)
.
{\displaystyle NFDH({\mathcal {I}}|)>(2-\varepsilon )OPT({\mathcal {I}}).}
The packing generated is a guillotine packing. This means the items can be obtained through a sequence of horizontal or vertical edge-to-edge cuts.
= First-fit decreasing-height (FFDH)
=This algorithm, first described by Coffman et al. in 1980, works similar to the NFDH algorithm.
However, when placing the next item, the algorithm scans the levels from bottom to top and places the item in the first level on which it will fit.
A new level is only opened if the item does not fit in any previous ones.
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
2
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|^{2})}
, since there are at most
|
I
|
{\displaystyle |{\mathcal {I}}|}
levels.
For every set of items
I
{\displaystyle {\mathcal {I}}}
it produces a packing of height
F
F
D
H
(
I
)
≤
1.7
O
P
T
(
I
)
+
h
max
≤
2.7
O
P
T
(
I
)
{\displaystyle FFDH({\mathcal {I}})\leq 1.7OPT({\mathcal {I}})+h_{\max }\leq 2.7OPT({\mathcal {I}})}
, where
h
max
{\displaystyle h_{\max }}
is the largest height of an item in
I
{\displaystyle {\mathcal {I}}}
.
Let
m
≥
2
{\displaystyle m\geq 2}
. For any set of items
I
{\displaystyle {\mathcal {I}}}
and strip with width
W
{\displaystyle W}
such that
w
(
i
)
≤
W
/
m
{\displaystyle w(i)\leq W/m}
for each
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
, it holds that
F
F
D
H
(
I
)
≤
(
1
+
1
/
m
)
O
P
T
(
I
)
+
h
max
{\displaystyle FFDH({\mathcal {I}})\leq \left(1+1/m\right)OPT({\mathcal {I}})+h_{\max }}
. Furthermore, for each
ε
>
0
{\displaystyle \varepsilon >0}
, there exists such a set of items
I
{\displaystyle {\mathcal {I}}}
with
F
F
D
H
(
I
)
>
(
1
+
1
/
m
−
ε
)
O
P
T
(
I
)
{\displaystyle FFDH({\mathcal {I}})>\left(1+1/m-\varepsilon \right)OPT({\mathcal {I}})}
.
If all the items in
I
{\displaystyle {\mathcal {I}}}
are squares, it holds that
F
F
D
H
(
I
)
≤
(
3
/
2
)
O
P
T
(
I
)
+
h
max
{\displaystyle FFDH({\mathcal {I}})\leq (3/2)OPT({\mathcal {I}})+h_{\max }}
. Furthermore, for each
ε
>
0
{\displaystyle \varepsilon >0}
, there exists a set of squares
I
{\displaystyle {\mathcal {I}}}
such that
F
F
D
H
(
I
)
>
(
3
/
2
−
ε
)
O
P
T
(
I
)
{\displaystyle FFDH({\mathcal {I}})>\left(3/2-\varepsilon \right)OPT({\mathcal {I}})}
.
The packing generated is a guillotine packing. This means the items can be obtained through a sequence of horizontal or vertical edge-to-edge cuts.
= The split-fit algorithm (SF)
=This algorithm was first described by Coffman et al.
For a given set of items
I
{\displaystyle {\mathcal {I}}}
and strip with width
W
{\displaystyle W}
, it works as follows:
Determinate
m
∈
N
{\displaystyle m\in \mathbb {N} }
, the largest integer such that the given rectangles have width
W
/
m
{\displaystyle W/m}
or less.
Divide
I
{\displaystyle {\mathcal {I}}}
into two sets
I
w
i
d
e
{\displaystyle {\mathcal {I}}_{wide}}
and
I
n
a
r
r
o
w
{\displaystyle {\mathcal {I}}_{narrow}}
, such that
I
w
i
d
e
{\displaystyle {\mathcal {I}}_{wide}}
contains all the items
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
with a width
w
(
i
)
>
W
/
(
m
+
1
)
{\displaystyle w(i)>W/(m+1)}
while
I
n
a
r
r
o
w
{\displaystyle {\mathcal {I}}_{narrow}}
contains all the items with
w
(
i
)
≤
W
/
(
m
+
1
)
{\displaystyle w(i)\leq W/(m+1)}
.
Order
I
w
i
d
e
{\displaystyle {\mathcal {I}}_{wide}}
and
I
n
a
r
r
o
w
{\displaystyle {\mathcal {I}}_{narrow}}
by nonincreasing height.
Pack the items in
I
w
i
d
e
{\displaystyle {\mathcal {I}}_{wide}}
with the FFDH algorithm.
Reorder the levels/shelves constructed by FFDH such that all the shelves with a total width larger than
W
(
m
+
1
)
/
(
m
+
2
)
{\displaystyle W(m+1)/(m+2)}
are below the more narrow ones.
This leaves a rectangular area
R
{\displaystyle R}
of with
W
/
(
m
+
2
)
{\displaystyle W/(m+2)}
, next to more narrow levels/shelves, that contains no item.
Use the FFDH algorithm to pack the items in
I
n
a
r
r
o
w
{\displaystyle {\mathcal {I}}_{narrow}}
using the area
R
{\displaystyle R}
as well.
This algorithm has the following properties:
For every set of items
I
{\displaystyle {\mathcal {I}}}
and the corresponding
m
{\displaystyle m}
, it holds that
S
F
(
I
)
≤
(
m
+
2
)
/
(
m
+
1
)
O
P
T
(
I
)
+
2
h
max
{\displaystyle SF({\mathcal {I}})\leq (m+2)/(m+1)OPT({\mathcal {I}})+2h_{\max }}
. Note that for
m
=
1
{\displaystyle m=1}
, it holds that
S
F
(
I
)
≤
(
3
/
2
)
O
P
T
(
I
)
+
2
h
max
{\displaystyle SF({\mathcal {I}})\leq (3/2)OPT({\mathcal {I}})+2h_{\max }}
For each
ε
>
0
{\displaystyle \varepsilon >0}
, there is a set of items
I
{\displaystyle {\mathcal {I}}}
such that
S
F
(
I
)
>
(
(
m
+
2
)
/
(
m
+
1
)
−
ε
)
O
P
T
(
I
)
{\displaystyle SF({\mathcal {I}})>\left((m+2)/(m+1)-\varepsilon \right)OPT({\mathcal {I}})}
.
= Sleator's algorithm
=For a given set of items
I
{\displaystyle {\mathcal {I}}}
and strip with width
W
{\displaystyle W}
, it works as follows:
Find all the items with a width larger than
W
/
2
{\displaystyle W/2}
and stack them at the bottom of the strip (in random order). Call the total height of these items
h
0
{\displaystyle h_{0}}
. All the other items will be placed above
h
0
{\displaystyle h_{0}}
.
Sort all the remaining items in nonincreasing order of height. The items will be placed in this order.
Consider the horizontal line at
h
0
{\displaystyle h_{0}}
as a shelf. The algorithm places the items on this shelf in nonincreasing order of height until no item is left or the next one does not fit.
Draw a vertical line at
W
/
2
{\displaystyle W/2}
, which cuts the strip into two equal halves.
Let
h
l
{\displaystyle h_{l}}
be the highest point covered by any item in the left half and
h
r
{\displaystyle h_{r}}
the corresponding point on the right half. Draw two horizontal line segments of length
W
/
2
{\displaystyle W/2}
at
h
l
{\displaystyle h_{l}}
and
h
r
{\displaystyle h_{r}}
across the left and the right half of the strip. These two lines build new shelves on which the algorithm will place the items, as in step 3. Choose the half which has the lower shelf and place the items on this shelf until no other item fits. Repeat this step until no item is left.
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
log
(
|
I
|
)
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|\log(|{\mathcal {I}}|))}
and if the items are already sorted even by
O
(
|
I
|
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|)}
.
For every set of items
I
{\displaystyle {\mathcal {I}}}
it produces a packing of height
A
(
I
)
≤
2
O
P
T
(
I
)
+
h
max
/
2
≤
2.5
O
P
T
(
I
)
{\displaystyle A({\mathcal {I}})\leq 2OPT({\mathcal {I}})+h_{\max }/2\leq 2.5OPT({\mathcal {I}})}
, where
h
max
{\displaystyle h_{\max }}
is the largest height of an item in
I
{\displaystyle {\mathcal {I}}}
.
= The split algorithm (SP)
=This algorithm is an extension of Sleator's approach and was first described by Golan.
It places the items in nonincreasing order of width.
The intuitive idea is to split the strip into sub-strips while placing some items.
Whenever possible, the algorithm places the current item
i
{\displaystyle i}
side-by-side of an already placed item
j
{\displaystyle j}
.
In this case, it splits the corresponding sub-strip into two pieces: one containing the first item
j
{\displaystyle j}
and the other containing the current item
i
{\displaystyle i}
.
If this is not possible, it places
i
{\displaystyle i}
on top of an already placed item and does not split the sub-strip.
This algorithm creates a set S of sub-strips. For each sub-strip s ∈ S we know its lower left corner s.xposition and s.yposition, its width s.width, the horizontal lines parallel to the upper and lower border of the item placed last inside this sub-strip s.upper and s.lower, as well as the width of it s.itemWidth.
function Split Algorithm (SP) is
input: items I, width of the strip W
output: A packing of the items
Sort I in nonincreasing order of widths;
Define empty list S of sub-strips;
Define a new sub-strip s with s.xposition = 0, s.yposition = 0, s.width = W, s.lower = 0, s.upper = 0, s.itemWidth = W;
Add s to S;
while I not empty do
i := I.pop(); Removes widest item from I
Define new list S_2 containing all the substrips with s.width - s.itemWidth ≥ i.width;
S_2 contains all sub-strips where i fits next to the already placed item
if S_2 is empty then
In this case, place the item on top of another one.
Find the sub-strip s in S with smallest s.upper; i.e. the least filled sub-strip
Place i at position (s.xposition, s.upper);
Update s: s.lower := s.upper; s.upper := s.upper+i.height; s.itemWidth := i.width;
else
In this case, place the item next to another one at the same level and split the corresponding sub-strip at this position.
Find s ∈ S_2 with the smallest s.lower;
Place i at position (s.xposition + s.itemWidth, s.lower);
Remove s from S;
Define two new sub-strips s1 and s2 with
s1.xposition = s.xposition, s1.yposition = s.upper, s1.width = s.itemWidth, s1.lower = s.upper, s1.upper = s.upper, s1.itemWidth = s.itemWidth;
s2.xposition = s.xposition+s.itemWidth, s2.yposition = s.lower, s2.width = s.width - s.itemWidth, s2.lower = s.lower, s2.upper = s.lower + i.height, s2.itemWidth = i.width;
S.add(s1,s2);
return
end function
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
2
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|^{2})}
since the number of substrips is bounded by
|
I
|
{\displaystyle |{\mathcal {I}}|}
.
For any set of items
I
{\displaystyle {\mathcal {I}}}
it holds that
S
P
(
I
)
≤
2
O
P
T
(
I
)
+
h
max
≤
3
O
P
T
(
I
)
{\displaystyle SP({\mathcal {I}})\leq 2OPT({\mathcal {I}})+h_{\max }\leq 3OPT({\mathcal {I}})}
.
For any
ε
>
0
{\displaystyle \varepsilon >0}
, there exists a set of items
I
{\displaystyle {\mathcal {I}}}
such that
S
P
(
I
)
>
(
3
−
ε
)
O
P
T
(
I
)
{\displaystyle SP({\mathcal {I}})>(3-\varepsilon )OPT({\mathcal {I}})}
.
For any
ε
>
0
{\displaystyle \varepsilon >0}
and
C
>
0
{\displaystyle C>0}
, there exists a set of items
I
{\displaystyle {\mathcal {I}}}
such that
S
P
(
I
)
>
(
2
−
ε
)
O
P
T
(
I
)
+
C
{\displaystyle SP({\mathcal {I}})>(2-\varepsilon )OPT({\mathcal {I}})+C}
.
= Reverse-fit (RF)
=This algorithm was first described by Schiermeyer.
The description of this algorithm needs some additional notation.
For a placed item
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
, its lower left corner is denoted by
(
a
i
,
c
i
)
{\displaystyle (a_{i},c_{i})}
and its upper right corner by
(
b
i
,
d
i
)
{\displaystyle (b_{i},d_{i})}
.
Given a set of items
I
{\displaystyle {\mathcal {I}}}
and a strip of width
W
{\displaystyle W}
, it works as follows:
Stack all the rectangles of width greater than
W
/
2
{\displaystyle W/2}
on top of each other (in random order) at the bottom of the strip. Denote by
H
0
{\displaystyle H_{0}}
the height of this stack. All other items will be packed above
H
0
{\displaystyle H_{0}}
.
Sort the remaining items in order of nonincreasing height and consider the items in this order in the following steps. Let
h
max
{\displaystyle h_{\max }}
be the height of the tallest of these remaining items.
Place the items one by one left aligned on a shelf defined by
H
0
{\displaystyle H_{0}}
until no other item fit on this shelf or there is no item left. Call this shelf the first level.
Let
h
1
{\displaystyle h_{1}}
be the height of the tallest unpacked item. Define a new shelf at
H
0
+
h
max
+
h
1
{\displaystyle H_{0}+h_{\max }+h_{1}}
. The algorithm will fill this shelf from right to left, aligning the items to the right, such that the items touch this shelf with their top. Call this shelf the second reverse-level.
Place the items into the two shelves due to First-Fit, i.e., placing the items in the first level where they fit and in the second one otherwise. Proceed until there are no items left, or the total width of the items in the second shelf is at least
W
/
2
{\displaystyle W/2}
.
Shift the second reverse-level down until an item from it touches an item from the first level. Define
H
1
{\displaystyle H_{1}}
as the new vertical position of the shifted shelf. Let
f
{\displaystyle f}
and
s
{\displaystyle s}
be the right most pair of touching items with
f
{\displaystyle f}
placed on the first level and
s
{\displaystyle s}
on the second reverse-level. Define
x
r
:=
max
(
b
f
,
b
s
)
{\displaystyle x_{r}:=\max(b_{f},b_{s})}
.
If
x
r
<
W
/
2
{\displaystyle x_{r}
then
s
{\displaystyle s}
is the last rectangle placed in the second reverse-level. Shift all the other items from this level further down (all the same amount) until the first one touches an item from the first level. Again the algorithm determines the rightmost pair of touching items
f
′
{\displaystyle f'}
and
s
′
{\displaystyle s'}
. Define
h
2
{\displaystyle h_{2}}
as the amount by which the shelf was shifted down.
If
h
2
≤
h
(
s
)
{\displaystyle h_{2}\leq h(s)}
then shift
s
{\displaystyle s}
to the left until it touches another item or the border of the strip. Define the third level at the top of
s
′
{\displaystyle s'}
.
If
h
2
>
h
(
s
)
{\displaystyle h_{2}>h(s)}
then shift
s
{\displaystyle s}
define the third level at the top of
s
′
{\displaystyle s'}
. Place
s
{\displaystyle s}
left-aligned in this third level, such that it touches an item from the first level on its left.
Continue packing the items using the First-Fit heuristic. Each following level (starting at level three) is defined by a horizontal line through the top of the largest item on the previous level. Note that the first item placed in the next level might not touch the border of the strip with their left side, but an item from the first level or the item
s
{\displaystyle s}
.
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
2
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|^{2})}
, since there are at most
|
I
|
{\displaystyle |{\mathcal {I}}|}
levels.
For every set of items
I
{\displaystyle {\mathcal {I}}}
it produces a packing of height
R
F
(
I
)
≤
2
O
P
T
(
I
)
{\displaystyle RF({\mathcal {I}})\leq 2OPT({\mathcal {I}})}
.
= Steinberg's algorithm (ST)
=Steinbergs algorithm is a recursive one. Given a set of rectangular items
I
{\displaystyle {\mathcal {I}}}
and a rectangular target region with width
W
{\displaystyle W}
and height
H
{\displaystyle H}
, it proposes four reduction rules, that place some of the items and leaves a smaller rectangular region with the same properties as before regarding of the residual items.
Consider the following notations: Given a set of items
I
{\displaystyle {\mathcal {I}}}
we denote by
h
max
(
I
)
{\displaystyle h_{\max }({\mathcal {I}})}
the tallest item height in
I
{\displaystyle {\mathcal {I}}}
,
w
max
(
I
)
{\displaystyle w_{\max }({\mathcal {I}})}
the largest item width appearing in
I
{\displaystyle {\mathcal {I}}}
and by
A
R
E
A
(
I
)
:=
∑
i
∈
I
w
(
i
)
h
(
i
)
{\displaystyle \mathrm {AREA} ({\mathcal {I}}):=\sum _{i\in {\mathcal {I}}}w(i)h(i)}
the total area of these items.
Steinbergs shows that if
h
max
(
I
)
≤
H
{\displaystyle h_{\max }({\mathcal {I}})\leq H}
,
w
max
(
I
)
≤
W
{\displaystyle w_{\max }({\mathcal {I}})\leq W}
, and
A
R
E
A
(
I
)
≤
W
⋅
H
−
(
2
h
max
(
I
)
−
h
)
+
(
2
w
max
(
I
)
−
W
)
+
{\displaystyle \mathrm {AREA} ({\mathcal {I}})\leq W\cdot H-(2h_{\max }({\mathcal {I}})-h)_{+}(2w_{\max }({\mathcal {I}})-W)_{+}}
, where
(
a
)
+
:=
max
{
0
,
a
}
{\displaystyle (a)_{+}:=\max\{0,a\}}
,
then all the items can be placed inside the target region of size
W
×
H
{\displaystyle W\times H}
.
Each reduction rule will produce a smaller target area and a subset of items that have to be placed. When the condition from above holds before the procedure started, then the created subproblem will have this property as well.
Procedure 1: It can be applied if
w
max
(
I
′
)
≥
W
/
2
{\displaystyle w_{\max }({\mathcal {I}}')\geq W/2}
.
Find all the items
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
with width
w
(
i
)
≥
W
/
2
{\displaystyle w(i)\geq W/2}
and remove them from
I
{\displaystyle {\mathcal {I}}}
.
Sort them by nonincreasing width and place them left-aligned at the bottom of the target region. Let
h
0
{\displaystyle h_{0}}
be their total height.
Find all the items
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
with width
h
(
i
)
>
H
−
h
0
{\displaystyle h(i)>H-h_{0}}
. Remove them from
I
{\displaystyle {\mathcal {I}}}
and place them in a new set
I
H
{\displaystyle {\mathcal {I}}_{H}}
.
If
I
H
{\displaystyle {\mathcal {I}}_{H}}
is empty, define the new target region as the area above
h
0
{\displaystyle h_{0}}
, i.e. it has height
H
−
h
0
{\displaystyle H-h_{0}}
and width
W
{\displaystyle W}
. Solve the problem consisting of this new target region and the reduced set of items with one of the procedures.
If
I
H
{\displaystyle {\mathcal {I}}_{H}}
is not empty, sort it by nonincreasing height and place the items right allinged one by one in the upper right corner of the target area. Let
w
0
{\displaystyle w_{0}}
be the total width of these items. Define a new target area with width
W
−
w
0
{\displaystyle W-w_{0}}
and height
H
−
h
0
{\displaystyle H-h_{0}}
in the upper left corner. Solve the problem consisting of this new target region and the reduced set of items with one of the procedures.
Procedure 2: It can be applied if the following conditions hold:
w
max
(
I
)
≤
W
/
2
{\displaystyle w_{\max }({\mathcal {I}})\leq W/2}
,
h
max
(
I
)
≤
H
/
2
{\displaystyle h_{\max }({\mathcal {I}})\leq H/2}
, and there exist two different items
i
,
i
′
∈
I
{\displaystyle i,i'\in {\mathcal {I}}}
with
w
(
i
)
≥
W
/
4
{\displaystyle w(i)\geq W/4}
,
w
(
i
′
)
≥
W
/
4
{\displaystyle w(i')\geq W/4}
,
h
(
i
)
≥
H
/
4
{\displaystyle h(i)\geq H/4}
,
h
(
i
′
)
≥
H
/
4
{\displaystyle h(i')\geq H/4}
and
2
(
A
R
E
A
(
I
)
−
w
(
i
)
h
(
i
)
−
w
(
i
′
)
h
(
i
′
)
)
≤
(
W
−
max
{
w
(
i
)
,
w
(
i
′
)
}
)
H
{\displaystyle 2(\mathrm {AREA} ({\mathcal {I}})-w(i)h(i)-w(i')h(i'))\leq (W-\max\{w(i),w(i')\})H}
.
Find
i
{\displaystyle i}
and
i
′
{\displaystyle i'}
and remove them from
I
{\displaystyle {\mathcal {I}}}
.
Place the wider one in the lower-left corner of the target area and the more narrow one left-aligned on the top of the first.
Define a new target area on the right of these both items, such that it has the width
W
−
max
{
w
(
i
)
,
w
(
i
′
)
}
{\displaystyle W-\max\{w(i),w(i')\}}
and height
H
{\displaystyle H}
.
Place the residual items in
I
{\displaystyle {\mathcal {I}}}
into the new target area using one of the procedures.
Procedure 3: It can be applied if the following conditions hold:
w
max
(
I
)
≤
W
/
2
{\displaystyle w_{\max }({\mathcal {I}})\leq W/2}
,
h
max
(
I
)
≤
H
/
2
{\displaystyle h_{\max }({\mathcal {I}})\leq H/2}
,
|
I
|
>
1
{\displaystyle |{\mathcal {I}}|>1}
, and when sorting the items by decreasing width there exist an index
m
{\displaystyle m}
such that when defining
I
′
{\displaystyle {\mathcal {I'}}}
as the first
m
{\displaystyle m}
items it holds that
A
R
E
A
(
I
)
−
W
H
/
4
≤
A
R
E
A
(
I
′
)
≤
3
W
H
/
8
{\displaystyle \mathrm {AREA} ({\mathcal {I}})-WH/4\leq \mathrm {AREA} ({\mathcal {I'}})\leq 3WH/8}
as well as
w
(
i
m
+
1
)
≤
W
/
4
{\displaystyle w(i_{m+1})\leq W/4}
Set
W
1
:=
max
W
/
2
,
2
A
R
E
A
(
I
′
)
/
H
{\displaystyle W_{1}:=\max {W/2,2\mathrm {AREA} ({\mathcal {I'}})/H}}
.
Define two new rectangular target areas one at the lower-left corner of the original one with height
H
{\displaystyle H}
and width
W
1
{\displaystyle W_{1}}
and the other left of it with height
H
{\displaystyle H}
and width
W
−
W
1
{\displaystyle W-W_{1}}
.
Use one of the procedures to place the items in
I
′
{\displaystyle {\mathcal {I'}}}
into the first new target area and the items in
I
∖
I
′
{\displaystyle {\mathcal {I}}\setminus {\mathcal {I'}}}
into the second one.
Note that procedures 1 to 3 have a symmetric version when swapping the height and the width of the items and the target region.
Procedure 4: It can be applied if the following conditions hold:
w
max
(
I
)
≤
W
/
2
{\displaystyle w_{\max }({\mathcal {I}})\leq W/2}
,
h
max
(
I
)
≤
H
/
2
{\displaystyle h_{\max }({\mathcal {I}})\leq H/2}
, and there exists an item
i
∈
I
{\displaystyle i\in {\mathcal {I}}}
such that
w
(
i
)
h
(
i
)
≥
A
R
E
A
(
I
)
−
W
H
/
4
{\displaystyle w(i)h(i)\geq \mathrm {AREA} ({\mathcal {I}})-WH/4}
.
Place the item
i
{\displaystyle i}
in the lower-left corner of the target area and remove it from
I
{\displaystyle {\mathcal {I}}}
.
Define a new target area right of this item such that it has the width
W
−
w
(
i
)
{\displaystyle W-w(i)}
and height
H
{\displaystyle H}
and place the residual items inside this area using one of the procedures.
This algorithm has the following properties:
The running time can be bounded by
O
(
|
I
|
log
(
|
I
|
)
2
/
log
(
log
(
|
I
|
)
)
)
{\displaystyle {\mathcal {O}}(|{\mathcal {I}}|\log(|{\mathcal {I}}|)^{2}/\log(\log(|{\mathcal {I}}|)))}
.
For every set of items
I
{\displaystyle {\mathcal {I}}}
it produces a packing of height
S
T
(
I
)
≤
2
O
P
T
(
I
)
{\displaystyle ST({\mathcal {I}})\leq 2OPT({\mathcal {I}})}
.
Pseudo-polynomial time approximation algorithms
To improve upon the lower bound of
3
/
2
{\displaystyle 3/2}
for polynomial-time algorithms, pseudo-polynomial time algorithms for the strip packing problem have been considered.
When considering this type of algorithms, all the sizes of the items and the strip are given as integrals. Furthermore, the width of the strip
W
{\displaystyle W}
is allowed to appear polynomially in the running time.
Note that this is no longer considered as a polynomial running time since, in the given instance, the width of the strip needs an encoding size of
log
(
W
)
{\displaystyle \log(W)}
.
The pseudo-polynomial time algorithms that have been developed mostly use the same approach. It is shown that each optimal solution can be simplified and transformed into one that has one of a constant number of structures. The algorithm then iterates all these structures and places the items inside using linear and dynamic programming. The best ratio accomplished so far is
(
5
/
4
+
ε
)
O
P
T
(
I
)
{\displaystyle (5/4+\varepsilon )OPT(I)}
. while there cannot be a pseudo-polynomial time algorithm with ratio better than
5
/
4
{\displaystyle 5/4}
unless
P
=
N
P
{\displaystyle P=NP}
Online algorithms
In the online variant of strip packing, the items arrive over time. When an item arrives, it has to be placed immediately before the next item is known. There are two types of online algorithms that have been considered. In the first variant, it is not allowed to alter the packing once an item is placed. In the second, items may be repacked when another item arrives. This variant is called the migration model.
The quality of an online algorithm is measured by the (absolute) competitive ratio
s
u
p
I
A
(
I
)
/
O
P
T
(
I
)
{\displaystyle \mathrm {sup} _{I}A(I)/OPT(I)}
,
where
A
(
I
)
{\displaystyle A(I)}
corresponds to the solution generated by the online algorithm and
O
P
T
(
I
)
{\displaystyle OPT(I)}
corresponds to the size of the optimal solution.
In addition to the absolute competitive ratio, the asymptotic competitive ratio of online algorithms has been studied. For instances
I
{\displaystyle I}
with
h
max
(
I
)
≤
1
{\displaystyle h_{\max }(I)\leq 1}
it is defined as
lim
s
u
p
O
P
T
(
I
)
→
∞
A
(
I
)
/
O
P
T
(
I
)
{\displaystyle \lim \mathrm {sup} _{OPT(I)\rightarrow \infty }A(I)/OPT(I)}
.
Note that all the instances can be scaled such that
h
max
(
I
)
≤
1
{\displaystyle h_{\max }(I)\leq 1}
.
The framework of Han et al. is applicable in the online setting if the online bin packing
algorithm belongs to the class Super Harmonic. Thus, Seiden's online bin packing algorithm
Harmonic++ implies an algorithm for online strip packing with asymptotic ratio 1.58889.
References
Kata Kunci Pencarian:
- Daftar julukan kota di Amerika Serikat
- Strip packing problem
- Packing problems
- Guillotine cutting
- Parallel task scheduling
- Judicial Procedures Reform Bill of 1937
- Israeli disengagement from the Gaza Strip
- List of terms relating to algorithms and data structures
- Origami
- List of 77 Sunset Strip episodes
- Mechanical puzzle