The Maximum Resource Bin Packing Problem

Similar documents
The Relative Worst Order Ratio for On-Line Algorithms

A Robust APTAS for the Classical Bin Packing Problem

Online Interval Coloring and Variants

A robust APTAS for the classical bin packing problem

Theoretical Evidence for the Superiority of LRU-2 over LRU for the Paging Problem

Online Algorithms for 1-Space Bounded Multi Dimensional Bin Packing and Hypercube Packing

On-line Bin-Stretching. Yossi Azar y Oded Regev z. Abstract. We are given a sequence of items that can be packed into m unit size bins.

A new analysis of Best Fit bin packing

Optimal analysis of Best Fit bin packing

Colored Bin Packing: Online Algorithms and Lower Bounds

Alternatives to competitive analysis Georgios D Amanatidis

A note on semi-online machine covering

Online bin packing 24.Januar 2008

S. ABERS Vohra [3] then gave an algorithm that is.986-competitive, for all m 70. Karger, Phillips and Torng [] generalized the algorithm and proved a

Discrete Applied Mathematics. Tighter bounds of the First Fit algorithm for the bin-packing problem

Randomized algorithms for online bounded bidding

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

A lower bound for scheduling of unit jobs with immediate decision on parallel machines

A Theoretical Comparison of LRU and LRU-2

Machine Minimization for Scheduling Jobs with Interval Constraints

Bin packing and scheduling

Online Scheduling of Parallel Jobs on Two Machines is 2-Competitive

Lecture 6,7 (Sept 27 and 29, 2011 ): Bin Packing, MAX-SAT

8 Knapsack Problem 8.1 (Knapsack)

A Lazy Bureaucrat Scheduling Game

immediately, without knowledge of the jobs that arrive later The jobs cannot be preempted, ie, once a job is scheduled (assigned to a machine), it can

Optimal Online Algorithms for Multidimensional Packing Problems

On-line Scheduling to Minimize Max Flow Time: An Optimal Preemptive Algorithm

Polynomial Time Algorithms for Minimum Energy Scheduling

The Relative Worst Order Ratio Applied to Paging

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

ILP Formulations for the Lazy Bureaucrat Problem

First Fit bin packing: A tight analysis

bound of (1 + p 37)=6 1: Finally, we present a randomized non-preemptive 8 -competitive algorithm for m = 2 7 machines and prove that this is op

On Two Class-Constrained Versions of the Multiple Knapsack Problem

CS264: Beyond Worst-Case Analysis Lecture #15: Smoothed Complexity and Pseudopolynomial-Time Algorithms

Scheduling Parallel Jobs with Linear Speedup

CS264: Beyond Worst-Case Analysis Lecture #18: Smoothed Complexity and Pseudopolynomial-Time Algorithms

Aditya Bhaskara CS 5968/6968, Lecture 1: Introduction and Review 12 January 2016

SIGACT News Online Algorithms Column 26: Bin packing in multiple dimensions

Online algorithms for parallel job scheduling and strip packing Hurink, J.L.; Paulus, J.J.

All-norm Approximation Algorithms

Online Coloring of Intervals with Bandwidth

Approximation Schemes for Scheduling on Parallel Machines

On the Competitive Ratio of the Work Function Algorithm for the k-server Problem

Complexity of determining the most vital elements for the 1-median and 1-center location problems

Dynamic Bin Packing for On-Demand Cloud Resource Allocation

Algorithms. Outline! Approximation Algorithms. The class APX. The intelligence behind the hardware. ! Based on

Single processor scheduling with time restrictions

Completion Time Scheduling and the WSRPT Algorithm

CS6999 Probabilistic Methods in Integer Programming Randomized Rounding Andrew D. Smith April 2003

Semi-Online Multiprocessor Scheduling with Given Total Processing Time

1 Ordinary Load Balancing

This means that we can assume each list ) is

The Maximum Flow Problem with Disjunctive Constraints

Dispatching Equal-length Jobs to Parallel Machines to Maximize Throughput

arxiv:cs/ v1 [cs.ds] 20 Dec 2006

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Algorithms: COMP3121/3821/9101/9801

Static-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Static-priority Scheduling

A lower bound on deterministic online algorithms for scheduling on related machines without preemption

Online Bin Packing with Resource Augmentation

Matchings in hypergraphs of large minimum degree

An analysis of the LPT algorithm for the max min and the min ratio partition problems

The 2-valued case of makespan minimization with assignment constraints

Approximation Algorithms

Approximation results for the weighted P 4 partition problem

Packing Resizable Items with Application to Video Delivery over Wireless Networks

An approximation algorithm for the minimum latency set cover problem

The Complexity of Maximum. Matroid-Greedoid Intersection and. Weighted Greedoid Maximization

Online bin packing with delay and holding costs

Approximation Basics

Convergence Rate of Best Response Dynamics in Scheduling Games with Conflicting Congestion Effects

Preemptive Online Scheduling: Optimal Algorithms for All Speeds

Common-Deadline Lazy Bureaucrat Scheduling Problems

COSC 341: Lecture 25 Coping with NP-hardness (2)

Online Removable Square Packing

On-line Scheduling of Two Parallel Machines. with a Single Server

Motivating examples Introduction to algorithms Simplex algorithm. On a particular example General algorithm. Duality An application to game theory

ON THE COMPLEXITY OF SOLVING THE GENERALIZED SET PACKING PROBLEM APPROXIMATELY. Nimrod Megiddoy

Lecture 6: Greedy Algorithms I

Theorem (Special Case of Ramsey s Theorem) R(k, l) is finite. Furthermore, it satisfies,

How much can lookahead help in online single machine scheduling

Online Scheduling with Bounded Migration

Discrepancy Theory in Approximation Algorithms

Heuristics for Solving the Bin-Packing Problem with Conflicts

Dispersing Points on Intervals

Online Scheduling of Jobs with Fixed Start Times on Related Machines

Perfect Packing Theorems and the Average-Case Behavior of Optimal and Online Bin Packing

Out-colourings of Digraphs

Machine scheduling with resource dependent processing times

