ClassW04ApproxAlgs/SerdarBozdag

ClassS04CS141 | ClassW04ApproxAlgs | recent changes | Preferences

Difference (from prior author revision) (major diff, minor diff)

Changed: 2c2

Outline



1 Outline




Removed: 8d7
* Conclusion

Changed: 10,12c9

Original Bin Packing Problem



Here size(S) = a∈ S size(a) and profit(S) = a∈ S profit(a).

2 Original Bin Packing Problem




Changed: 18c15,16

Online Algorithms for Original Bin Packing Problem





3 On-line Algorithms for Original Bin Packing Problem




Changed: 21c19,20

Definitions



In this section, we give very brief information about some naive online algorithms to warm you up.

3.1 Definitions




Changed: 27c26,28

Next-Fit (NF)



* p denotes the size of the largest item in the item list.
* Without loss of generality, we give algorithms for scaled version of bin packing problem such that bins have a nominal capacity 1, and size of items are specified as rationals.

3.2 Next-Fit (NF)




Changed: 32,33c33,62
==Extensible Bin Packing Problem ==
Extensible bin packing problem is a variation of original bin packing problem. In this problem, number of bins is given as an input. The capacity of each bin is 1 and bins may be extended to hold more than their capacities. The cost of a bin is 1 if it is not extended, and the size of items in it if it is extended. The goal of this problem is to pack a set of items of given sizes into the specified number of bins in a way to minimize the total cost. In this tutorial, a fully asymptotic approximation scheme will be introduced for extensible bin packing problem.

The disadvantage of this algorithm is that it closes a bin that can be used in the future. This algorithm packs a list of items and its reverse in the same number of bins. The asymptotic performance ratio (APR) of NF is as following

NF(I) ≤ 2*OPT(I) if 1/2 < p ≤ 1

NF(I) ≤ (1-p)-1*OPT(I) if 0 < p ≤ 1/2

3.3 Worst-Fit (WF)



# If there are no open bins in which the current item fits, pack the item into an empty bin.
# Otherwise, pack the item into the bin of smallest content in which the item fits.

Although WF never closes a bin, the APR of this algorithm same as the previous one.

3.4 First-Fit (FF)



# Pack the current item into the lowest indexed nonempty bin in which it fits.
# If there is no bin in which the current item can fit, pack the item in an empty bin.

3.5 Best-Fit (BF)



# If there are some bins in which the current item can fit, pack the item into the bin of largest content in which the item fits.
# Otherwise, pack the the item into an empty bin.

3.6 Conclusion on on-line algorithms



The drawback of these on-line algorithms is their performance when size of items in the list or part of the list are in increasing order. If a list is in increasing order, the performances of the on-line algorithms suffer greatly.

Even "average-case" lists that have portions in increasing order can greatly affect an on-line algorithm's approximation guarantee ratio. For example, when the bin size is 1, then following list of items will be packed into 3 bins according to all four on-line algorithms...

.2, .7, .3, .8

It is easy to see that these items can be packed into two bins.
We touched the approximation guarantee of some algorithms above, but in general the analysis of these algorithms are very complicated and it is out of scope of this tutorial. You can read the papers listed in references for more information.



4 Extensible Bin Packing Problem



Extensible bin packing problem is a variation of original bin packing problem. In this problem, number of bins is given as an input. The capacity of each bin is 1 and bins may be extended to hold more than their capacities. The cost of a bin is 1 if it is not extended, and the total size of items in it if it is extended. The goal of this problem is to pack a set of items of given sizes into the specified number of bins in a way to minimize the total cost. In this tutorial, a fully polynomial time asymptotic approximation scheme (FPTAAS) is introduced for extensible bin packing problem.

Changed: 36,48c65,80
*

A FTPAAS for Extensible Bin Packing Problem ==


Introduction ===

Input



* xi for i=1,2,3,...,n: size of i-th item.

* m: number of bins

3.2 Notations



* bj for j=1,2,3,...,m: j-th bin

* l(bj): level of bj (total size of items packed into bj)

* c(bj): cost of bj = max(1,l(bj))

3.3 Goal



minimize j=1m c(bj)

Algorithm



* The problem of assigning tasks to workers: There are a set of tasks which must be assigned to a set of identical workers which are available at a fixed cost for a given time and can be acquired for additional time at an additional cost. In this problem, the goal is to minimize the cost.
* Scheduling problem: There are two machines and two types of tasks to be executed at these machines. Suppose that the tasks of first type requires only the first machine, and the tasks of second type requires both machines for some time, and then only the first machine for an additional time. The goal in this problem is the minimization of makespan.
* Storage Allocation problem: In this problem, extra capacity can be obtained from a fixed set of locations with given capacity at a proportional cost. The goal is to minimize the total cost when storing a set of items in those locations.


