Title: Bin Packing
1Bin Packing
- Chapter 1 Applied Mathematics of Logistics
2An instance of bin packing
- The maximum weight (capacity) of one box is 9 kg.
- Given the set of items whose weights are
(6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,4,4,5).
- How can we pack these items into the minimum
number of boxes.
3Bin packing problem
- Given a set N of n items and an infinite number
of bins each of which has a size (capacity) B. - The size of item i 2 N is known and is denoted
by wi . - Find the minimum number of bins so that all the n
items are packed and the total size of items
packed into a bin does not exceed the bin size B.
4Big Oh(O)notation
- Function f(n) is O(g(n)) iff (if and only if)
there exists a constant C such that -
5Omega(O)notation
- Function f(n) is ?(g(n)) iff there exits a
constant C such that
6Theta(T)notation
- f(n)O(g(n)) and f(n)? (g(n)) ? f(n)? (g(n))
- Function f(n) is ?(g(n)) iff there exists two
constants c, C such that
7Small o and small omega notation
- Function f(n) is o(g(n)) (denoted by f(n)o(g(n))
iff -
- Function f(n) is ?(g(n)) (denoted by f(n)?(g(n))
)iff
8Worst case analysis
- Optimal value of an instance I is denoted by
OPT(I). Approximate solution value of an
instance is denoted by A(I).The ratio r(I) is
defined as
- If approximate algorithm A satisfies
- r(I) ?r
- for all instance I, A has a performance ratio
r.
9Asymptotic performance ratio
- If approximate algorithm A satisfies
- . ,
-
- we call A has an asymptotic performance
ratio r.
10Next fit heuristics
- Pack items in the order of their indices
1,2,?,n.If the total size of items packed into
the bin exceeds the size of bin, close the bin,
prepare a new bin, and pack the item into the new
bin. - If we denote the number of bins obtained by next
fit heuristics by Anf(I), we can prove - Anf (I) ? 2 OPT (I)
- for all I.
- Next fit has a performance ration 2.
- The performance ratio 2 cannot be improved, i.e.,
there exists an example whose performance ratio
approaches to 2.
11Online and offline heuristics
- Online heuristics The items arrives in some
order and they have to be assigned to a bin as
soon as they arrive without knowledge of the
remaining items. - Offline heuristicsThe entire list of items and
their sizes are known before the packing begins. - Bounded space online heuristicsA fixed number K
of partially filled bins are open. Once the bin
is closed, it must remain so. - Next fit heuristics is bounded space online with
K1.
12First fit heuristics
- Pack items in the order of their indices
1,2,?,n.If the item is packed into the bin that
does not exceed its capacity and has the minimum
index. If there does not exist any bin to be
packed, close the bin, prepare a new bin, and
pack the item into the new bin. - First fit relaxes the bounded space condition K1
of next fit. - First fit has an asymptotic performance ratio
17/10. - The performance ratio 17/10 cannot be improved,
i.e., there exists an example whose performance
ratio approaches to 17/10.
13First fit decreasing heuristics
- Sort the items in the non-increasing order of
their sizes. and then apply first fit heuristics.
- Offline heuristics
- First fit decreasing has an asymptotic
performance ratio 11/9. - The performance ratio 11/9 cannot be improved,
i.e., there exists an example whose performance
ratio approaches to 11/9.
14Approximation scheme
- Consider an approximate algorithm A that returns
an approximate value A(I, ?) if we are given a
problem instance I and an upper bound of
relative error ? (gt0). - A is called the approximation scheme if it
satisfies - for all instances I.
- Polynomial time approximate scheme an
approximation scheme that runs in a polynomial
time of the input size - Fully polynomial time approximation scheme an
approximation scheme that runs is a polynomial
time both in the input size and 1/?
15Asymptotic approximation scheme
- A is called the asymptotic approximation scheme
if it satisfies - Polynomial time asymptotic approximate scheme an
asymptotic approximation scheme that runs in a
polynomial time of the input size - Fully polynomial time asymptotic approximation
scheme an asymptotic approximation scheme that
runs is a polynomial time both in the input size
and 1/?
16Approximation scheme for bin packing
- Assuming P ? NP , there does not exists a
polynomial time approximate algorithm such that
r(I)lt3/2. - It can be proved by a polynomial time reduction
from the number partitioning problem to the
(approximate) bin packing problem. - Thus we cannot expect a polynomial time
approximation scheme. - There exists an asymptotic approximation schme
that returns A(I,?) ? (1?) OPT(I) 2/?2 1 .
17Probabilistic analysis
- Concern the average case behavior of heuristics
under some assumptions of probabilistic
distributions of problem instances. - Let Ln(F) denote a random n-item list with item
sizes chosen independently according to
distribution F. - Asymptotic performance ratio
- Expected waste
18Probabilistic analysis of next fit heuristics
- If item sizes are chosen independently according
to uniform distribution U0,1 on an interval
0,1 and the bin size B is 1, the asymptotic
performance ratio of next fit is - If F is uniform distribution U0,b(where 1/2 ? b
? 1) on an interval 0,b, the asymptotic
performance ratio of next fit is
19Probabilistic analysis of first fit heuristics
- If F is U0,1 , the asymptotic performance ratio
of first fit heuristics is - The expected waste is
20Best fit heuristics
- Pack items in the order of their indices
1,2,?,n.If the item is packed into the bin that
does not exceed its capacity and has the maximum
size (minimum remaining capacity) . If there does
not exist any bin to be packed, close the bin,
prepare a new bin, and pack the item into the new
bin. - If F is U0,1, the expected waste of best fit
heuristics is
21Discrete distribution and perfect packable
- The bin size B is a positive integer.
- The item sizes are a sequence of positive
integers s1 lts2 lt? ltsJ where sj (j1,?,J) is in
1,B. - The probability with which the item with size sj
occurs is pj . - The discrete distribution F is said to be
perfectly packable if the expect waste of the
optimal solution is o(n).
22Flow formulation and perfectly packablility
Variable xjh the ratio with which the item of
size sj is assigned to the bin withy height h.
The optimal value of the above linear
programming problem is 0.
23Sum-of-squares method
- Item sizes have a discrete distribution and the
size of bin is a positive integer B. - The height h of bin that is not empty nor full is
an integer within an interval 1,B-1 . - The number of bins with height h is denoted by
M(h). - In the sum-of-squares method, the arrived item is
packed so that the sum of squares of M(h), SS
below, is minimized.
24Evaluation of the difference in the
sum-of-squares and the expected waste
- The increase ? of SS when the item with size w
is assigned to the bin with height h is
If the distribution F is perfectly
packable, the expected waste EWssn of the
sum-of-squares method is