Single processor scheduling with time restrictions

arxiv: v1 [cs.ds] 6 Jun 2018

Efficient approximation algorithms for the Subset-Sums Equality problem

NP-Completeness. NP-Completeness 1

arxiv:cs/ v2 [cs.ds] 23 Aug 2006

Combinatorial Algorithms for Minimizing the Weighted Sum of Completion Times on a Single Machine

An Optimization-Based Heuristic for the Split Delivery Vehicle Routing Problem

Introduction to Bin Packing Problems

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Transcription:

The Maximum Resource Bin Pacing Problem Joan Boyar Leah Epstein Lene M. Favrholdt Jens S. Kohrt Kim S. Larsen Morten M. Pedersen Sanne Wøhl 3 Department of Mathematics and Computer Science University of Southern Denmar, Odense, Denmar {joan,lenem,svalle,slarsen,mortenm}@imada.sdu.d Department of Mathematics University of Haifa, 3905 Haifa, Israel lea@math.haifa.ac.il 3 Department of Organization and Management University of Southern Denmar, Odense, Denmar swo@sam.sdu.d Abstract Usually, for bin pacing problems, we try to minimize the number of bins used or in the case of the dual bin pacing problem, maximize the number or total size of accepted items. This paper presents results for the opposite problems, where we would lie to maximize the number of bins used or minimize the number or total size of accepted items. We consider off-line and on-line variants of the problems. For the off-line variant, we require that there be an ordering of the bins, so that no item in a later bin fits in an earlier bin. We find the approximation ratios of two natural approximation algorithms, First-Fit-Increasing and First-Fit-Decreasing for the maximum resource variant of classical bin pacing. For the on-line variant, we define maximum resource variants of classical and dual bin pacing. For dual bin pacing, no on-line algorithm is competitive. For classical bin pacing, we find the competitive ratio of various natural algorithms. We study the general versions of the problems as well as the parameterized versions where there is an upper bound of on the item sizes, for some integer. The wor of Boyar, Favrholdt, Kohrt, and Larsen was supported in part by the Danish Natural Science Research Council (SNF). The wor of Epstein was supported in part by the Israel Science Foundation (ISF). A preliminary version of this paper appeared in the proceedings of the Fifteenth International Symposium on Fundamentals of Computation Theory, 005.

INTRODUCTION Introduction Many optimization problems involve some resource, and the tas for algorithm designers is typically to get the job done using the minimum amount of resources. Below, we give some examples. Bin pacing is the problem of pacing items of sizes between zero and one in the smallest possible number of bins of unit size. Here, the bins are the resources. The traveling salesperson problem is the problem of finding a tour which visits each vertex in a weighted graph while minimizing the total weight of visited edges. Here the weight is the resource. Scheduling jobs on a fixed number of machines is the problem of minimizing the completion time of the last job. Here time is the resource. Each of these problems come in many variations and there are many more entirely different optimization problems. Since these problems are computationally hard, the optimal solution can usually not be computed in reasonable time for large instances, so polynomial time approximation algorithms are devised. For many of these problems, there are interesting variants where the entire instance is not nown when the computation must commence. The area of on-line algorithms deals with this problem scenario. For detailed descriptions of many of these problems and their solutions in terms of approximation or on-line algorithms, see [4, 0, 3], for instance. For all of these problems, minimizing the resources used seems to be the obvious goal. However, if the resource is not owned by the problem solver, but is owned by another party who profits from selling the resource, there is no longer agreement about the objective, since the owner of the resource wants to maximize the resources used, presumably under some constraints which could be outlined in a contract. Thus, many of the classical problems are interesting also when considered from the reverse perspective of trying to maximize the amount of resources that are used. In [], the Lazy Bureaucrat Scheduling Problem is considered. Here, tass must be scheduled and processed by an office worer. The authors consider various constraints and objective functions. The flavor of the constraints is that the office worer cannot sit idle if there is wor that can be done, and the office worer s objective is to schedule tass under these constraints so as to minimize the wor carried out; either total wor, arranging to leave wor as early as possible, or a similar goal. Though it is presented as a toy problem, it is an important view on some optimization problems, and many other problems are interesting in this perspective, provided that the constraints imposed on the problem are natural. Also other problems have been investigated in this reverse perspective, e.g., longest path [], maximum traveling salesperson problem [] and lazy online interval coloring [9]. Maximum Resource Bin Pacing In this paper, we consider bin pacing from the maximum resource perspective. We consider it as an approximation problem, but we also investigate two on-line variants of the problem. To our nowledge, this is the first time one of these reverse problems has been considered in an on-line setting. Note that the complexity status of the off-line problems studied in this paper is open.

INTRODUCTION 3 The abstract problem of pacing items of a given size into bins has numerous concrete applications, and for many of these, when the resource must be purchased, the reverse problem becomes interesting for one of the parties involved. We use the following concrete problem for motivation. Assume that we hire a company to move some items by truc from one site, the origin, to another, the destination. Say that the price we must pay is proportional to the number of trucs used. Some companies may try to maximize the number of trucs used instead of trying to get the items paced in few trucs. To prevent the company from cheating us, the following constraint has been placed on the pacing procedure: Constraint : When a truc leaves the origin, none of the unpaced items remaining at the origin should fit into that truc. In the off-line variant, Off-Line Maximum Resource Bin Pacing, we are given an unlimited number of unit sized bins and a sequence of items with sizes in (0, ], and the goal is to maximize the number of bins used to pac all the items subject to Constraint. A set of items fits in a bin if the sum of the sizes of the items is at most one. In the off-line variant, there must be an ordering of the bins such that no item in a later bin fits in an earlier bin. Explained using the motivating example, Constraint can be illustrated as follows: Trucs arrive at the origin one at a time. A truc is loaded, and may leave for its destination when none of the remaining items can fit into the truc. At this time, the next truc may arrive. On-Line Maximum Resource Bin Pacing is similar to the off-line version. However, the problem is on-line, meaning that items are revealed one at a time, and each item must be processed before the next item becomes available. Because of the on-line nature of the problem, instead of Constraint, the following modified constraint is used: Constraint : The company is not allowed to begin using a new truc if the current item fits in a truc already being used. Thus, the on-line algorithm is allowed to open a new bin every time the next item to be processed does not fit in any of the previous bins. The objective is still to use as many bins as possible. Thus, all partly loaded trucs are available all the time, and whenever an item does not fit, a new truc may pull up to join the others. We also consider another on-line problem, On-Line Dual Maximum Resource Bin Pacing. Here, the number of available bins is fixed. For each item, an algorithm has to accept it and place it in one of its bins, if it is possible to do so. Thus, here a fixed number of trucs have been ordered. In this case, neither Constraint nor Constraint is used; the objective is not to maximize the number of trucs used, since this number is fixed. There are two possible objective functions: the number of accepted items or the total size of the accepted items. In both cases, the objective is to minimize this value. Thus, the truc company wants to pac as few items or as little total size as possible into the trucs, minimizing the fuel needed for each truc, or maybe hoping to get a new order of trucs for the items which do not fit into the fixed number of trucs which have been ordered. For all three problems, we study the general version as well as the parameterized version where there is an upper bound of on the item sizes, for some integer.