5 A FPTAAS for Extensible Bin Packing Problem ==


5.1 Introduction ===
Input
* xi: size of i-th item. 1 ≤ i ≤ n

* m: number of bins
Notations
* bj: j-th bin 1 ≤ j ≤ m

* l(bj): level of bj (total size of items packed into bj)

* c(bj) = max(1,l(bj)): cost of bj
Goal
* minimize j=1..m c(bj) (Pack all items in bins in a way to minimize the total cost.)

5.2 Algorithm




Changed: 50,53c82,87

A(I,ε) ≤ (1 + ε)OPT(I) + O(ε-1\log{ε-1}) in time bounded by a polynomial in n and ε-1
We can make some assumptions without loss of generality.

First Assumption




A(I,ε) ≤ (1 + ε)OPT(I) + O(ε-1logε-1)

in time bounded by a polynomial in n and ε-1

Before showing how this algorithm produces this approximation guarantee, we can make some assumptions without loss of generality for the sake of simplicity. For each assumption, we prove that this assumption can be made without loss of generality.

5.2.1 First Assumption




Changed: 55,56c89,109
xi > ε/(1+ε) for i=1,2,…,n

Second Assumption






xi > ε/(1+ε) for i=1,2,…,n


Proof

Suppose we have an approximation algorithm A which guarantees given approximation guarantee with so small items. We can use this algorithm to pack an arbitrary list of items as following:

# First, use A to pack items that are not small
# Pack the small items greedily.

There are two cases when we pack small items

# Packing small items does not increase the cost. Then we clearly satisfy the approximation guarantee.
# Packing small items does increase the cost. For convenience, let ε equal to ε/(1+ε) (maximum size of a small item). Then we can say that before packing small items the level of each bin is at least 1 - ε. Therefore





OPT(I) ≥ j=1..m l(bj) > m(1-ε)

A(I) ≤ j=1..m max(1,l(bj)) ≤ j=1..m l(bj)+ε ≤ mε + j=1..m l(bj)

(A - OPT(I))/OPT(I) ≤ mε/m(1-ε) = ε.

5.2.2 Second Assumption




