Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT...

17
Tight Bounds for Online Class-constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT

Transcript of Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT...

Page 1: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

Tight Bounds for Online Class-constrained Packing

Hadas ShachnaiBell Labs and The Technion IIT

Tami TamirThe Technion IIT

Page 2: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

2

Problem Definition

We need to pack items into bins.

•All the bins have the same capacity.

•Each bin can accommodate items from a bounded number of colors.

•All items have the same (unit) size. Each item has a color (type).

Page 3: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

3

Notationsn - number of items in the instance.

M - number of distinct colors in the instance.

v - bin’s capacity.

c- number of compartments in a bin.

(The bin can accommodate v items of c distinct colors)

Example of class-constrained packing

n=15, M=5 v = 5, c = 2

Page 4: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

4

Class-constrained bin-packing (CCBP):

Pack all the items in a minimal number of bins.

Class-constrained multiple knapsack (CCMK):

Given m knapsacks (bins), pack as many items as possible in the bins.

Optimization Goals:

For CCBP, max( n/v , M/c ) is a lower bound for the number of required bins.

Performance measure (for CCBP): For an instance I, let Nopt denote the number of bins used by an optimal algorithm to pack all the items of I. An algorithm is r-competitive if it packs all the items of I at most r·Nopt bins.

Page 5: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

5

ApplicationsMultimedia on Demand Systems: The system receives requests for broadcasts of M movies. The requested movie should be transmitted by a shared disk. Each disk has limited load capacity, v, and limited storage capacity, c.

Production Planning: Each device possesses some amount, v, of a shared resource and can be set to c distinct configurations. There are M distinct products.

c=2

v=5

Page 6: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

6

Online Class-constrained Packing :

•The items arrive one at a time. In each step we get one unit size item of some color.

•We need to pack this item without any knowledge of the subsequent items.

•Formally, the instance is given as a sequence, =a1,a2,.. of length n, such that k, ak{1,..,M}.

• Online CCBP: use a minimal number of bins to pack all the items in .

• Online CCMK: Maximize the number of packed

items in (arriving items may be rejected).

Page 7: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

7

Online Class-constrained Packing,

An Example of CCBP.

=

First-fit Algorithm: Put an arriving item in the leftmost bin that can accommodate it.

First-fit packing Possible optimal packing

v = 5

c = 2

Page 8: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

8

Results :Deterministic Algorithms for CCBP

• For a sequence, , of length n, let k = M/c -1 and h = n/v -1.

• Sc,v(k,h) = the set of input sequences with k,h.

• Lower Bound: For any deterministic algorithm,

rd(Sc,v(k,h)) 1+ (k+1- kc+1/v)/(h=1).

(asymptotically, rd2).

• This bound is achieved by first-fit.• Another simple algorithm (color sets), achieves r2.

• An a-priori knowledge of n, M does not help.

Page 9: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

9

Lower Bound for Deterministic Algorithms

Theorem: for any deterministic algorithm A, rA 2.

Proof: The adversary constructs the sequence, , online such that some bins include v items from few colors and some bins include c items from c distinct colors.

The idea: repeat in items of the same color. Switch to the next color whenever an item is packed in one of the ‘bad bins’. This color will not be repeated anymore in .

bad bins

v = 10c = 3

Page 10: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

10

The packing of the algorithm

An optimal packing: The rear colors spread among the bins

A closer analysis of the adversary’s strategy yields a lower bound that depends on the ratios n/v and M/c.

Page 11: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

11

Upper Bound for First-fit

Theorem: rff 2.

Proof: Let S1 be the set of full bins (v items); S2 is the set of occupied bins (c distinct colors).

Claim 1: Each bin (except maybe for the last one) is either full or occupied.

Claim 2: Each bin in S2 (except maybe for the last one) contains the last item of each of its c colors. (any additional appearance of a color can fit into this bin).From Claim 1, Nff = |S1|+|S2|.

From Claim 2, |S2| M/c. Also, |S1| n/v.

Since Nopt max( n/v , M/c ) we get a 2-

approximation.

Page 12: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

12

Next-fit AlgorithmNext-fit algorithm: Put an arriving item in the currently active bin. Open a new bin if the active bin cannot accommodate this item.

For traditional online bin-packing, it is known that Next-fit uses as most 2·NOPT bins.

This is not the case for class-constrained packing:

=

Next-fit packing ( 15/2 bins) Optimal packing (3 bins)

r= v/c

v=5 c=2

Page 13: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

13

Class-constrained Packing of Temporary Items

• Items are packed for a bounded time interval (that is unknown in advance)

• The sequence consists of

1. arrival of an item a of color i{1,..,M}.

2. departure of an item that was packed earlier.

We consider two models:

1. A departure is associated with a specific item (of specific color, placed in specific bin).

2. A departure is associated with a color; thus, we may choose which item of that color to remove.

Page 14: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

14

Results for CCBP of Temporary Items

•For any deterministic algorithm, r v/c.

•For all any-fit algorithms, r v/c (An any-fit algorithm opens a new bin only when no open bin can accommodate the new item).

•When departure events are associated with colors, for all any fit algorithms r min(v/c, c-1).

•The color-sets algorithm has r=v (the worst possible).

•An a-priori knowledge of n, M does not help.

Page 15: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

15

The Online Class-Constrained Multiple Knapsack Problem

Our Results:

•For any v c, and any deterministic algorithm, Ad, for CCMK, rd c/v.

•This ratio is achieved by any greedy algorithm (reject only items that cannot fit to any knapsack).

•For any v c, any deterministic algorithm, Ad, for temporary CCMK, and any 0, rd .

Performance measure:

number of items packed by the algorithm A

number of items packed by an optimal algorithm

rA() =

Page 16: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

16

Related Work

• Online bin packing (items with arbitrary sizes) rff 1.7 (Johnson and Demers, 1974)

rA 1.54 for deterministic algorithms (Van Vliet,1996)

• Offline class-constrained packing (Shachnai and Tamir, 2001).

• Data placement (Golubchik, Khanna, Khuller, Thurimella, and Zhu, 2000).

• Scheduling tasks with unknown durations

(Azar, Broder and Karlin, 1994).

Page 17: Tight Bounds for Online Class- constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT.

17

=

color-sets packing Possible optimal packing

v = 5

c = 2

The Color-sets Algorithm

The algorithm: Partition (online) the M colors in into M/c color-sets. Pack the items of each color-set greedily.

Color-sets

Theorem: rcs < 2