NOTATION AND ALGORITHMS 4 A closely related problem is the Bin Covering Problem. In this problem, the algorithm is given a sequence of items and has to place them in bins, while trying to maximize the number of bins that contain items with a total size of at least one. This is quite similar to Off-Line Maximum Resource Bin Pacing with bins twice as large and Constraint replaced by the following weaer constraint: Constraint 3: No pair of trucs leaving the origin may have a total load of items that could have been paced in one truc. The problem is NP-complete but has an asymptotic fully polynomial time approximation scheme (AFPTAS) [4]. Further results on that problem can be found in [, 7, 8]. Our Results For Off-Line Maximum Resource Bin Pacing, we show that no algorithm has an approximation ratio of more than 7. For the parameterized version, the upper bound is + for. The 0 algorithm First-Fit-Decreasing is worst possible in the sense that it meets this upper bound. First- Fit-Increasing is better; it has a competitive ratio of and a parameterized competitive ratio of 5 + for. See Section for a definition of the algorithms. + For On-Line Maximum Resource Bin Pacing, we prove a general lower bound of 3 on the parameterized competitive ratio for 3 and + for 3. We prove a general upper bound of for and + for. Hence, for 3, all algorithms have the same parameterized competitive ratio. We prove that First-Fit, Best-Fit, and Last-Fit all meet the general upper bound. For On-Line Maximum Resource Dual Bin Pacing, we prove that if the objective function is the total number of items paced, no deterministic algorithm is competitive; this also holds for any value of for the parameterized problem. If the objective function is the total size of the paced items, no algorithm for the general problem is competitive. For the parameterized version, we prove general lower and upper bounds of + and +, respectively. e( ) The proof of Theorem 3, below, showing that for Off-Line Maximum Resource Bin Pacing, the approximation ratio of First-Fit-Increasing is, uses a new variant of the standard weighting 5 argument. That result also gives a connection between Off-Line Maximum Resource Bin Pacing and the relative worst order ratio for on-line algorithms for the classical bin pacing problem. The relative worst order ratio [5] is a new measure for the quality of on-line algorithms. Theorem 3 has been used to prove the upper bound on a result comparing First-Fit to Harmonic() using the relative worst order ratio []. Perhaps other reverse problems will have similar connections to the relative worst order ratio. Notation and Algorithms The input is a sequence of items, I = s, s,..., s n. For convenience, we identify an item with its size and require that item s i has size 0 < s i (or 0 < s i, for some integer, for the parameterized problem). The items have to be placed in bins of size one.