Changed: 58,59c111,117
xi < 1 for \(i=1,2,…,n

Third Assumption





xi < 1 for i=1,2,…,n


Proof

We claim that there is an optimum packing algorithm which packs big items into a bin by itself. Similar to the proof given above, we can construct an 1+ε approximation algorithm from 1+ε which packs without big items. Suppose some optimum packing placed some item x in a bin together with a big item. Then we could move x to another bin that does not contain a big item without increasing the cost.

5.2.3 Third Assumption




Changed: 61,62c119,125
x=1n xi < 2m

Fourth Assumption





x=1..n xi < 2m


Proof

When there are no big items, greedy method guarantees that as long as any bin is packed to a level of less than 1, no bin will be packed to a level of 2 or more. In other words, when a bin is packed to a level at least 2, then the cost of packing is simply the sum of items, so the packing is optimum. Thus, we can make this assumption without loss of generality.

5.2.4 Fourth Assumption




Changed: 64,65c127,133
l(bj) < 3 for j=1,2,…,m
---


l(bj) < 3 for j=1,2,…,m


Proof

Suppose, there is a bin of level 3 or more. According to the previous assumption, there will be a bin of level less than 2. Thus, we can move an item from bin that has higher level to the other level without increasing the cost. Therefore, without loss of generality, we can assume that the level of any bin is at most 3.



Added: 66a135,136
<table>


Added: 67a138
</td></tr></table>

Added: 69a141,143
In high level, this algorithm works as following:

First we group the items in terms of their sizes. (We round the sizes up to specified values) Then we define different ways of packing these items in bins. Then coarsening method (dynamic programming) gives a way of packing all items at minimum cost. (We give an ILP to find the optimum result.)

It is an approximation algorithm because we change the size of the items, and we relax ILP to LP.

Changed: 74c148,150
sj = ⌊(1+ε)j/ε⌋ε2 for \1lej<N

<table>

sj = ⌊(1+ε)j/ε⌋ε2 for 1≤ j<N


Added: 75a152
</td></tr></table>

Changed: 81,83c158,162
Increase ratio of items of size less than s1 s1/(ε/(1+ε)) ≤ (1+ε)2

Increase ratio of items of size larger than s1 sj+1/sj ≤ (1+ε)2

Rounding increases the cost of the optimum solution by a faxtor of at most \((1+\epsilon)^2)
Increase ratio of items of size less than s1



s1/(ε/(1+ε)) ≤ ⌊(1+ε)/ε⌋ε2/(ε/(1+ε)) ≤ (1+ε)2


Changed: 85,112c164,183
nj: number of items of size sj after rounding.

configuration: packing a bin to a level of at most 3 with sizes chosen from sj
M: number of configurations
Cij: number of items of size sj in the i-th configuration
max(1,j=1N Cijsj: cost of packing a bin according to i-th configuration






















Cizis1s2s3sN
1z1C11C12C13C1N
2z2C11C22C23C2N
3z3C11C32C33C3N
4z4C11C42C43C4N
5z5C11C52C53C5N
MzMC11CM2CM3CMN

Increase ratio of items of size larger than s1


sj+1/sj = ⌊(1+ε)j+1ε-1⌋/⌊(1+ε)jε-1⌋ ≤ (1+ε)j+1ε-1/((1+ε)jε-1-1) = (1+ε)j+1/((1+ε)j - ε) ≤ (1+ε)j+1/ (1+ε)j-1 ≤ (1+ε)2



Thus, Rounding increases the cost of the optimum solution by a factor of at most (1+ε)2)




* nj: number of items of size sj after rounding.

* configuration: packing a bin to a level of at most 3 with sizes chosen from sj
* M: number of configurations
* Cij: number of items of size sj in the i-th configuration
* max(1,j=1..N Cijsj): cost of packing a bin according to i-th configuration

upload:sbozdag_configuration_table.gif

The figure given above gives an intuitive explanation for the ILP we introduce in next section.

Each row in this table is a configuration. In each configuration we pack a number of items of each size (Cij) such that the level of the bin is at most 3. The number of configurations can be in terms of ε.

We can use a configuration zi times in the solution. Our goal is to pack all items and use all bins. These are the constraints in ILP given below.

Changed: 114c185

Integer Program



5.3 Integer Linear Program




Changed: 116,120c187,196
Objective function: min i=1M zi.max(1,j=1N Cijsj)

subject to

i=1M ziCij ≥ nj for j=1,2,…,N

i=1M zi ≥ m

zi ∈ {0,1,2,ldots}
Objective function:


min i=1..M zi.max(1,j=1..N Cijsj)


subject to


i=1..M ziCij ≥ nj for j=1,2,…,N (We need to pack all items of each size)

i=1..M zi ≥ m(We need to use all bins)

zi ∈ {0,1,2,ldots} (We can use a configuration any time we want)


Changed: 122,123c198,199
When we relax this ILP to LP by allowing zi to be any nonnegative value.

number of inequalities in LP = N+1
When we relax this ILP to LP by allowing zi to be any nonnegative value, number of inequalities in LP will be N+1.

Thus,

Changed: 125c201,203
* Round LP to ILP increases the solution 3(N+1) because each coefficient in the objective function is at most 3. (Recall that l(bj) < 3 for j=1,2,…,m
* Round LP to ILP increases the solution by at most 3(N+1) because each coefficient in the objective function is at most 3. (Recall that l(bj) < 3 for j=1,2,…,m)

Relaxation increases the optimum solution by at most 3(N+1) = O(ε-1logε-1) which is the asymptotic part in the approximation guarantee shown in the beginning.

Changed: 127c205,214
3(N+1) = O(e-1logε-1)
Thus, this algorithm gives a solution with an approximation guarantee


A(I,ε) ≤ (1 + ε)OPT(I) + O(ε-1logε-1)



References



* Edward G. Coffman Jr. and George S. Lueker. Approximation Algorithms for Extensible Bin Packing. Symposium on Discrete Algorithms, 586-588 2001
* P. Dell'Olmo, H. Kellerer, M. G. Speranza, and Z. Tuza. A 13/12 approximation algorithm for bin packing with extendable bins. Information Processing Letters, 65:229-233, 1998.
* N. Karmarkar and R. M. Karp. An efficient approximation scheme for the one-dimensional bin-packing problem. In Proceedings of the 23rd Annual Symposium on Foundations of Computer Science, pages 312{320, 1982.
* E. G. Coffman, M. R. Garey, and D. S. Johnson. Approximation algorithms for bin packing: A survey. In D. Hockbaum, editor, Approximation Algorithms for NP-Hard Problems, pages 46--93, Boston, MA, USA, 1996. PWS Publishing

Bin Packing Problem

1 Outline


2 Original Bin Packing Problem

In original bin packing problem, we are given a list of n items L={a1,a2,…,an} and infinite number of bins with capacity C.

The size of i-th item ai is s(ai), where 0 < s(ai) ≤ C.

The problem is to pack the items in minimum number of bins under the constraint that the total size of items in each bin cannot exceed the capacity of the bin.


3 On-line Algorithms for Original Bin Packing Problem

On-line bin packing algorithms are the algorithms which packs each item one by one without any knowledge of the next items. Thus, approximation factor of these algorithms are higher than offline algorithms in which size and number of items in the list are known before starting to pack them.

In this section, we give very brief information about some naive online algorithms to warm you up.

3.1 Definitions

The following definitions will be used in this section when we talk about on-line algorithms for original bin packing problem.

3.2 Next-Fit (NF)

  1. Pack the first item into the first bin
  2. For each successive item
    1. If it fits in the bin that contains the last packed item, pack in that bin.
    2. Otherwise, close this bin and pack the item in an empty bin.

The disadvantage of this algorithm is that it closes a bin that can be used in the future. This algorithm packs a list of items and its reverse in the same number of bins. The asymptotic performance ratio (APR) of NF is as following
NF(I) ≤ 2*OPT(I) if 1/2 < p ≤ 1
NF(I) ≤ (1-p)-1*OPT(I) if 0 < p ≤ 1/2

3.3 Worst-Fit (WF)

  1. If there are no open bins in which the current item fits, pack the item into an empty bin.
  2. Otherwise, pack the item into the bin of smallest content in which the item fits.

Although WF never closes a bin, the APR of this algorithm same as the previous one.

3.4 First-Fit (FF)

  1. Pack the current item into the lowest indexed nonempty bin in which it fits.
  2. If there is no bin in which the current item can fit, pack the item in an empty bin.

3.5 Best-Fit (BF)

  1. If there are some bins in which the current item can fit, pack the item into the bin of largest content in which the item fits.
  2. Otherwise, pack the the item into an empty bin.

3.6 Conclusion on on-line algorithms

The drawback of these on-line algorithms is their performance when size of items in the list or part of the list are in increasing order. If a list is in increasing order, the performances of the on-line algorithms suffer greatly.

Even "average-case" lists that have portions in increasing order can greatly affect an on-line algorithm's approximation guarantee ratio. For example, when the bin size is 1, then following list of items will be packed into 3 bins according to all four on-line algorithms...

.2, .7, .3, .8
It is easy to see that these items can be packed into two bins. We touched the approximation guarantee of some algorithms above, but in general the analysis of these algorithms are very complicated and it is out of scope of this tutorial. You can read the papers listed in references for more information.


4 Extensible Bin Packing Problem

Extensible bin packing problem is a variation of original bin packing problem. In this problem, number of bins is given as an input. The capacity of each bin is 1 and bins may be extended to hold more than their capacities. The cost of a bin is 1 if it is not extended, and the total size of items in it if it is extended. The goal of this problem is to pack a set of items of given sizes into the specified number of bins in a way to minimize the total cost. In this tutorial, a fully polynomial time asymptotic approximation scheme (FPTAAS) is introduced for extensible bin packing problem.

Extensible bin packing has a number of important real world applications such as:


5 A FPTAAS for Extensible Bin Packing Problem

5.1 Introduction

Input Notations Goal

5.2 Algorithm

We present an algorithm A(I,ε), which takes a problem instance and a parameter ε and produces an approximation guaranteeing that
A(I,ε) ≤ (1 + ε)OPT(I) + O(ε-1logε-1)
in time bounded by a polynomial in n and ε-1
Before showing how this algorithm produces this approximation guarantee, we can make some assumptions without loss of generality for the sake of simplicity. For each assumption, we prove that this assumption can be made without loss of generality.

5.2.1 First Assumption

There are no small items. In other words
xi > ε/(1+ε) for i=1,2,…,n
Proof
Suppose we have an approximation algorithm A which guarantees given approximation guarantee with so small items. We can use this algorithm to pack an arbitrary list of items as following:
  1. First, use A to pack items that are not small
  2. Pack the small items greedily.
There are two cases when we pack small items
  1. Packing small items does not increase the cost. Then we clearly satisfy the approximation guarantee.
  2. Packing small items does increase the cost. For convenience, let ε equal to ε/(1+ε) (maximum size of a small item). Then we can say that before packing small items the level of each bin is at least 1 - ε. Therefore
OPT(I) ≥ j=1..m l(bj) > m(1-ε)
A(I) ≤ j=1..m max(1,l(bj)) ≤ j=1..m l(bj)+ε ≤ mε + j=1..m l(bj)
(A - OPT(I))/OPT(I) ≤ mε/m(1-ε) = ε.

5.2.2 Second Assumption

There are no big items. In other words
xi < 1 for i=1,2,…,n
Proof
We claim that there is an optimum packing algorithm which packs big items into a bin by itself. Similar to the proof given above, we can construct an 1+ε approximation algorithm from 1+ε which packs without big items. Suppose some optimum packing placed some item x in a bin together with a big item. Then we could move x to another bin that does not contain a big item without increasing the cost.

5.2.3 Third Assumption

Total size of all items cannot exceed 2m
x=1..n xi < 2m
Proof
When there are no big items, greedy method guarantees that as long as any bin is packed to a level of less than 1, no bin will be packed to a level of 2 or more. In other words, when a bin is packed to a level at least 2, then the cost of packing is simply the sum of items, so the packing is optimum. Thus, we can make this assumption without loss of generality.

5.2.4 Fourth Assumption

The level of a bin cannot exceed 3.
l(bj) < 3 for j=1,2,…,m
Proof
Suppose, there is a bin of level 3 or more. According to the previous assumption, there will be a bin of level less than 2. Thus, we can move an item from bin that has higher level to the other level without increasing the cost. Therefore, without loss of generality, we can assume that the level of any bin is at most 3.
For convenience, we will show that
A(I,ε) ≤ (1 + ε)2OPT(I) + O(ε-1log{ε-1})
We can obtain original approximation guarantee by a different choice of ε

In high level, this algorithm works as following:
First we group the items in terms of their sizes. (We round the sizes up to specified values) Then we define different ways of packing these items in bins. Then coarsening method (dynamic programming) gives a way of packing all items at minimum cost. (We give an ILP to find the optimum result.)
It is an approximation algorithm because we change the size of the items, and we relax ILP to LP. We will round the sizes of items up to s1, s2, ..., sN where N is the smallest value for the following inequality
⌊(1+ε)j/ε⌋ε2 ≥ 1
According to the inequality above, N approximately equals to ε-1lnε{-1}
We define the value of s1,s2,…,sN according to the following equation
sj = ⌊(1+ε)j/ε⌋ε2 for 1≤ j<N
sj = 1 for j=N
Thus,

  1. s1 < s2 < … < sN
  2. sN = 1. (Recall that we assume that the maximum size of an item is 1.)
  3. If sj-1 <xi ≤ sj then round xi to sj.

Increase ratio of items of size less than s1
s1/(ε/(1+ε)) ≤ ⌊(1+ε)/ε⌋ε2/(ε/(1+ε)) ≤ (1+ε)2

Increase ratio of items of size larger than s1
sj+1/sj = ⌊(1+ε)j+1ε-1⌋/⌊(1+ε)jε-1⌋ ≤ (1+ε)j+1ε-1/((1+ε)jε-1-1) = (1+ε)j+1/((1+ε)j - ε) ≤ (1+ε)j+1/ (1+ε)j-1 ≤ (1+ε)2
 

Thus, Rounding increases the cost of the optimum solution by a factor of at most (1+ε)2)


upload:sbozdag_configuration_table.gif

The figure given above gives an intuitive explanation for the ILP we introduce in next section.
Each row in this table is a configuration. In each configuration we pack a number of items of each size (Cij) such that the level of the bin is at most 3. The number of configurations can be in terms of ε.
We can use a configuration zi times in the solution. Our goal is to pack all items and use all bins. These are the constraints in ILP given below.


5.3 Integer Linear Program

zi: number of times we use i-th configuration
Objective function:
min i=1..M zi.max(1,j=1..N Cijsj)
subject to
i=1..M ziCij ≥ nj for j=1,2,…,N (We need to pack all items of each size)
i=1..M zi ≥ m(We need to use all bins)
zi ∈ {0,1,2,ldots} (We can use a configuration any time we want)

When we relax this ILP to LP by allowing zi to be any nonnegative value, number of inequalities in LP will be N+1.
Thus,

Relaxation increases the optimum solution by at most 3(N+1) = O(ε-1logε-1) which is the asymptotic part in the approximation guarantee shown in the beginning.

Thus, this algorithm gives a solution with an approximation guarantee
A(I,ε) ≤ (1 + ε)OPT(I) + O(ε-1logε-1)


References


ClassS04CS141 | ClassW04ApproxAlgs | recent changes | Preferences
This page is read-only | View other revisions
Last edited March 19, 2004 6:09 pm by adsl-67-114-254-153.dsl.lsan03.pacbell.net (diff)
Search: