170 likes | 310 Views
Tight Bounds for Online Class-constrained Packing. Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT. Problem Definition. We need to pack items into bins. All items have the same (unit) size. Each item has a color (type). All the bins have the same capacity.
E N D
Tight Bounds for Online Class-constrained Packing Hadas Shachnai Bell Labs and The Technion IIT Tami Tamir The Technion IIT
Problem Definition We need to packitems into bins. • All items have the same (unit) size. Each item has a color (type). • All the bins have the same capacity. • Each bin can accommodate items from a bounded number of colors.
Example of class-constrained packing n=15, M=5 v = 5, c = 2 Notations n - 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)
Optimization Goals: 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. 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 Noptdenote 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.
Applications Multimedia 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. c=2 v=5 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.
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).
Possible optimal packing Online Class-constrained Packing, An Example of CCBP. First-fit Algorithm: Put an arriving item in the leftmost bin that can accommodate it. = v = 5 c = 2 First-fit packing
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.
bad bins 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. v = 10 c = 3 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 .
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.
Upper Bound for First-fit Theorem:rff2. Proof: LetS1be the set of full bins (v items);S2is 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.
= r= v/c Next-fit packing ( 15/2 bins) Optimal packing (3 bins) Next-fit Algorithm Next-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: v=5 c=2
Class-constrained Packing of Temporary Items • Items are packed for a bounded time interval (that is unknown in advance) • The sequence consists of • arrival of an item a of color i{1,..,M}. • departure of an item that was packed earlier. • We consider two models: • A departure is associated with a specific item (of specific color, placed in specific bin). • A departure is associated with a color; thus, we may choose which item of that color to remove.
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.
The Online Class-Constrained Multiple Knapsack Problem Performance measure: number of items packed by the algorithm A number of items packed by an optimal algorithm rA() = • OurResults: • 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.
Related Work • Online bin packing (items with arbitrary sizes) • rff1.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).
Possible optimal packing The Color-sets Algorithm The algorithm: Partition (online) the M colors in into M/ccolor-sets. Pack the items of each color-set greedily. Theorem: rcs < 2 = Color-sets v = 5 c = 2 color-sets packing