NOTATION AND ALGORITHMS 5 For any input sequence I, let ALG(I) be both the pacing produced when running ALG on this input sequence and the number of bins used for this pacing. In particular, let OPT be an algorithm which produces an optimal pacing, and let OPT(I) be both this pacing and the number of bins used. For the off-line variant, let SMALL(I) be a pacing using the minimum number of bins that the items from I can be paced in without putting items with sizes totaling more than one in any bin, and let SMALL be an algorithm that creates this pacing. Note that SMALL is an optimal algorithm from the classical bin pacing problem, but for Maximum Resource Bin Pacing, it is a worst possible algorithm. An approximation algorithm ALG is a c-approximation algorithm, c, if there is a constant b such that for all possible input sequences I, OPT(I) c ALG(I) + b. The infimum of all such c is called the approximation ratio of the algorithm, R ALG. For the parameterized problem, we consider the parameterized approximation ratio, R ALG (), which is the approximation ratio in the case where all items have size at most for some integer. An important algorithm in this context is First-Fit (FF), which places an item in the first bin in which it fits. In this paper, we investigate two well nown off-line variants of FF in detail: First-Fit-Increasing (FFI) handles items in non-decreasing order with respect to their sizes, placing them using First-Fit. First-Fit-Decreasing (FFD) handles items in non-increasing order with respect to their sizes, also placing them using First-Fit. In the on-line variants of the problem, the algorithms receive the input, i.e., the items, one at a time and have to decide where to pac the item before the next item (if any) is revealed. Similarly to the approximation ratio for approximation algorithms, the performance of deterministic on-line algorithms is measured in comparison with the optimal off-line algorithm OPT [, 7, 8]. An on-line algorithm ALG is c-competitive, c, if there is a constant b such that for all possible input sequences I, OPT(I) c ALG(I) + b. The infimum of all such c is called the competitive ratio of the algorithm, C ALG. For the parameterized problem, we consider the parameterized competitive ratio, C ALG (), which is the competitive ratio in the case where all items have size at most for some integer. For the on-line variants, we consider the following natural algorithms, all of which, except for Last-Fit, have been well studied in other contexts: First-Fit (FF) as defined previously. Last-Fit (LF) is the opposite of FF, i.e., it places a new item in the last opened bin in which it fits. Best-Fit (BF) places the item in a feasible bin which is as full as possible, i.e., a feasible bin with least free space.

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING Worst-Fit (WF) is the opposite of BF, i.e., it places an item in a feasible bin with most free space. 3 Off-Line Maximum Resource Bin Pacing For Off-Line Maximum Resource Bin Pacing, the goal is to maximize the number of bins used, subject to Constraint, so there must be an ordering of the bins such that no item placed in a later bin fits in an earlier bin. We show that no algorithm for the problem has an approximation ratio worse than 7. Then, we use the proof that for classical Bin Pacing, First-Fit s approximation 0 ratio is 7 [5] to prove that FFD has this worst possible approximation ratio. After that we show 0 that FFI has a better ratio of. 5 Theorem (General upper bound). For the Off-Line Maximum Resource Bin Pacing Problem, any algorithm ALG has a parameterized approximation ratio of 7 R ALG () 0, = +,. Proof. Consider any multiset of requests, I. The minimum number of bins, m, ALG could use on I is no less than the number of bins used by SMALL. Consider OPT s pacing of I, and create an ordered list I containing the items in I, starting with the items OPT paced in the first bin, followed by those in the second bin, etc., until all items have been included. By the restrictions on what an algorithm may do, First-Fit pacs the items in I exactly as OPT paced the items of I. By [5], the number of bins, n, used by First-Fit is at most 7 m +, if 0 =, and at most ( + 7 )m +, if. Thus, OPT uses at most m + bins, if =, and at 0 most ( + )m + bins, if, giving the stated ratio. This result is tight since First-Fit-Decreasing has this approximation ratio. Theorem. For the Off-Line Maximum Resource Bin Pacing Problem, the parameterized approximation ratio of FFD is 7 R FFD () = 0, = +,. Proof. The upper bounds follow from the previous theorem. To prove the lower bounds, we use the sequences and proofs from [5]. The contribution we mae is to show that with those sequences, FFD produces essentially the same pacing as SMALL (OPT in the proofs in [5]). The remainder of the proof is included only for completeness.

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING 7 We start with the case =. Let K be a positive integer, and define I to be a multiset that can be divided into three sets A, B, and C, each containing 0K items, which are described below. Let ε be a constant with 0 < ε 8 K, and let δ i = ε 8 K i for i K. Set A consists of items of the following sizes, for i K: a 0i = + 33δ i a i = 3δ i a i = a 3i = 7δ i a 4i = 3δ i a 5i = + 9δ i a i = a 7i = a 8i = a 9i = δ i Set B consists of items of the following sizes, for i K: b 0i = 3 + 4δ i b i = 3 34δ i b i = b 3i = 3 + δ i b 4i = 3 + δ i b 5i = 3 0δ i Set C consists of 0K items of size + ε. b i = b 7i = b 8i = b 9i = 3 + δ i We first consider the pacing, SMALL(I), given in [5], which uses 0K + bins, and then show that FFD uses the same number of bins in its pacing. After that we show how a legal pacing of the multiset using 7K bins can be constructed. In the pacing made by SMALL, each of the first 0K bins contains one item from A, one from B, and one from C, with the items from A and B paired up as follows: (i) a ji and b ji for j 9 and i K (ii) a 0i and b i for i K (iii) a i and b 0(i+) for i K The remaining three items are one of size + ε, b 0 and a K. These three items are paced into two bins by SMALL, giving a total of 0K + bins. FFD pacs the items from C first, one per bin, and the items from B on top of them, one per bin in non-increasing order. After this, the empty space in those 0K bins occurs in non-decreasing order. When the items from A are paced by FFD, they are each put in the bin with the smallest empty space in which they fit. Since FFD pacs one item from each of A, B, and C in each bin (except three of them) just as SMALL does, and it places the items from A in the bins that leave the smallest possible space free,

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING 8 it is clear that FFD does not use more bins than SMALL. Therefore, we conclude that FFD uses at most 0K + bins. Now we consider how many bins these items can be paced in without violating Constraint. To do this, we loo at how FF pacs the items. In [5], FF s pacing is found, and for completeness, we include it here. FF starts by pacing the items from set A with five items in each bin in the order a 0, a,..., a 9, a 0,..., a 9,..., a 0K,..., a 9K. For a bin containing a 0i,..., a 4i, the empty space is 3δ i, which is less than any of the remaining items. For a bin containing a 5i,..., a 9i, the free space is δ i, which is again less than any of the remaining items. This way, FF uses K bins to pac the items of set A. For set B, FF pacs five bins for each i as follows: b 0i + b i total of + δ 3 i b i + b 3i b 4i + b 5i b i + b 7i total of 3 + δ i total of 3 + δ i total of 3 + δ i b 8i + b 9i total of 3 + δ i None of the remaining items can fit into any of these bins, and so FF uses 5K to pac set B. None of the items in set C can fit together in a bin. Thus, FF pacs these in separate bins using 0K bins. In total, FF uses 7K bins and since FFD uses at most 0K + bins, the ratio follows. We proceed with the case >. We again let K be a positive integer, which is divisible by. Define I to be a multiset that can be divided into two sets A and B. A contains K items and B = K. Both sets are described below. Let ε be a suitably chosen very small positive constant, and let δ i = ε i for i K. Set A consists of items of the following sizes, for i, j K: a ij = + + δ j. Set B consists of items of the following sizes, for j K : b j = δ + j+ We first consider the pacing, SMALL(I), given in [5], which uses K bins, and then show that FFD uses the same number of bins in its pacing. After that we show how a legal pacing of the multiset using + K bins can be constructed. In the pacing made by SMALL, each of the first K bins contains items from A and one from B, with the items from A and B paired up as follows. For each j < K, all items a ij are placed together with b j giving a total of + δ + j + δ + j+ = + ε( j j+ ) =. The last bin contains the items a ik. This gives a total of K bins. FFD pacs the items from A first, per bin. For each j K, all items a ij are placed together. This gives the total amounts + ɛ + j+. Each item of B, when it arrives, fits into a single such bin. The bin which is filled to + ɛ + K+ does not receive a new item. This gives the same pacing described in the previous paragraph. We conclude that FFD uses exactly K bins. Now we consider how many bins these items can be paced in without violating Constraint. To do this, we loo at how FF pacs the items. In [5], FF s pacing is found, and for completeness, we include it here.

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING 9 The items are sorted so that all a ij items appear sorted by non-increasing order, and all b j items appear in increasing order. The first item in the sequence is a K, the second item is b K and from this point, after every items of set A, there is one item of the set B. The gap left in every bin after items are assigned to it is always smaller than any future item of set B, therefore the number of bins is at least K+K = K + K. Since FFD uses K bins, the ratio follows. We now turn to the better algorithm, FFI. Theorem 3. The parameterized approximation ratio of FFI is 5, = R FFI () = + +,. Note that R FFI () = R FFI () = R FFI (3). We prove the lower bound first. Lemma 4. The parameterized approximation ratio of FFI is 5, R FFI () + +, 3. Proof. For we use the following input: n items of size and n items of size, where n is a 3 large integer divisible by. The optimal pacing is to put one item of size and one item of size in each bin. This maes OPT use n bins, each with a fraction of empty space. On the other 3 hand, FFI pacs n bins, each containing three elements of size, followed by n bins, each with 3 3 two items of size. Hence, in total, FFI uses 5n bins, and the ratio follows. For 3 we use a slightly more complicated sequence. Let n be a large integer. The input contains n( ) items of size + and n( + ) items of size. FFI uses n( ) bins for the smaller items and n( + )/ bins for the larger ones, which is n( + )/ in total. All the bins are completely full. An optimal pacing would be to combine one larger item with smaller ones, using n( + ) bins. Each bin is thus full by a fraction of + > + + exactly + +., which maes the pacing valid. The approximation ratio for this sequence is thus Note that in this case, FFI s pacing is actually the same as the pacing made by SMALL. This is not always the case, though.

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING 0 Lemma 5. The parameterized approximation ratio of FFI is 5, 3 R FFI () + +, 4. Proof. We first prove the case 3 which is slightly different from the other cases and has to be treated separately. For this part of the proof, we do not assume an upper bound on the item sizes. We assign weights to items in the following way. For all items in the interval (0, ] (small items), the weight is defined to be equal to the size. An item which belongs to an interval (, ] for some i+ i i =,, 3, 4, 5 (large items), is assigned the weight. i The intuition for this weighting comes from considering a bin in the pacing made by FFI that contains only items from a single interval (, ], i {,, 3, 4, 5}. This bin contains at most i i+ i items, and therefore each item in such a bin can be thought of as contributing to the total size of i items plus empty space in FFI s pacing. Let W be the total weight of the items in a given input sequence. We prove that FFI + 5 W (OPT 5), which implies the upper bound. 5 Consider first the optimal solution OPT. We show that the total weight of items is at least W 5(OPT 5). To show that, we claim that all bins in OPT, except for at most five bins, have items of weight at least 5. First, consider the bins containing at least one small item. Due to Constraint, there is at most one such bin whose total sum of item sizes is less than 5. Note that the weight of an item is at least its size. A bin which contains items of total size of at least 5 has weight at least that amount. A bin which contains an item larger than has weight at least. Therefore, we only need to consider bins containing only items in (, ]. We define a pattern to be a multiset of numbers in,,, whose sum is at most. The type of a pattern is the inverse of the smallest number in it. 3 4 5 A pattern P of type j is a maximal pattern if adding another instance of to P, would not result j in a pattern, i.e. P { } is not a pattern. The pattern of a bin is the multiset of the weights of its j items. For each j =, 3, 4, 5, the pacing has at most one bin whose pattern is of type j but is not maximal. We show that a bin of any maximal pattern has weight at least 5. The only maximal pattern of type is {, }. The maximal patterns of type 3 are {,, } and {, }. Consider a 3 3 3 3 maximal pattern of type 4. We need to show that the sum of elements in the pattern is at least 5. Let a, b, c be the amounts of,, and in the pattern. If the sum is less than 5, we have 3 4 3 < a + b + c < 5. This gives 9 < a + 4b + 3c < 0. Since a, b, c are integers, this is 4 3 4 impossible. Similarly, consider a maximal pattern of type 5. Let a, b, c, d be the amounts of,,, 3 4 and in the pattern. If the sum is less than 5, we have 4 < a + b + c + d < 5. This gives 5 5 3 4 5 48 < 30a + 0b + 5c + d < 50 or 30a + 0b + 5c + d = 49. Since a, b, c, d are non-negative integers, this combination is impossible. Consider now the pacing of FFI. We show that the total weight of items is at most W FFI + 5. Note that the algorithm actually acts as Next Fit Increasing and never assigns an item to an old bin The paper [3] showed a similar result on patterns for a different purpose.

