Presentation is loading. Please wait.

Presentation is loading. Please wait.

A new and improved algorithm for online bin packing

Similar presentations


Presentation on theme: "A new and improved algorithm for online bin packing"— Presentation transcript:

1 A new and improved algorithm for online bin packing
János Balogh József Békési University of Szeged, Szeged, Hungary György Dósa University of Pannonia, Veszprem, Hungary Leah Epstein University of Haifa, Haifa, Israel Asaf Levin The Technion, Haifa, Israel

2 Problem definition : Online bin packing
Items Arriving one by one Item i has a size si(0,1] Assign (pack) items to bins such that The number of bins is minimized Every item is packed (irrevocably) before the next item arrives The total size of items of one bin is at most 1

3 Measure: Asymptotic analysis
Standard for bin packing problems The cost of an algorithm is compared to the cost of an optimal solution on instances where the latter grows to infinity The algorithms here are online (Asymptotic) competitive ratio for online problems (Asymptotic) approximation ratio for offline problems Bin packing was studied in the past with respect to theses measures

4 Asymptotic competitive ratio - definition
The (asymptotic) competitive ratio is the infimum R which satisfies for every sequence σ: ALG(σ)≤R*OPT(σ)+c. c is a non-negative constant, which does not depend on the sequence.

5 Online bin packing – lower bounds
Yao ‘80 – 1.5. Brown ‘79 and Liang ’ van Vliet ‘92– Balogh, Bekesi, and Galambos ‘12– ([BBDEL] arxiv ).

6 Our result A new algorithm for online bin packing with an asymptotic competitive ratio of The current best algorithm  A new and simplified weight function analysis.

7 The HARMONIC Algorithm (Lee&Lee,1985)
Classify items according to size Each bin contains items from only one class: i items of type i Items of last type are packed using NEXT FIT. size type n+1 1 1/2 1/4 1/3

8 The HARMONIC Algorithm Weighting function
Assign weights to items based on their type. i items of type i per bin => weight of item in class i is 1/i type n +1: size x => weight Then for any set of items: number of bins used by HARMONIC = total weight + O(1) = maximum weight that can be packed (offline) in a single bin ≈ 1.691

9 The HARMONIC Algorithm - improvements
Motivation: A bad sequence for HARMONIC is N items of size 1/7+ε, N items of size 1/3+ ε, and N items of size 1/2+ ε. Here, OPT has a cost of N, while HARMONIC has cost of N(1+1/2+1/6). One drawback is that bins used for items slightly larger than 1/2 are not reused for additional items.

10 The HARMONIC Algorithm – improvements (cont.)
A better strategy for this instance would be: We partition the class of items with size in (1/2,1] to two classes (1/2,0.6] and (0.6,1]. We partition the class of items with size in (1/3,1/2] to two classes (1/3,0.4] and (0.4,1/2].

11 The HARMONIC Algorithm – improvements (cont.)
The class of items with size in (1/3,0.4] is associated with a proportion α such that α fraction of its items are packed in pairs and (1- α ) fraction of its items are packed alone or with an item of size in (1/2,0.6] (if it exists). When an item of size (1/2,0.6] arrives we try to pack it into a bin already containing an item of size in (1/3,0.4] that is supposed to be packed alone. Other classes of items are packed as in HARMONIC.

12 On the analysis of such improvements
There are two scenarios (cases): Either all items of sizes in (1/2,0.6] are packed together with smaller items, or all items of sizes in (1/3,0.4] are packed in pairs (with either another item of this class or a larger item). There is a weight function for each scenario. The resulting algorithms (with some small changes and finer partition of (1/2,1]) give the following improvements: Refined Harmonic (Lee & Lee, 85) comp. ratio Modified Harmonic (Ramanan, Brown, Lee, & Lee, 89) comp. ratio Modified Harmonic 2 ([RBLL]) comp. ratio

13 Super Harmonic – Seiden’02
Idea: we can try to match items of pairs of classes even if these classes are not larger than ½. There is a partition of (0,1] into (finitely many) classes. We pack items into containers and match containers into bins. For each class j there is a parameter α(j). An α(j) fraction of its items are packed in containers each of which with the maximum possible number of items of the class that fit into one bin, and (1- α(j)) fraction of its items are packed alone into containers. When a new container is created we know its (planned upper bound on the) total size, and we try to match two containers in every bin – a container with total size > ½ together with a container with total size ≤ ½.

14 super Harmonic – Seiden analysis
a = the minimum total size of the smallest container of total size > ½ that is unmatched. a defines the scenario. For each scenario, there is a weight system Comp. ratio A weight system is not a weight function !!!

15 Weight system - disadvantages
Too complicated … This tool is more difficult to adjust for the analysis of new tricks.