3 OFF-LINE MAXIMUM RESOURCE BIN PACKING once a new bin is opened. A bin of FFI is called a transition bin if it has both at least one small item and at least one other item, or it has only large items, but it contains items of distinct weights. The last case means that the algorithm is done pacing all items of weight for some 5 j j and has started pacing items of weight. Therefore, there are at most five transition bins. In j any other bin, the sum of the weights of the items is at most one; this is clear if there are only small items whose weights are equal to their sizes. For other items, there are j items of weight in a j bin containing only such items. As for the transition bins, the total weight of items whose size is at most one can be at most, so W FFI + 5. Hence OPT FFI +. 5 We now prove the lemma for 4. We slightly revise the definitions. Items are small if they are in the interval (0, ]. The weight of a small item is its size. An item which belongs to an interval +3 (, ] for some i =, +, +, is assigned the weight. i+ i i Consider the optimal solution OPT. We show that the total weight of items is at least W ( + )(OPT 4)/( + ). To show that, we claim that all bins except for at most four bins have items of weight at least ( + )/( + ). First, consider the bins containing at least one small item. Due to Constraint, there is at most one such bin whose total sum of items is less than = + + (which holds for all 3). +3 +3 + Note that the weight of an item is at least its size. A bin which contains items of total size at least + has weight at least that amount. We need to consider bins containing only items in (, ]. + +3 We define a pattern to be a multiset of numbers in,, whose sum is at most. Again, we + + define the type of a pattern as the inverse of the smallest item in it. For each j =, +, +, the pacing has at most one bin whose pattern is of type j but is not maximal. We show that a bin of any maximal pattern has weight at least +. The only maximal + pattern of type is {,..., }. Consider a maximal pattern of type +. We need to show that the sum of elements in the pattern is at least +. Let a and b be the amounts of and in the pattern. If the sum is less than + + +, we have < a + b < +. This gives + + + + < ( + )a + b < +. Since a and b are integers, this is impossible. Similarly, consider a maximal pattern of type +. Let a, b, and c be the amounts of,, and in the pattern. If the sum is less than + +, we have < + + + + a + b + c < +. This gives + + + (+) < (+)(+)a+(+)b+(+)c < ( +)(+) or a( + 3 + ) + b( + ) + c( + ) = ( + ) +. We need to exclude the existence of an integer solution for a, b, and c. Assume that such a solution exists. Note that a+b+c < +, since otherwise the left hand side is at least (+)(+) > (+) +. Also note that a+b+c >, since otherwise the left hand side is at most (+)(+)( ) < (+) +. If a+b+c = + we get (a+b+c)( +)+a(+)+b = (+) +. Simplifying, we have a(+)+b =, which is clearly impossible. If a + b + c =, we need that a( + ) + b = + +. If a = 0, there is no solution since + + is not divisible by. Otherwise, a must be divisible by. Since 0 < a and a is an integer, the only value it can have is +, but this gives b = which is impossible. Now consider the pacing of FFI. The total weight of items is at most W FFI + 4 since there can be only four transition bins. This implies the upper bound on the approximation ratio.

4 ON-LINE MAXIMUM RESOURCE BIN PACKING 4 On-Line Maximum Resource Bin Pacing For On-Line Maximum Resource Bin Pacing, the goal is to maximize the number of bins used subject to Constraint, so the algorithm is only allowed to open a new bin if the current item does not fit in any open bin. We have matching lower and upper bounds for most algorithms, and we conjecture that the algorithm Worst-Fit (WF) has an optimal competitive ratio of 3. Theorem (General upper bound). For the On-Line Maximum Resource Bin Pacing Problem, any algorithm ALG has a parameterized competitive ratio of, = C ALG (),. Proof. For =, this is proven using the fact that for any algorithm, all bins, except possibly one, are at least half full. For, we use the fact that all bins, except possibly one, are full to at least. For 3, Theorem is tight for deterministic algorithms: Theorem 7 (General lower bound). Any deterministic on-line algorithm ALG has a parameterized competitive ratio of 3, C ALG (), 3. The theorem follows from Lemmas 8 and 9 handling the cases and 3 respectively. Lemma 8. There exists a family of sequences I n with items no larger than such that OPT(I n) for n and, for any deterministic on-line algorithm ALG, OPT(I n ) 3 ALG(I n). Proof. The sequence is given in phases. Each phase begins with, ε,, ε, where ε <. For this sequence, there are two possible pacings: ε ε or ε If the on-line algorithm chooses the first pacing, the sequence continues with ε, ε, 3ε, filling up the two on-line bins. An optimal off-line algorithm chooses the second pacing, places the ε-item in the second bin, and opens a new bin for the last two items. Thus, OPT uses three bins, and has all bins filled to at least + ε.

4 ON-LINE MAXIMUM RESOURCE BIN PACKING 3 If the on-line algorithm chooses the second pacing, the sequence continues with, 4ε, ε, ε. In this case, an optimal off-line algorithm chooses the first pacing, and thus opens a new bin for the first two of the last four items. The last two items are placed in the first two bins. Again, OPT uses three bins and has all bins filled to at least + ε. Since each on-line bin is filled completely and each off-line bin is filled to at least + ε, this can be repeated arbitrarily many times, with the result that ALG uses two bins per phase and OPT uses three bins per phase. Lemma 9. For 3, there exists a family of sequences I n with items no larger than OPT(I n ) for n and, for any deterministic on-line algorithm ALG, OPT(I n ) ALG(I n). such that Proof. The sequence consists of an initial subsequence followed by n phases. Let ε > 0 be a very small constant. The sequence is constructed in such a way that after the initial subsequence, and also after every phase, OPT has the first bin filled to + ε and all other open bins filled to exactly + ε. The on-line algorithm has all open bins fully occupied, except the very first bin that is always filled to at least + ε. The sequence starts with ( ), ε. After this, any algorithm has a single open bin which is full up to + ε. The purpose of this initial subsequence is to let the on-line algorithm have a bin where it puts one tiny item in each phase. The rest of the sequence is given in n phases. Each phase starts with ( ), ε repeated times. No algorithm can open more than bins for these ( ) items. Actually, any algorithm uses exactly bins for the sequence, since the total size of the items is larger than. We consider two cases, according to how the on-line algorithm distributes the first items of the current phase. Case A: ALG assigns exactly the amount + ε to each new bin. In this case, ALG assigns the items exactly as Worst-Fit would do, for example, the pacing for = 4 loos as follows. ε ε ε 4 4 4 4 4 4 In this case, there is one additional item of size ε followed by 3 items of size ε. Since there were only additional items, at least one bin opened by ALG in the current phase is full exactly up to + ε. Using the items of the current phase, we can mae sure that, also in this phase, all bins of OPT are filled to at least + ε. Next there is an additional item of size ε and 4 4 4