16 Previous trick: combining items by exact sizes
An algorithm of Babel, Chen, Kellerer, Kotov, 2004 for cardinality constraint bin packing with k=2. This problem is equivalent to the special case of bin packing when all items are of sizes in (1/3,2/3). ratio of 1.5 is easy (greedy matching) and it is improved to [BCKK04]. Observation: when we need to test if we can match a container with one item in (1/3,1/2] together with a container with one item in (1/2,2/3) we can check if the two items fit into one bin and this check cannot be implemented by partitioning into classes. Obviously, when we pack a second item into an existing bin it is better to break ties in favor of a (previous) item of maximum size.

17 Using this new trick Heydrich and van Stee ‘16 claimed that using this trick and combining it with the super Harmonic framework gives a better algorithm for online bin packing. Their analysis is based on modifying the weight system analysis of Seiden and it is supposed to give a comp. ratio of (arxiv version v7 from June 18).

18 Our algorithm (AH) Goal – finding a better algorithm. Methods:
Use weight function analysis – simpler and provide at least as good results as the weight system approaches. Implementing the following algorithmic improvements (over super Harmonic): Use the matching by exact sizes method when trying to match two containers each of which with only one item. Allow different cardinalities of containers for every class (e.g. items slightly larger than 1/7 can be packed in containers each of which with 6 items (of this class), with two items (of this class) and with only one item (of this class). Allow the set of tiny items which are smaller than ε to be packed into containers and in bins containing a container with larger items. Our result: comp. algorithm for online bin packing.

19 AH Partition items into classes based on their size.
Huge item – size in (1/2,1] Large item – size in (1/3,1/2] Small item – size in (ε,1/3] Tiny items – size at most ε. There are many classes of large items and of small items.

20 Packing items of a class into containers
A huge item is packed alone into its container. For a class of small items we have some predetermined cardinalities (called types) for containers of the class: Each such cardinality has a fixed proportion. We try to pack the next item into existing container (if there is one with room for more items). If all existing containers are full, we open a new container and decide its type (based on the proportions) and pack the new item there. For the class of tiny items, we apply similar methods but here the types of containers are defined based on the total size of items.

21 Packing large items into containers
For a class of large items we have four types: A regular type 2 container that already contains two items of the class. A declared type 2 container that currently contains one item but AH has decided to have two items there. We have only a constant number of such containers. A regular type 1 container that has one item and cannot get more items later. A temporary type 1 container that has one item and perhaps will get another one later. We fix the proportion of the total number of regular type 1 and temporary type 1 containers but not of a single type among these types. If we need to increase the number of type 2 containers by changing one of the temporary type 1 containers into type 2, we pack the new item into a container with the largest item that was in a temporary type 1 container. If a new type 1 container for the item is needed and we will open a new bin for it, then this container is a temporary type 1.

22 Matching containers into bins
A volume of a container is: The size of a unique item in the container if it has only one item. The upper bound on the total size of items that can fit into this type of containers if it may have more than one item. Special rules for large items: A temporary type 1 has volume equal to the size of the item, a declared type 2 has volume like regular type 2. Two containers fit into a bin if their total volume is at most 1. We try to fit one container of volume larger than ½ with one container of volume at most ½ (but not several containers with volume smaller than ½). We break ties in favor of matching a new container with the largest container that fits. We define a finer tie-breaking rule to ease the formal analysis.

23 Analysis – scenario set
Let a be the smallest volume of unmatched container that is > ½. The scenario index is the class containing the value 1-a. Required weight of a container (for a given scenario): 1 for a container with volume ≥ a. w (decision variable) for a container with volume in (1/2,a]. 1 for a container with volume in (1-a,1/2]. 1-w for a container with volume at most 1-a.

24 Assigning weights to items
Huge item: weight = required weight of its container. The general rule: The weight of a small or large item is the ratio between the average required weights of the containers (of its class) and the average cardinality of these containers. A similar rule for tiny items. A special case for large items of a class containing 1-a. For such an item its weight is u if its size is at most 1-a and v otherwise (u and v are decision variables).

25 The analysis (cont.) Based on the numerical values of u,v,w, the weight function is well defined. We prove that if we impose a (small number of) linear inequalities on u,v,w, then this weight function is valid. Analytic proof showing that these linear inequalities ensure that (after ignoring a constant number of bins) the average total weight of items in a bin of AH is at least 1. We still prefer to use values of u,v,w for which the resulting provable comp. ratio is as small as possible.

26 The analysis – final steps
We select the values of u,v,w for each scenario using a linear programming solver (but this is not needed for the proof). We use an optimal (exact) algorithm for the knapsack problem to bound the total weight of items that fit into a bin. This part of the proof is computer-assisted. The resulting overall (over all scenarios) upper bound on the total weight that fit into a bin is

27 Questions


Download ppt "A new and improved algorithm for online bin packing"

Similar presentations


Ads by Google