4 ON-LINE MAXIMUM RESOURCE BIN PACKING 4 other items which are slightly smaller than, and fit perfectly into the remaining bins opened by ALG in the current phase. Since OPT opens a new bin for the item of size ε, it can place all the items arriving afterwards in the same bin. The total amount in that bin of OPT is therefore ( )ε. The final item of this phase is of size ε. This item is placed in the first bin by ALG (since all its other bins are full), and in the last bin of OPT, giving it a total of at least + ε. Case B: After the first part of the phase, ALG does not have + ε in each new bin. In this case, OPT has exactly + ε in each new bin. No matter how ALG distributes the items, it has new bins, one of which is filled to at most. Next there is an additional item of size and other items which are of the same size or slightly smaller. The sizes are computed one by one, in such a way that the next item at each step is the largest item of size tε that ALG can fit into one of the bins of the last phase, for 0 t. Since OPT opens a new bin for the item of size, it can place all the items arriving afterwards in the same bin. The total amount in that bin of OPT is therefore at least ( )ε. The final items of this phase are items of size ε, and one item of size ( + )ε. The first bins of OPT opened in this phase receive an item of size ε to achieve a total of + ε, and the last one receives the item of size ( + )ε for the same purpose. These items are placed in the first bin by ALG (since all its other bins are full). We get ALG(I n ) = ( )n+ whereas OPT(I n ) = n+. Hence, ALG(I n ) = OPT(I n)+, or OPT(I n ) = ALG(I n). First-Fit, Best-Fit, and Last-Fit are worst possible: Theorem 0. For the On-Line Maximum Resource Bin Pacing Problem, the parameterized competitive ratio of FF and BF is, = C FF () = C BF () =,. Proof. The upper bound follows from Theorem, and the lower bound for 3 follows from Theorem 7. Thus, we only need to prove the lower bound of for. To this end, consider the sequence, ε n, where n is a large odd integer and ε. FF as well as BF puts all the small n items in the first bin, using + n bins in total. OPT on the other hand distributes the small items one per bin, using n bins. This gives a ratio arbitrarily close to for n arbitrarily large. Theorem. For the On-Line Maximum Resource Bin Pacing Problem, the parameterized competitive ratio of LF is, = C LF () =,. Proof. Again, we only need to prove the lower bound of for. Let n be a large integer and ε. The input is given in three phases: 8n 4

5 ON-LINE MAXIMUM RESOURCE DUAL BIN PACKING 5., ε n. ε n 3. ε, 3ε n Both algorithms, LF and OPT, use n bins for the first n items, putting one item of size and one item of size ε in each bin. LF puts all items from phase two in the last bin. It then pacs the large items of phase three in the first n bins and the small items of phase three in the last bin, using only n bins. OPT, on the other hand, distributes the items of phase two evenly in the n open bins, and is able to open a new bin for each of the n pairs of items in phase three. This gives a ratio of n n which is arbitrarily close to for n arbitrarily large. Investigation of Worst-Fit seems to indicate that it wors very well in comparison with the other algorithms studied here. However, the gap between the lower bound of 3 and the upper bound of remains. Based on our investigation, we conjecture the following: Conjecture. For the On-Line Maximum Resource Bin Pacing Problem, the competitive ratio of WF is 3. 5 On-Line Maximum Resource Dual Bin Pacing For this problem, there are exactly n bins. An item cannot be rejected if it fits in some bin, but there are no constraints as to which bins the algorithm may use, except that no bin may be filled to more than. We have two different cases corresponding to the two different objective functions. For both objective functions, no deterministic algorithm is competitive in the general case with no upper bound less than on item sizes. Theorem 3. For the On-Line Maximum Resource Dual Bin Pacing Problem with accepted total size as cost function, no deterministic algorithm is competitive in general. Proof. Let n be the number of available bins, and let ALG be any deterministic algorithm. The input sequence is constructed in up to n rounds. In round i, for i n, n items of size ε are given, for some small ε > 0. If, after the ith round, ALG has one or more bins with fewer than i items, then an item of size ε(i ) is given. OPT distributes all i n ε-items with i items in each bin, and can thus reject this large item. The performance ratio is then ALG(I) OPT(I) = inε + ( ε(i )) inε = in i + + ε in For ε arbitrarily small, this ratio can be arbitrarily large. If, after n rounds, ALG has n items in each of its n bins, we give an item of size nε, and then n items of size ε(n ). ALG has to accept all these items. OPT arranges the first

5 ON-LINE MAXIMUM RESOURCE DUAL BIN PACKING items, including the item of size nε, such that all bins are filled to nε. It can then reject all the large items. This gives a performance ratio of ALG(I) OPT(I) = n ε + (n )( ε(n )) n ε This can again be arbitrarily large for ε arbitrarily small. = n + (n ) ε n We note that the situation for the parameterized problem for > is very different from the situation for the general problem. For every >, it is not hard to show that any algorithm has competitive ratio of at most /( ). The reason for this is that if OPT rejected any item at all, then its bins are full up to at least /. The following lower bound tends to + any n. e( ) as n tends to infinity and is at least + 3( ) for Theorem 4. Consider the On-Line Parameterized Maximum Resource Dual Bin Pacing Problem with accepted total size as cost function. For, any deterministic algorithm ALG for this problem has C ALG () + { m, where m = max j n( ) n i=j } { n n } i >,. e e Proof. Let n be the number of bins and let ε > 0 be a very small constant. Let m be the largest number m < n such that n i=m >. Since /x is a monotonically decreasing function for i x > 0, we get a lower bound of n e on m: n i= n e n+ i > dx = [ln x]n+ n e x n e = ln n + For the upper bound, m can be at most n e, since n i= n e + n e > ln n + n i < n e x dx = [ln x]n n e = ln n n < ln n n e e n e = ln n + n + >. Hence, depending on the exact value of n, m is either n e or n e. The initial input is n! items of size ε. We first prove that, for any pacing of these items, there n! exists an integer i, m i n, such that at least i bins receive strictly less than items. n+m i Assume for the purpose of contradiction that this is not the case. Then, at least one bin has at least n! small items, and for each i = n, n,..., m, there is at least one additional bin that receives m n! at least items. Since the total number of items is n!, we get that n n! n+m i i=m n!, which n+m i is equivalent to n i=m. By the definition of m, this cannot be the case. i n! Now, pic an i, m i n, such that at least i bins receive strictly less than items in ALG s n+m i pacing. Give =.

5 ON-LINE MAXIMUM RESOURCE DUAL BIN PACKING 7.. 3. n! n + m i ε n( ) i m n! m n + m i ε After pacing the first i m of these items, ALG still has at least m bins filled to strictly less than n! ε. Let r be the number of ALG s bins which are completely empty. Since all bins are less n+m i than full, there is room for exactly n( ) + r items of size and at least max{m r, 0} items of size ε. Thus, ALG is able to pac the remaining items as well, giving a total size of n! n+m i n!ε + (i m) n! n( ) + m ε + n! n + m i n + m i mε. Before the arrival of the size items, OPT can pac the items from phase one in one bin each and n! distribute the initial n! items in the remaining bins to fill all bins up to exactly ε. Each bin n+m i gets items of size, and no further items can be paced. The total size paced by OPT is n!ε + (i m) As ε decreases, the ratio converges to + n! n + m i m. n( ) n( ) ε +. The lowest possible value of m is which is obtained when n equals 3, or 9. n 3 For the case where the objective function is the number of accepted items, the situation is even worse. Theorem 5. For the On-Line Parameterized Maximum Resource Dual Bin Pacing Problem with the number of accepted items as cost function, no deterministic algorithm is competitive, for any. Proof. Let n be the number of bins available, and let ALG be any deterministic algorithm. The input sequence begins with n items of size. ALG fills all but at most two bins completely, and the remaining two bins are either both filled to, or one is filled completely and the other to. In the first case, the sequence continues with one item of size and ε items of size ε. ALG rejects the first of these and accepts all of the small ones. OPT, on the other hand, arranges the items of size, so that all but one bin is full, the item of size fits in that last bin, and all the small items are rejected. In the second case, the sequence continues with one item of size + ε, two items of size, and ε items of size ε. ALG accepts the first of these items, rejects the next two, and accepts all

CONCLUDING REMARKS 8 the small items. OPT, on the other hand, rejects the first of these items, accepts the next two, and rejects all the small items. By maing ε arbitrarily small, the number of items accepted by ALG can be made arbitrarily large, while the number of items accepted by OPT is either n or n. Concluding Remars The most interesting open problem is to prove that the off-line maximum resource bin pacing problem is NP-hard (or to find a polynomial time algorithm for it). For the off-line version of the problem, we have investigated First-Fit-Decreasing, which is worst possible, and First-Fit-Increasing, which performs better and obtains an approximation ratio of. It would be interesting to establish a general lower bound on the problem, and, if it is lower 5 than, to determine the optimal algorithm for the problem. Does there exist a polynomial time 5 approximation scheme for the off-line version? For the on-line version, we have considered the two standard bin pacing problems from the literature. For dual bin pacing, no algorithm is competitive in general, independent of whether the cost measure is the total size or the total number of accepted items. With the total accepted size as cost function, the situation is completely different for the parameterized version; for, any algorithm has a parameterized competitive ratio between + and about + e( ). For the classic variant of on-line bin pacing, we have established general upper and lower bounds and proved that First-Fit, Best-Fit, and Last-Fit perform worst possible. The behavior of Worst-Fit seems very promising, but we leave it as an open problem to determine its competitive ratio. 7 Acnowledgments First of all, we would lie to than Michael Bender for suggesting the problem and for interesting initial discussions. We would also lie to than Morten Hegner Nielsen for interesting discussions at the 3rd NOGAPS, where the wor on the problem was initiated. In addition, we are thanful to Gerhard Woeginger for comments on an earlier version of this paper. References [] E.M. Arin, M.A. Bender, J.S.B. Mitchell, and S. Siena. The Lazy Bureaucrat scheduling problem. Information and Computation, 84():9 4, 003. [] S.F. Assman, D.S. Johnson, D.J. Kleitman, and J.Y-T. Leung. On a dual version of the onedimensional bin pacing problem. J. Alg., 5(4):50 55, 984.

REFERENCES 9 [3] A. Bar-Noy, R. E. Ladner, and T. Tamir. Windows scheduling as a restricted version of bin pacing. In Proc. th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 4 33, 004. [4] A. Borodin and R. El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, 998. [5] J. Boyar and L.M. Favrholdt. The relative worst order ratio for on-line algorithms. In Algorithms and Complexity: 5th Italian Conference, LNCS 53, pages 58 9, 003. [] J. Boyar and L.M. Favrholdt. The relative worst order ratio for on-line bin pacing algorithms. Technical report PP 003 3, Department of Mathematics and Computer Science, University of Southern Denmar, 003. [7] J. Csiri, J.B.G. Fren, M. Labbé, and S. Zhang. Two simple algorithms for bin covering. Acta Cybernetica, 4():3 5, 999. [8] J. Csiri, D.S. Johnson, and C. Kenyon. Better approximation algorithms for bin covering. In Proc. th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 557 5, 00. [9] L. Epstein and M. Levy. Online interval coloring and variants. In Proc. 3nd International Colloquium on Automata, Languages and Programming, 005. To appear. [0] M.R. Garey and D.S. Johnson. Computers and Intractability A Guide to the Theory of NP-Completeness. W. H. Freeman and Company, 979. [] R.L. Graham. Bounds for certain multiprocessing anomalies. Bell Systems Technical Journal, 45:53 58, 9. [] R. Hassin and S. Rubinstein. An approximation algorithm for the maximum traveling salesman problem. Information Processing Letters, 7(3):5 30, 998. [3] D.S. Hochbaum, editor. Approximation Algorithms for NP-Hard Problems. PWS Publishing Company, 997. [4] K. Jansen and R. Solis-Oba. An asymptotic fully polynomial time approximation scheme for bin covering. Theoretical Computer Science, 30( 3):543 55, 003. [5] D.S. Johnson, A. Demers, J.D. Ullman, M.R. Garey, and R.L. Graham. Worst-case performance bounds for simple one-dimensional pacing algorithms. SIAM J. Comp., 3:99 35, 974. [] D.R. Karger, R. Motwani, and G.D.S. Ramumar. On approximating the longest path in a graph. Algorithmica, 8():8 98, 997. [7] A.R. Karlin, M.S. Manasse, L. Rudolph, and D.D. Sleator. Competitive snoopy caching. Algorithmica, 3():79 9, 988. [8] D.D. Sleator and R.E. Tarjan. Amortized efficiency of list update and paging rules. Communications of the ACM, 8():0 08, 985.