Comp Online Algorithms

Size: px
Start display at page:

Download "Comp Online Algorithms"

Transcription

1 Comp Online Algorithms Notes 4: Bin Packing Shahin Kamalli University of Manitoba - Fall 208 December, 208 Introduction Bin packing is one of the fundamental problems in theory of computer science. Analysis of bin packing algorithms has has contributed a lot to theories behind approximation algorithms (in the offline setting) and online algorithms. The first competitive results for classic bin packing algorithms appeared a decade before the term competitive analysis was introduced in the context of paging and list update. We start this section with a review of classic results for bin packing and later we explore some recent results with respect to application of bin packing in the cloud as well as advice complexity of bin packing problem.. Offline vs online bin packing Bin packing asks for packing of a collection of input items into a minimum number of bins of uniform capacity. Items can represent files that should be stored in servers, merchandise that should be packed into trucks (with a given weight capacity) in order to be sent from one location to another, or cakes students who request different portions of cakes. In these examples, servers, trucks, and cakes represent bins of uniform sizes that should be shared between items of different sizes (files of different volume, merchandise of different weights, and cake-pieces of different sizes). The size of an item is assumed to be smaller than the capacity of bins. We often assume bins have capacity and items have sizes in (0, ]. Our understanding of an item is in the bin packing problem is solely based on its size; hence, we often use an item and its size interchangeably. In the offline setting, items form a multiset and an algorithm can process this multiset before placing any item into a bin, e.g., it can sort items in decreasing order (which is quite useful in practice). It is not hard to see the problem is NP-hard: Theorem. Offline bin packing problem is NP-hard. Proof. We use a reduction from 3-partition problem, which is an NP-hard problem. An instance of 3- partition is formed by a multiset S of positive integers, and the goal is to decide whether it is possible Multiset is an extension of a set where a given member can appear more than once.

2 Figure : Reduction from partition to bin packing to partition S into two subsets of two subsets S and S 2 s.t. sum of the numbers in S equals to the sum of the numbers in S 2. For example, the answer to the instance S = {3,, 3, 2, 3, 2, 3, 3, 4, } is yes because S can be partitioned to S = {3, 2, 3, 3} and S 2 = {, 3, 2, 4, } whose total sum is equal to. Given an instance of partition problem, defined by multiset S, we form an instance of bin packing in polynomial time. Let X denote the total sum of items in S. We create an instance of bin packing defined by mult-set S which is the same as S with its items divided by X/2. In the above example, we have X = 22, and the bin packing multiset is S = {3/, /, 3/, 2/, 3/, 2/, 3/, 3/, 4/, /}. It is not hard to see there is a packing of S into two bins if and only if the answer to the partition instance is yes. Figure provides an illustration. The above theorem not only shows that bin packing is NP-hard, but it also shows that it is hard to find a packing that opens less than.5 times the number of bins used by Opt. However, this is only the case when Opt opens 2 bins; in fact there are polynomial algorithms that open (+ɛ) Opt + bins for any input sequence. That implies that, we can get arbitrary close to Opt for sequences for which the number of bins opened by Opt goes to infinity. We call the maximum ratio between the cost of an offline algorithm and that of Opt for sequences where the cost of Opt goes to infinity as the asymptotic approximation ratio of the offline algorithm. So, there are algorithms with asymptotic approximation ratio of + ɛ. There are more straightforward offline algorithms with better ratios. For example, a simple algorithm which sorts items in decreasing order of their sizes and then places them one by one using First-Fit rule (which will be described later) has an asymptotic approximation ratio of /9. As another remark, if there is a constant number of different item-sizes, there is a polynomial algorithm which solves the problem optimally. 2 Online Algorithms for Bin Packing In online bin packing, the input is a sequence of items, revealed one by one. An online algorithm places each item into a bin without a priory knowledge about future items. The decisions of the algorithm are irrevocable, i.e., after placing an item into a bin, the algorithm cannot change the bin associated with the item. Next Fit is a simple bin packing algorithm which maintains one bin open at each time. If an incoming item fits in the open bin, the algorithm places it there. Otherwise, it closes the bin and opens a new bin. A closed bin is never referred to again (i.e., no future item is placed in a closed 2

3 < > Figure 2: Packing of Next Fit for sequence σ = 0.9, 0.3, 0.8, 0.5, 0., 0., 0.3, 0.2,, 0.2,, 0.5, 0.5, 0.8, 0.6,, 0.5. bin). Figure 2 shows the final packing of Next Fit for a sample sequence. Note that closing a bin can be quite wasteful and increasing the cost (number of opened bins) of the algorithm. First Fit is a more practical algorithm which never closes a bin. It keeps all bins opened in the order in which they are opened and places an input item in the first bin which has enough space. If none of the existing items has enough space, First Fit opens a new bin for the item. Best Fit is a similar algorithm that places an item in the bin that best fits it, i.e., the fullest bin which has enough space. We define the level of a bin as the total size of items placed in the bin. So, Best Fit places an item in the bin with maximum level which has enough space. Figure 3 show the packings of First Fit and Best Fit for the same sequence. Note that in this case, Best Fit has a lower cost; however, for some sequences it is Fist Fit that opens less bins. First Fit and Best Fit are members of Any-Fit family of algorithms. An algorithm belongs to this family if it avoids opening a new bin if any of the existing bins has enough space for the item. Note that Next Fit is not an Any-Fit algorithm since an item can fit in the closed bin but Next Fit does not use it. Worst-Fit is an Any-Fit algorithm if it places an item in the bin with the smallest level (the emptiest bin ). An online algorithm belongs to Almost-Any-Fit family of algorithms if it is Any-Fit and it avoid worst-fit strategy. It means that, if there are more than one bin that have enough space for an incoming item, the algorithm uses places the item in any bin except for the emptiest bin. Clearly, Worst-Fit is not an Almost-Any-Fit algorithm. Similarly, Fist Fit is an Any-Fit algorithm which is not Almost-Any-Fit because the first bin which has enough space might be the emptiest bin which fits an incoming item, e.g., for sequence 0.6, 0.7, 0.8, 0.2, First Fit places the item of size 0.3 in the emptiest bin with level 0.6. Harmonic family is another family of bin packing algorithms which classify items based on their < < > > (a) packing of First Fit (b) packing of Best Fit Figure 3: Packing of Next Fit for sequence σ = 0.9, 0.3, 0.8, 0.5, 0., 0., 0.3, 0.2,, 0.2,, 0.5, 0.5, 0.8, 0.6,,

4 Harmonic K 4 < > x x x x 4 Figure 4: Packing of Harmonic for sequence σ = 0.9, 0.3, 0.8, 0.5, 0., 0., 0.3, 0.2,, 0.2,, 0.5, 0.5, 0.8, 0.6,, 0.5. sizes. In the simplest form, the classic Harmonic algorithm divides items into K classes, where K is an integer parameter of the algorithm. Items in the range (/2, 7/] belong to class, items in 6 5 the range (/3, /2] belong to class 2, and more generally4 3 items in the range ( i+, i ] belong to class 2 i < K. Class K is special class formed by items smaller than /K. The algorithm packs items of each class separately from other items using Next Fit strategy. Note that for class i < K, exactly i items fit in the same bin. For example, only item larger than /2 (of class ) fits in a bin and two items in the range (/2,/3] (i.e., class 2) fit in the same bin. Figure 4 show the packing of Harmonic for an input sequence. 2. Analysis measures When analyzing bin packing algorithms, we are often interested in cases where the cost of Opt is arbitrary large. There are input sequence of large length which can be packed in a small number of bins (e.g., when all items are very small). For these sequences, opening a constant number of extra bins can dramatically change the ratio between the cost of an online algorithm and Opt (in a similar way that we observed earlier in the context of the partition problem). In summary, to compare quality of different algorithms, we restrict our attention to inputs for which Opt (and hence any other algorithm) opens an arbitrary large number of bins. We define the asymptotic competitive ratio of an online algorithm as the maximum ratio between the cost of the algorithm and that of Opt for the same sequence for which the cost of Opt goes to infinity. This definition of competitive ratio is in contrast with absolute competitive ratio which considers the ratio among all sequences even those which can be packed into a constant number of bins. In the remainder of this section, we use term competitive ratio to refer to asymptotic competitive ratio. Average-case ratio is another measure that we sometimes use to compare online algorithms. Assuming item-sizes are independently and identically distributed (typically using a Uniform distribution), the average case ratio of an algorithm is the expected value of the ratio between the cost of a sequence and that of Opt. Average-case ratio is a performance measure which is more indicative of the typical performance of bin packing algorithms as we will see later. 2.2 Analysis of Next Fit Let s start our quest to analysis of bin packing algorithms with the simplest online algorithm. Lemma. Next Fit has a competitive ratio of at most 2. 4

5 ε ε ε ε ε ε 5 5 NextFit OPT 5 5 ε ε ε Figure 5: Comeptitvei ratio of Next Fit is at least 2. Proof. Consider the final packing of Next Fit for any sequence. We claim the total size of items in each two consecutive bins is more than one. Consider otherwise, i.e., there are two consecutive bins with total level less than. This means that any of the items in the second bin, particularly the one that caused opening that bin, could fit in the first bin. Consequently, Next Fit should have not opened the second bin which is a contradiction. Let S denote the total size of items in the input sequence. Since each two consecutive bins have total size more than, we conclude that there cannot be more than 2S bins in the Next Fit packing; otherwise, there will be more S pairs of bins each having level more than which given a total size of more than S for the packed items which is a contradiction. On the other hand, Opt has to open at least S bins. This is because each bin of Opt includes items with total size at most (capacity of the bin) and hence to pack all items, at least S bins are required. In summary, for any sequence with total size S, the cost of Next Fit is at most 2S and the cost of Opt is at least S. Consequently, the competitive ratio of the algorithm is at most 2S S = 2. The above lower bound is indeed tight: Lemma 2. Next Fit has a competitive ratio of at least 2. Proof. Consider sequence σ =< 0.5, ɛ, 0.5, ɛ,... >. Next Fit opens a new bin for items of size 0.5 and the next item of size ɛ results in a bin with level more than 0.5 which cannot be used for the subsequent item of size 0.5 (and hence it will be closed). Assuming σ has length n, the cost of NextFit for packing σ will be roughly n/2. On the other hand, Opt places all items of size ɛ in one bin and opens one bin for any two item of size 0.5. The cost of Opt will be roughly n/4. Figure 5 provides an illustration. In summary, the ratio between the cost of Next Fit and Opt for σ is at most n/2 n/4 = 2. Since the competitive ratio is the maximum value of this ratio for all sequences, it will be at least 2. From the above two lemmas, we conclude the following theorem: Theorem 2. Competitive ratio of Next Fit is exactly Weighting argument In order to provide an upper bound for the competitive ratio of most bin packing algorithm such as First Fit and Best Fit, we often use a weighting technique. To prove a competitive ratio of an algorithm Alg is at most c, we take the following steps in a weighting argument: Step I: Define a weighting function w which assigns a weight w(x) for any item of size x. Typically, we have w(x) x. 5

6 Step II: Show that, for any bin in the final packing of Alg (except possibly a constant number of them), the total weight of items in B is at least. Step III: Show that, for any arbitrary bin B (in particular, a bin in the packing of Opt), the total weight of items in B is at most c. To see why the above steps guarantee a competitive ratio at most c, let W denote the total weight of all items in an input sequence σ. From step II, we know the weight of items in any bin of Alg (except possibly a constant number of them) is at least ; hence, the number of such bins cannot be more than W (otherwise total weight of packed items will be more than W which is a contradiction). So, we have cost(alg) W + x for some constant x. One the other hand, from step III, weight of any bin in the Opt s packing is at most c. So, in order to include all items at least W/c bins are required, i.e., cost(opt) W/c. In summary, the cost of Alg for an sequence of total weight W is at most W and the cost of Opt is at least W/c. Hence, the competitive ratio of Alg will be at most W +x W/c which approaches to c for large values of W (i.e., when the cost of Opt is sufficiently large) Analysis of harmonic ablgorithm We use the weighting technique to prove an upper bound for competitive ratio of Harmonic algorithm. Recall that the algorithm places i items of class i (i.e., with size in the range (/(i + ), /i]) in the same bin for i < K. The algorithm uses Next Fit strategy to pack items of class K (those smaller than /K). Lemma 3. The Harmonic algorithm has a competitive ratio of at most c = + /( 2) + /(2 3) + /(6 7) + /(42 43) + etc..69. Proof. We take the three steps involved in the weighting argument to prove the competitive ratio is at most c. Step I: we define the weight of items in class i (i.e., with size in the range (/(i + ), /i]) to be /i for i < K. For an item of size x that belongs to class K (i.e., x /K) the weight is K defined as K x Step II: we show that total weight of items in any bin of Harmonic, except a constant number of them, is at least. Note that all bins of class i < K, except possibly the last bin of the class, include i items of weight /i. Hence, these bins have total weight of. Now, consider a bin B of class K. Since all items of class K are smaller than /K, if a bin is opened after B, the level of B has been larger than (k )/k (otherwise the items in the next bin should have been placed in B). Since the weight of items placed in B is the product of their sizes and k/(k ), the total weight of items in B is at least (k )/k k/(k ) =. We conclude that all bins of Harmonic, except possibly the last bin of each class (a total of K bins) have weight at least. Step III (sketch): we show that the total weight of items in any bin of Opt is at most c. Define the density of an item to be the ratio between the weight and the size of the item. For example, density of an item in class is less than 2 because the weight of such item is and its size is more than /2. Similarly, the density of items in class i < K is upper-bounded by (i+)/i. For items of class K, the density is K/(K ). In order to maximize the total weight of items in a bin of Opt, one can show that we need to place items in the bin in a greedy manner in a decreasing order of density. In other words, we repeatedly add the item with the largest density which fits into the bin. For large values of K, these items are /2 + ɛ (density 6

7 2), /3 + ɛ (density 3/2), /7 + ɛ (density 7/6), /43 + ɛ (density 43/42), and so on. These items respectively have weights, /2, /6, /42, and so on. So the total weight of items in any bin of Opt will be the claimed value of c. In fact the upper bound in the above theorem is tight: Lemma 4. The competitive ratio of Harmonic algorithm is at least c = + /( 2) + /(2 3) + /(6 7) + /(42 43) + etc..69. Proof. Consider the following sequence: /43 + ɛ,..., /43 + ɛ, /7 + ɛ,..., /7 + ɛ, /3 + ɛ,..., /3 + ɛ, /2 + ɛ,..., /2 + ɛ, }{{}}{{}}{{}}{{} m times m times m times m times Harmonic places items of the same sizes together (they belong to the same class). Hence, it opens m(/42 + /6 + /2 + ) bins. We can add prefixes to the beginning of the sequence to ensure Alg opens c m bins. On the other hand, Opt places one item of each class in each bin. Hence, the cost of Opt is m. Hence, there is a sequence for which the ratio between the costs of Harmonic and Opt is c, i.e., the competitive ratio of Harmonic is at least c. From the above lemma we conclude the following theorem: Theorem 3. The competitive ratio of Harmonic algorithm is exactly c = + /( 2) + /(2 3) + /(6 7) + /(42 43) + etc Analysis of First Fit Weighting arguments can be used to compute competitive ratio of other bin packing algorithms such as First Fit and Best Fit. Lemma 5. The competitive ratio of First Fit is at most.7. Proof. The proof is based on weighting function. Here we just show step I by providing the weighting function. For an item of size x define weight w(x) as follows: w(x) = (6/5)x for 0 x /6 = (9/5)x /0 for /6 < x /3 = (6/5)x + /0 for /3 < x /2 = (6/5)x + 4/0 for /2 < x With the above definition of weighting function, one can show the weight of any bin in the First Fit packing (except possibly a constant number of bins) is at least (Step II). Meanwhile, the weight of any bin in the packing of Opt is at least.7 (Step III). We conclude that the competitive ratio of First Fit is at most.7. Using a similar weighting function, one can prove that any Almost-Any-Fit algorithm has a competitive ratio at most.7. This implies that Best Fit is also having competitive ratio of.7. 7

8 2.4 General Lower Bounds We saw in the previous section that competitive ratios of First Fit and Best Fit are.7 while that of Harmonic is roughly.69. This raise the question that how good the competitive ratio can be? is it possible to achieve competitive ratios close to? The answer is No: Theorem 4. The competitive ratio of any online bin packing algorithm is at least 4/3. Proof. Consider the following input σ = /2 ɛ, /2 ɛ,... /2 ɛ, /2 + ɛ, /2 + ɛ,..., /2 + ɛ. }{{}}{{} Consider the sub-sequence σ formed by the first m items. The cost of Opt for this sub-sequence is m/2 (it places two items of size /2 ɛ in one bin). Let the cost of Alg be αm for some α so that /2 α. So the ratio between the cost of algorithm and Opt will be αm m/2 = 2α. Since there is one sequence for which the ratio between the cost of Alg and Opt is 2α, the competitive ratio of Alg is at least 2α. Next, consider the whole sequence σ. The cost of Opt for σ is m (it places one item of size /2 ɛ together with an item of size /2 + ɛ in the same bin. Recall that Alg has opened αm bins for the first m items (for σ ). Out of these αm bins, m αm bins have two item (since there are m items in the σ and at most two fit in the same bin). So, among the αm bins opened for σ, αm (m αm) = 2αm m bins have one item. These bin can accommodate an item of size /2 + ɛ. So, from the m items in the second half of σ, at most 2α m of them can be placed in the bins opened for σ. This means that Alg has to open m (2αm m) = 2m 2αm new bins for the rest of items in the second half of σ. Hence, the total number of bins in packing of Alg for σ is at least αm + 2m 2αm = 2m αm, and the ratio between the cost of Alg and Opt for σ is at least 2m αm m = 2 α. In summary, the ratio between the costs of Alg and Opt for σ is 2α and for σ is at least 2 α. Hence, the competitive ratio of Alg is at least max{2α, 2 α} which is at least 4/3. The above lower bound is a relatively easy lower bound. More complicate sequences results in better lower bounds. For example, using a similar approach as the above lemma but with a more complicated case analysis, we can improve the lower bound from 4/3 to.5 using the following sequence: m items σ 2 = /6 ɛ,... /6 ɛ, /3 ɛ,... /3 ɛ, /2 + 2ɛ,..., /2 + 2ɛ }{{}}{{}}{{} m items m items m items Note that in these lower bounds, we do not use an adversarial sequence. This means that, unlike what was the case for problems like paging and list update in which an adversary generates a bad sequence based on the actions of the algorithm, in the case of bin packing, the worst-case sequence is fixed among all sequences. As a consequence, unlike list update and paging where a randomized strategy could limit the adversary in generating worst-case sequences, in bin packing, randomization cannot help to break the lower bounds. Hence, the above lower bounds hold for all bin packing algorithms, including randomized algorithms. There are generally two restrictions for online algorithms which can be exploited to achieve lower bounds for their competitive ratios. One is the online constraint meaning that the algorithm is oblivious to the forthcoming requests/items and second is incremental constraint meaning that the algorithm should build its solution on top of the previously built solutions for prefix subsequences of the input. In the case of bin packing, it is the incremental constraint which is used in the lower bound. This means that, even if the algorithm knows the input (sequence σ in the proof of Theorem 4), it cannot achieve a competitive ratio better than 4/3 because of the incremental constraints. All m items 8

9 lower bounds for bin packing exploit the incremental constraint. This includes the following theorem which gives the best existing lower bound. Theorem 5. [] No online bin packing algorithm can have a competitive ratio better than Beyond Worst-case Measures So far, we have learned the bin packing results with respect to the asymptotic competitive ratio. Recall that the competitive ratio only concern one input sequence which is generated adversarially such that the ratio between the cost of the online algorithm and Opt is maximized for that particular sequence. Clearly, competitive ratio is a worst-case measure which only concerns adversarial scenarios which might not have practical significance. For example, all members of the Harmonic family of algorithms, including the best existing algorithm named Advanced Harmonic (AH) which has a competitvie ratio of.5783 [2], have a poor typical behaviour and consequently are not useful for practical purposes. What do we mean by typical behaviour? this question is indeed a deep question which is not easy to answer. Intuitively, an algorithm with good typical behaviour performs well for a spectrum of input sequences (and not only the ones generated by an adversary). One straightforward measure is to assume item sizes are generated independently and randomly from a probability distribution. Consider input sequences σ that is sufficiently long and its items A(σ) Opt(σ) are generated as indicated above. For a given algorithm Alg, the ratio, that is the ratio between the cost of Alg and Opt for σ, is a random variable (since σ is a randomly generated sequence). We call the expected value of this random variable the average-case ratio of algorithm Alg for that given distribution. We often assume item sizes follow uniform distribution, that is, they are uniformly and randomly taken from (0,]). As such, when it is clear that the underlying distribution is uniform, we do not mention the underlying distribution when using the term average-case ratio. When studying average-case ratio, we are not worried about adversary any more. Instead, the input is generated using a random process. Since the input is not adversarial, the average-case ratio of an algorithm is always upper-bounded by its competitive ratio. This is because the worst-case inputs required by competitive ratio are unlikely to be generated in a random process and hence their contribution to the average-case ratio is very small. Instead, there are many other input sequences for which the ratio between the the cost of Alg and Opt is smaller than the competitive ratio. In conclusions, average-case ratio is often very smaller than the competitive ratio. For example, we saw that the competitive ratio of Next Fit is 2 while its average-case ratio is.3. In other words, although there are sequences for which Next Fit can be as bad as 2 times Opt, if the input sequences is generated randomly (using uniform distribution as discussed above), the ratio between the cost of Next Fit and Opt is expected to be.3. Table compares competitive ratio and average-case ratio of a few bin packing algorithms. One can see, while there has been a lot of efforts for designing algorithms with better competitive ratios, these algorithms all have average case ratio larger than, while Best-Fit and First-Fit have average-case ratio of. This is a clear indication of the fact that Best Fit and First Fit have better typical performance and hence have huge significance in practice. Note that, average-case ratio of for Best Fit and First Fit implies that, for random input sequences, these algorithms are almost-optimal, that is, the expected value of the number of bins opened by them compared to the number of bins opened by Opt goes to. For comparing algorithms with average-case ratio of, we consider the expected waste, which is defined as the expected value of the number of bins opened by the algorithm minus the number of bins opened by Opt. For a sequence of length n, the expected number of bins opened by Opt, Best-Fit and First-Fit are all Θ(n). However, Best-Fit and First-Fit open respectively Θ( n log 3/4 n) and Θ(n 2/3 ) more bins than Opt. This shows a slight advantage for Best Fit. 9

10 Algorithm Competitive Ratio Average Ratio Expected waste Next Fit (Nf) 2. 3 [3] Ω(n).... Best Fit (Bf) [4] [5] Θ( n log 3/4 n) [6].... First Fit (Ff) [4] [7] Θ(n 2/3 ) [6] [8] Refined First Fit. 6 [9] > Ω(n) Harmonic (Ha) T [0] Ω(n) [0] Refined Harmonic.635 [0].2824 [] Ω(n) Modified Harmonic Ω(n) [2] [3] Harmonic [4] > Ω(n) Extreme Harmonic.587 > Ω(n) [5] Advanced Harmonic.5783 > Ω(n) [2] Best Online Algorithm > [] Harmonic Match T.69 Ω( n lg /2 n) [6] Θ( n log 3/4 n) [6] Table : Competitive ratio, average-case ratio, and expected waste of a few online bin packing algorithms Looking at Table, we see that the algorithms with better competitive ratio tend to have a poor typical performance. One might ask whether whether it is possible to design algorithms which are good in terms of both worst-case behaviour (competitive ratio) and average-case behaviour. The last row of Table shows that the answer is yes, that is, it is possible to achieve a competitive ratio strictly better than Best Fit and First Fit and yet maintain their good worst-case performance. We will review the algorithm behind this answer, named Harmonic Match, later in this section. Before that, we review the average-case results for Best Fit and First Fit. 3. Upright Matching & Average-Case Analysis In order to study average-case performance of Best Fit and First Fit, we reduce online bin packing problem to an offline geometric problem called upright matching. An instance of the upright matching is defined by n points which are randomly distributed in a one-by-one box in the plane (that is, their x and y coordinates are randomly and independently taken from U(0,]). In addition, each point has a label which is either or (each with a chance of half). Given this random input, the goal of an uptight matching problem is to create a matching of points with points so that the point appears on the top and right of the point (if two points have the same x-coordinate, we assume either of them is on the right of the other.). In doing so, the algorithm s objective is to maximize the number of matched points. Figure 7 shows an instance and a solution to the upright matching problem. A simple greedy algorithm for the upright matching works by scanning points one by one from top to bottom. When processing an point x, the algorithm matches x with the left-most unmatched point which appears on the top and right of x. If such point y does not exist, x remains unmatched. It is known that this greedy algorithm matches all points except an expected number of Θ(n log 3/4 n) points. Note that the number of unmatched points is asymptotically smaller than the number of matched points; that is, almost all points are matched using the greedy algorithm. 0

11 Figure 6: An instance of the upright matching problem and a possible solution. How the upright matching relates to the online bin packing problem? In what follows, we show that, given an input sequence for the bin packing problem, we can form an instance of the upright matching problem. As such, any algorithm for the upright matching becomes, in particular the greedy algorithm, is equivalent to a bin packing problem. Given an input sequence σ = a 0, a,..., a n for bin packing, in which any item a i is distributed uniformly and independently in the range (0,], we form an instance of upright matching by creating a point p i = (x i, y i ) for each item a i. As before, let s call the item a i small if its size is at most 0.5 and large otherwise. First, the label of p i is if a i is small and otherwise. The x-coordinate of p i is defined as x i = 2a i if a i is small and x i = 2( a i ) if a i is large. The y-coordinate of p i is defined as a random point in the range U[i/n, (i + )/n), that is y i = random[i/n, (i + )/n). Now, we have to verify that the above reduction is correct in terms of the distribution of random variables. First, note that since a i is distributed uniformly in (0,], the chance of an item being at most /2 is equal to the chance of the item being larger than /2. That is, the label of any chance is or with a chance of /2. For small items, since a i is uniform and random in the range (0, /2], the x-coordinate x i = 2a i is in U(0, ], that is, x-coordinate of points are distributed randomly and uniformly between 0 and. Similarly, for the points, as a i is in the range (/2, ], the x-coordinate x i = 2( a i ) is in the range U(0, ]. It remains to show the y-coordinates are also in the range U(0, ]. Note that the y-coordinate is a function of the index of the item in the sequence. The later the point appears in the sequence, the lower is its y-coordinate. In principle, the y-axis is divided into intervals of equal sizes as (0, /n], (/n, 2/n],..., ((n )/n, ]. The i th point takes its y-coordinate as a random point in the ith interval. As such, exactly one point is distributed randomly in the interval U[i/n, (i + )/n) on the y-axis. In other words, any value of y i on the y-axis has the same chance of being selected as the y-coordinate of some point. That implies that the y-coordinates are uniformly distributed in the range (0, ]. So, an instance of bin packing can be reduced to the upright matching problem. Then, what is the equivalent of greedy algorithm for upright matching in the context of bin packing? Recall that the greedy algorithm processes points from top to bottom; upon seeing an points, it ignores it (does not match it with any point seen so far) but when it sees an point p i = (x i, y i ), it matches it with leftmost unmatched point p j = (x j, y j ) which appears on top and right of p i. Note that p j appears on top of p i if it appears earlier (y j < y i implies j < i) and on the right of p i which implies

12 Figure 7: Reduction of an instance σ = 0.53, 0.69, 0.2, 0.78, of bin packing to an instanceo of upright matching. that the two items a i and a j in the bin packing instance can be placed in the same bin. To be more precise, if x i x j then 2a i 2( a j ) which gives a i + a j. In conclusion, the greedy algorithm can be described as follows for bin packing. Algorithm Almost-Best-Fit: Process the items one by one in the order they appear in the sequence (from top to bottom in the upright matching). Upon processing item a i (the ith point), do the followings: If a i is larger than /2 (the point is ), open a new bin (do not attempt matching it with a point). If a i is smaller than or equal to /2 (the point is ): Consider the set of candidate items : an item is said to be a candidate item if it has size larger than /2 (an points), appeared earlier than a i (is in top of p i ), is alone in its bin (is not matched with another point), and its bin has enough space for a i (appears on the right of p i ). Among all candidate items (if they exist), let a j be the largest candidate item (that is, p j is the leftmost point among candidate points). Place a i in the bin of a j (match a i with a j ). If no candidate item exist, open a new bin for a i (do not match a i with any point). The reason we called the algorithm almost-best-fit is that it works similar to the best-fit algorithm except that it closes a bin as soon as a small item (with size /2) is placed in it. More precisely, a bin opened by a small item is closed right after opening (an unmatched point remains unmatched throughout the algorithm), and a bin in which a small item is placed together with a large item (includes two items) does not get another item (no three points are matched ). Clearly, closing a bin right after it was opened by a small item is not a good idea (that bin is at least half-empty). In a sense, best fit seems more reasonable than almost-best-fit. In fact, it is proved that best fit dominates almost-best-fit, that is, for any input sequence σ, the number of 2

13 bins opened by best-fit to pack σ is less than or equal to that of almost-best-fit (we skip the proof for this). From the above discussion, the number of unmatched points by the greedy algorithm is Θ( n log 3/4 n). This means that, in almost-best-fit algorithm, except Θ( n log 3/4 n) items, all other items are placed in bin with another item (are matched). Hence, for n items, the number of bins opened by almostbest-fit is expected to be n/2 + Θ( n log 3/4 n). This implies that the number of bins opened by best-fit, which dominates almost-best-fit, is at most n/2 + Θ( n log 3/4 n). Note that the number of bins opened by Opt is at least n/2. This is because n/2 of items are larger than /2 and no two of them fit in the same bin. In summary, we can state that, when item sizes are generated uniformly and independently at random, the number of bins opened by Best Fit is expected to be at most n/2 + Θ( n log 3/4 n) while Opt is expected to open at least n/2 bins. We can conclude the following: Theorem 6. When item sizes are generated uniformly and independently from the range (0,], the average-case ratio of best-fit is and its expected waste is Θ( n log 3/4 n). In the above theorem, we can change the distribution from uniform to any distribution in which the chance of having an item of size x and x is the same (x /2). For example, when item sizes follow the normal distribution with expected value of /2. The proof for that is similar to the one we saw for the uniform distribution; the only detail is when reducing such bin packing instances to the upright matching, we should ensure the coordinates in upright matching instance remains uniform. Moreover, using similar techniques, we can show that the average-case ratio and expected waste of the first-fit algorithm are respectively and Θ(n 2/3 ). The greedy algorithm associated with first-fit chooses the top-most candidate point (instead of the right-most one). We skip the details here. 3.2 Harmonic Match Algorithm When comparing online bin packing algorithms we often face the following question: is it possible to design an algorithm which has a good performance in both worst-case and average-case settings?. Algorithms which have better competitive ratios than best-fit and first-fit often have poor averagecase ratio (see Table ). Is it possible to achieve an average-case ratio of (as best-fit and first-fit do) and yet improve the competitive ratio to a number lower than.7? In this section, we show that it is possible. Consider a variant of the Harmonic algorithm, called harmonic-match, which also has a parameter k and defines k classes. Unlike Harmonic, each class of the harmonic-match algorithm involves small and large items (as before, small means being smaller than or equal to /2 and large means being larger than /2). More precisely, items in class i (for i k ) have size in the range ( i+2, i+ ] ( i i+, i+ i+2 ]. Class k is special and include items of size at most k+ or larger k k+ than. Figure 8 show the classes of the harmonic-match algorithm. Items in different classes are separately packed from each other. The algorithm applies a relaxed version of the best-fit algorithm to place items of class i. For placing an item of size x, the algorithm works as follows: If x > 0.5, open a new bin. If x 0.5: Use Best Fit strategy to place x together with an item y > 0.5 of the same class. If no such y exists, place x together with items of the same class using Next Fit strategy. 3

14 i i 2 i x x x x x x i k i k k k x x k k k k x k k x k Figure 8: Classes of the harmonic-match algorithm. Intuitively, harmonic-match works similarly to the harmonic algorithm with the same parameter k. The only difference is that, when packing small items, it attempts to place them with large items (of the same class) which will remain along in their bins by the harmonic algorithm. In other words, the number of bins opened by harmonic-match for an input sequence σ is the same as the number of bins opened by harmonic for a sequence σ in which some small items of σ are removed (since they are placed with large items in the harmonic match). Intuitively, the packing of harmonicmatch is the same as the packing of harmonic for a reduced sequence (in which some items are removed). For example, see Figure 9 which contrasts the packing of harmonic with that of harmonic match. Harmonic algorithm is, however, monotone in the sense that removing items does not increase the number of bins that it opens 2. Hence, for any sequence σ we can write Harmonic(σ) = Harmonic-Match(σ ) Harmonic(σ). The first equality comes from our observation about packings of harmonic-match versus harmonic and the second inequality comes from monotonicity of the harmonic algorithm. In short, we can say that harmonic-match dominates harmonic, that is, for any input sequence, the number of bins opened by harmonic-match is less than or equal to that of harmonic algorithm. The following is a direct consequence: Theorem 7. The competitive ratio of the harmonic-match algorithm is at most equal to that of harmonic, that is at most.692. In order to study the average-case ratio of the harmonic match algorithm, we repeat the analysis for best fit for every class of the harmonic-match. An important observation is that, the length of interval of small items for each class is equal to that of large items. So, items of the same class follow a symmetric distribution. As such, with some attention, we can reduce the bin packing instance of length n i formed by items of class i to an instance of upright matching. Since we are applying best-fit for each member of the class, the number of bins opened by harmonic match is expected to be n i /2 + Θ( n i log 3/4 n i ). Summing up over all classes, the cost of harmonic-match is expected to be k i= ( n i /2 + Θ( ) n i log 3/4 n i ) < k n i /2 + kθ( n log 3/4 n) = n/2 + kθ( n log 3/4 n) i=. Since k is a constant compared to n, we have kθ( n log 3/4 n) = Θ( n log 3/4 n). As before the 2 While being monotone seems a natural property of an algorithm, there are many bin packing algorithms such as best-fit and first-fit that are anomalous in the sense that removing items can increase the number of bins that they open. 4

15 < > < > Harmonic Match Harmonic Match (a) packing of the harmonic-match algorithm Harmonic Harmonic (b) packing of the harmonic algorithm The packing of harmonic-match (a) 2 and harmonic 6 5(b) algorithms for the sequence Figure 9: 0.62, 0.28, 0.3,, 0.79, 0.2, 2, 0.33, 0.22, 0.23, 0.27, 0.2, Items with same color belong to the same harmonic-match classes. cost of Opt is expected to be at least n/2 (the expected number of large items). We can conclude the following: Theorem 8. The average-case ratio of Harmonic-Match is and its expected waste is as good as best-fit, that is Θ( n log 3/4 n). So, we conclude the following: Corollary. It is possible to design online bin packing algorithms which maintain the good averagecase performance of best-fit and first-fit while improving their competitive ratio. Experimental Results: The above results indicate that harmonic-match have similar average-case performance as best-fit if item sizes are taken uniformly at random from the range (0, ]. One can expand the range of distributions beyond this distribution to observe the performance of different algorithms for different distributions. For that, let s consider uniform distribution with different ranges for items sizes (ranges (0, /2] and (0, /0]), as well as Normal and Weibull distributions with different parameters. We also consider uniform instances in which items are sorted in decreasing order of their sizes. For all distributions, we computed the average number of bins used by different algorithms for packing 000 sequences of length 00,000. For algorithms that classify items by their sizes, the number of classes K is set to 20. Using the above setting, one can compute the experimental average ratio of an algorithm as the ratio between the observed expected number of bins used by the algorithm and that of OPT. We estimate the number of bins opened by OPT to be the total size of items. Figure 0 shows the bar chart for experimental average ratio of different online algorithms. It can be seen that HM and RHM, along with BF and FF, have a significant advantage over other algorithms 5

16 WF HA RFF RHA OM FF BF HM RHM NF WF HA RFF RHA OM FF BF HM RHM Unifrom- Unifrom-2 Unifrom-3 Normal- Normal-2 Sorted Weibull- Weibull-2 Figure 0: Experimental average-case ratio of different online algorithms for different distributions NF 0.08 WF HA Applications 0.04 of Online Bin Packing RFF 0.02 RHA 0.00 OM FF BF HM RHM Unifrom- Unifrom-2 Unifrom-3 Normal- Normal-2 Sorted Weibull- Weibull-2 Online bin packing has many practical applications. An example is cutting stock problem, which is the problem of cutting standard-sized (that is, uniform sized) stock material into pieces of different sizes. Here, the stock material can be roles of paper or sheet material which represent bins of uniform capacity. Stock pieces are often requested in an online manner and represent items of different sizes. Hence, in a very simple setting, cutting stock is equivalent to online bin packing 3. Cutting stock is a direct application of bin packing in which you do not need to change the classic definition of the problem. In practice, however, we often need to adapt the problem s definition to the requirements of the specific application. In this section, we visit two such applications in the context of server consolidation in the cloud. In the server consolidation problem, you have a large number of uniform servers in a data-center. These servers have a certain capacity in terms of memory, cpu-power, bandwidth, etc. For different applications, one of these features act as a bottleneck and define the actual capacity of the server, e.g., for database tenant placements main memory is the bottleneck while for renting servers in the cloud, the bandwidth is the bottleneck. Given these servers, we need to serve an online (evolving) input of jobs to these servers. Here, by job, we can mean different processes each having certain requirements in terms of memory, computational power, bandwidth, etc. Again, for a particular application, we focus on the bottleneck constraint and call it the load of the job. So, in a sense, we are having a sequence of jobs (items) with different loads (sizes), and we want to place them into a minimum number of servers (bins) of uniform capacity. Minimizing the number of servers is very important to lower the costs in a data center. In particular, having some servers off can help a lot in saving on electricity costs associated with running and cooling servers. The problem of assigning jobs to servers to minimize the number of active servers is called server consolidation problem. In the simplest setting, server consolidation is the same as the classic bin packing problem. In practice, however, we need extra requirements and assumptions which make the problem different. In what follows, we see two different applications of the bin packing in the context of server consolidation. 3 More generally stock material can be 2-dimensional objects which relates the problem to multiple variants of 2-dimensional bin packing. 6

17 a (0.3) a (0.3) b (0.5) c (0.3) d () S S 2 S 3 S 4 S 5 e (0.05) e (0.05) b (0.5) d () a (0.3) f (0.2) e (0.05) b (0.5) c (0.3) e (0.05) d () f (0.2) f (0.2) e (0.05) b (0.5) e (0.05) c (0.3) d () c (0.3) f (0.2) a (0.3) a (0.3) b (0.5) c (0.3) d () a (0.3) a (0.3) b (0.5) c (0.3) d () S S 2 S 3 S 4 S 5 (a) A valid packing; failing any server (e.g., server S 3) does not cause an overflow. S S 2 S 3 S 4 S 5 (b) An invalid packing; here failing S 2 causes an overflow on S. Figure : A valid and invalid fault-tolerant packing for sequence σ = a = 0.6, b = 0.3, c = 0.6, d = 0.8, e = 0., f =. Note that each item has two replicas with half the load. e (0.05) 4. Fault-tolerant Bin Packing a (0.3) In the real-world, when assigning jobs to f (0.2) e (0.05) servers, we need fault-tolerant solutions where failing of one or more servers does not not cause an interrupt in the system. In order to achieve fault-tolerance, e (0.05) c (0.3) c (0.3) one can replicate an item into more b (0.5) than one server. d () Consider an input sequence σ = {a,..., a n } in which items (jobs) of different sizes (loads) d () should be placed in a minimum number a (0.3) a of (0.3) bins (servers). c (0.3) In the simplest fault-tolerant setting, each b (0.5) item a i should be placed on at least two servers. In doing so, the load (e.g., bandwidth of a Netflix S S 2 S 3 S 4 S movie or the volume of queries assigned to a cloud database) 5 is equally divided between the two hosting servers. Hence, the goal is the two replicas of the item a i, each having size a i /2, in two different bins. When a server fails, the load of replicas hosted by it is redirected to the other servers hosting those replicas. In anticipation of other servers failure, each bin should have a reserved space for the extra load that might be redirected to that server in case of another server s fault. We say a packing is valid if the extra load redirected to servers in case of the failure of any server does not cause an overflow in other servers. Note that in this simple setting, we assume at most one server can fail at each time. This restriction can be relaxed in practice but we skip the details here (e.g., see [7, 8]). Figure provides an illustration of valid and invalid packings. Different algorithms have been proposed for online fault-tolerant bin packing. A simple algorithm is the mirroring algorithm which considers two types of replica (red and blue) for each item and places these replicas separating from each other using best-fit strategy. That is, the packing for the red replicas will be mirrored by the packing for blue replicas. When using the best-fit strategy, the algorithm assumes a capacity of 0.5 for each bin; this is because, in case of the failure of any bin, all its load is redirected to the mirroring bin, that is, the load of the mirroring bin is doubled. Assuming a capacity of /2 ensures that the bin is not overloaded in case of the failure of its mirroring bin. Figure 2 illustrates the mirroring algorithm. Clearly, mirroring algorithm is not a good algorithm for fault-tolerant bin packing. This is because half the capacity of each bin is left empty. To be more precise, for an input formed by replicas of small size ɛ, the mirroring algorithm fills a space of size at most /2 in each bin while an optimal algorithm can mix the replicas in a way that any two bins share exactly one replica; hence, Opt can fill a space of size ɛ in each bin (sine two bins share at most one replica, the extra load redirected to each bin in case of one server s failure is ɛ). We conclude that there are input sequences in which the filled space in each bin of the mirroring algorithm is /2 while bins of Opt f (0.2) 7

18 Figure 2: The packing of mirroring algorithm for sequence σ = a = 0.6, b = 0.3, c = 0.6, d = 0.8, e = 0., f = are filled to a level of ɛ. If S denote the total size of all replicas, the mirroring algorithm opens at least 2S bins while Opt opens S/( ɛ). This shows that the competitive ratio of the mirroring algorithm is at least 2( ɛ) which converges to 2 for large (but constant) values of ɛ. In order to improve over the mirroring algorithm, we introduce another algorithm, named horizontal-harmonic, which works as follows. Similar to the harmonic algorithm for classic bin packing, horizontal-harmonic has k classes and divides replicas based on their sizes into classes. Replicas in the ithe class are in the range ( i+2, i+ ] for i k while replicas in the last class k are in the range (0, k ]. In other words, the classes are ( 3, 2 ], ( 4, 3 ],..., ( k, k ], (0, k ]. Note that the value of k is a constant (e.g., k = 30). Also, note that since items are in the range (0,], replicas are in the range (0,/2]. Horizontal-harmonic treats members of each class separately. It places replicas of class i k in a way that each two bins share replicas of at most one item. To do so, the algorithm places k blue replicas in each bin (and after that opens a new bin). The red replicas associated with these k replicas are scattered into k different bins which also include the red replicas for k other bins opened for blue replicas (see [7] for a precise definition). Figure 3 illustrates the horizontalharmonic algorithm for placing replicas. For items of class k, the algorithm simply does the mirroring algorithm discussed earlier, that is, replicas of the same item are placed in mirroring bins of capacity /2 using best-fit strategy. Theorem 9. Horizontal-harmonic has a competitive ratio of at most Proof. (sketch) We use a weighting argument. As we discussed earlier, a weighting argument has three steps: step I: first, for any replica of size x, we define a weight w(x). Here, we define the weight of replicas in class i as /i (for i k ) and define the weight of a replica of of class k with size x as 2(k+) k x. step II: we should show that the total weight of replicas in any bin of the horizontal-harmonic packing (except possibly a constant number of them) is at least. To see that, note that the algorithm places i replica of class i in each bin of that type. So, all such bins (except possibly a constant number of them) have i items of weight /i which sums up to. For replicas of class k, since the size of these replicas are no larger than k+ and they are placed using the best-fit strategy on bins of presumed capacity /2, the level of each bin (except possibly the last two 8

19 mirrored ones) is at least /2 k+ = k 2(k+) times their size, the total weight of items in each bin will be at least. Since the weight of replicas in this class is 2(k+) k 2(k+) 2(k+) k =. step III: finally, we should show that the total weight of replicas in any bin of Opt cannot be more than.598. This can be show via a case analysis. First, note that if there is a replica of any class i k, that replica could be replaced by a replica of size i+2 + ɛ (that is, the smallest replica of such class) without decreasing weight. So, in order to achieve maximum weight, we use smallest replica of each class. Define the density of each replica as the ratio between its weight and its size. So, the density of the smallest replica of class is /3+ɛ = 3, /2 that of class 2 is /4+ɛ 2, that of class 3 is /3 /5+ɛ 5/3, that of class 4 is /4 /6+ɛ.5, and so on. Now, we are ready to start our case analysis. First, assume there is no replica of class, 2, and 3; if The density (weight divided by size) of other replicas is at most.5 <.597, that is, even if the bin is completely full, it will not have a weight more than.5. Next, assume there is no replica of class and 2 but there is a replica of class 3 (that is of size /5 + ɛ. Because of this replica, there should be an empty space of size at least /5 + ɛ (so that in case of the failure of the bin hosting the other replica, no overflow happens). The remaining space in the bin is 3/5 2ɛ, which can be filled with replicas of weight at most.5. So, the total weight will be at most /3 + (3/5 2ɛ) <.597. Next, assume there is no replica of class but there is a replica of class 2 with size /4 + ɛ. Hence, there should be an empty space of size /4 + ɛ. The remaining space of /2 2ɛ is filled with replicas of density at most 5/3. The total weight will be at most /2 + (/2 2ɛ) 5/3 <.597. Next, assume there is a replica of class with size /3 + ɛ. Hence, there should be an empty space of size at least /3 + ɛ. The remaining space is /3 2ɛ. If there is no replica of class 2, the density of remaining items is at most 5/3, and the total weight will be + (/3 2ɛ) 5/3.55 <.59. Finally, consider a case in which there is a replica of class with size /3 + ɛ and a replica of class 2 with size /4 + ɛ. Considering the reserved space, the remaining space will be (/3 + ɛ + /3 + ɛ + /4 + ɛ) = /2 3ɛ. This space is enough for replicas of class or more (with size /3 + ɛ or smaller). The / density of these items is at most /3+ɛ 3/. The weight of the bin is hence at most + /2 + (/2 3ɛ) 3/ < k reserved space a 3 a 6 a 9 a 7 a 8 a 9 a 2 a 5 a 8 a 4 a 5 a 6 a a 4 a 7 a a 2 a 3 Figure 3: Packing of the horizontal-harmonic algorithm for the sequence a, a 2,... formed by replicas of class 3, that is replicas in the range (/5, /4]. The algorithm places 3 replicas in each bin so that there is enough space for another repica of the same class. Since each two bins share replicas of at most one item, this reserved space is enough in case of any other server s failure. 9

20 A more precise analysis shows that the competitive ratio of harmonic-match is indeed bounded by.597. Note that this competitive ratio is much better than the competitive ratio 2 of the mirroring algorithm. One might ask whether harmonic-match is only good in the worst-case or it has also good typical performance. In fact, the experimental studies show that the algorithm performs much better than algorithms. In other words, the algorithms works well in both worst-case and average-case (see [8] for details). To summarize, an extension of the harmonic algorithm (which is not good for classic bin packing in terms of typical performance) works better than other algorithms for fault-tolerant bin packing. This situation, where a twist in the underlying problem dramatically changes the performance of different algorithms, is typical in applications of bin packing. We will see another example of this phenomenon in the next section. 4.2 Renting Servers in Cloud The classic bin packing problem aims to minimize the number of bins (servers) used to host a sequence of online items (jobs). In some applications, servers are rented and the cost that an algorithm is the defined through the total time that the servers have been rented. In these applications, each job has an arrival time (when it is packed) and a departure time (when it is departed). The departure time is often unknown to the online algorithm. As before, jobs have different sizes (loads) and when a job arrives, it has to be placed in a bin. The cost associated with each bin is the total number of time-steps that it has been in the system. Note that when all jobs in a bin depart, the bin is released. Any bin packing algorithm can be used for placing jobs in the case of renting servers. As an example, consider the input sequence: σ = a = (0.3,, 7), b = (, 2, 7), c = (, 3, 7), d = (0.5, 4, 7), e = (0.3, 5, 20), f = (0., 6, 20) Here, the first number in a tuple indicate the size of the job, the second number indicates its arrival time (the time that it should be packed), and the third one is its departure time (the time that it leaves the system). Note that the departure time of a job is unknown to the algorithm at the time that it is placed into a bin. In the above example, at time-step, First-Fit opens a new bin B for a. At time 2, b is placed in the same bin. At time 3, a new bin B 2 is opened for c. At time 4, d is placed in B 2. At time 5, e is placed in B and at time 6, f is placed in B 2. At time 7, all items except for e and f depart. B and B 2 stay in the system, however, until time-step 20 when e and f depart. The cost associated with B is 20 and that of B 2 is Hence, the total cost of First-Fit is = 36. Note that Opt could place e and f in a new bin B 3. Assuming that, at time-step 7, B and B 2 could be released since all items placed in them departed. In that case, the costs of B, B 2, and B 3 would be 7, 7 3, and 20 5, which sum to 25 which is much better than the cost 36 of First-Fit. A closer look shows that indeed Next-Fit algorithm opens a new bin for e and f and has a cost of 25. So, our first observation is that Next-Fit can be better than First-Fit for this problem (in class bin packing, First-Fit dominates Next-Fit, that is First-Fit is never worse than Next-Fit). We skip the technical details and only review the results with respect to competitive analysis and experimental average-case analysis. Define the length of an item as the difference between its departure and arrival time (e.g., length of a in the above example is 6). Let µ denote the ratio between the longest and shortest length in the input sequence (e.g., in the above example, the longest item is e with length 5 and shortest item is d with length 3; hence µ is 5). It is known that Best-Fit is not competitive [9]. Next-Fit has a comeptitive ratio of at most 2µ + [20]. First-Fit has a competitive ratio of µ + 4 [2]. Meanwhile, no algorithm can have a competitive ratio better than µ 20

21 [20]. Moreover, if the value of µ is known, it is possible to devise an algorithm with competitive ratio of at most µ + 2 [20]. Note that these results are in sharp contrast with the results for the classic bin packing problem (e.g., Best-Fit not-being competitive while Next-Fit having a relatively-good competitive ratio). Experimental studies show that the typical behaviour of online algorithms for renting servers in the cloud is quite different from their worst-case behaviour (captured by competitive anlayis). More precisely, on input sequences generated randomly, Best-Fit is much better than First-Fit and Next-Fit (note that under competitive analysis Best-Fit is much worse than the other two). We might ask the same question that we asked in Section 3.2 in the context of the classic bin packing problem: is there an algorithm which works as well as First-Fit and Next-Fit in the worst-case and as good as Best-Fit in the average-case? The answer to this question is yes. We can introduce a new algorithm, named Move-To-Front which works by placing each item in the first bin which has enough space for it and opening a new bin if a suitable bin does not exist (as First-Fit does); after placing an item into a bin, the algorithm moves that bin to the front of the list of the bins (so that it is probed first for placing the next item). The algorithm works based on the intuition that items that arrive together are more likely to depart at the same time, and hence it is better to place them in the same bins. It is known that Move-To-Front is competitive and its competitive ratio is upper-bounded by 6µ + 7 (hence, it is better than Best-Fit in the worst-case). Meanwhile, experimental analysis shows that On average (for sequences in which the size and length items is generated through a probability distribution), Move-To-Front outperforms all algorithms. We refer the reader to [20] for further details. In summary, renting servers in the cloud is an application of bin packing in which the competitive results are in sharp contrast with the classic bin packing. Moreover, the competitive results are not consistent with average-case results. It is possible, however, to design an algorithm (Move-To-Front) which has a bounded competitive ratio (as opposed to e.g., Best-Fit) and better typical performance. 5 Online Bin Packing & Advice As we saw earlier, under the advice setting the online constraint is relaxed and an algorithm is provided with some bits of information, termed as advice, about the input sequence. The advice is generated by a benevolent offline oracle with unbounded computational power, and the online algorithm knows the meaning of the advice (it knows how to interpreted it). In this section, we review some results with respect to the advice complexity of on the online bin packing problem. We answer questions such as: How many bits of advice are sufficient/required to achieve an optimal solution? How many bits of advice are sufficient to achieve a competitive ratio strictly better than all online algorithms? What competitive ratio we can achieve provided linear/sub-linear/constant number of bits of advice? 5. Optimal Solution with Advice In this section we study the amount of advice required to achieve an optimal solution 4. We first investigate the theoretical setting in which there is no restriction on the number of distinct items or 4 The material in this section is taken from [22]. 2

22 on their sizes. We observe that there is a simple algorithm that receives n log Opt(σ) bits of advice and achieves an optimal solution. Such an algorithm basically reads log Opt(σ) bits for each item, encoding the index of the bin that includes the item in an optimal packing. We show that the upper bound given by this algorithm is tight up to lower order terms, when n 2 Opt(σ) Θ(n). Theorem 0. To achieve an optimal packing for a sequence of size n which can be optimally packed in Opt(σ) bins, it is sufficient to receive n log Opt(σ) bits of advice, and any deterministic online algorithm requires at least (n 2 Opt(σ)) log Opt(σ) bits of advice to achieve an optimal packing. Proof. Upper Bound: Consider an offline oracle that knows an optimal packing (note that such an oracle has unbounded computational power). This oracle simply writes on the advice tape, for each item x, except for the last two, the index of the bin in an optimal packing that x is packed in. To pack any item x, the online algorithm simply reads the index of the bin that x should be packed in and packs x accordingly. For the last two items, the algorithm simply uses Best-Fit. Since the packing is the same as one for an optimal algorithm up to that point, if it is impossible to fit both of the remaining items in the bins already used, Best-Fit will ensure that at least one fits if that is possible. If both of the remaining items fit in the same already open bin, it is fine to put the first one of the last two items anywhere it fits, since there will still be space remaining for the last. If both of the remaining items fit in open bins, but should be in different bins, using Best-Fit will ensure that they are both placed there. This requires log Opt(σ) bits of advice per item which sums up to (n 2) log Opt(σ) bits of advice. The algorithm should also know the value of X = log Opt(σ) in order to read the appropriate number of bits on each request. This can be done by encoding X in unary and terminating with a zero. This uses no more than 2 log Opt(σ) bits. Consequently the number of advice bits used by the algorithm is n log Opt(σ) as stated by the theorem. Lower Bound: Consider a set S = {σ,..., σ N } of sequences, so that each σ r has length n for r N. Let k n. Each sequence σ r in the set has the form 4, 8, 6,..., 2 n k+, ur, u r 2,..., u r k in which u r,..., u r k are defined as follows. Consider a set V of vectors of the form V r = (v r =, v r 2 = 2,..., v r k = k, v r k+, v r k+2,..., v r n k) such that each vh r {,..., k} for k + h n k. For example, when n = 8 and k = 3, the vector (, 2, 3, 2, ) is a vector in V. We associate with each vector V r V a sequence σ r S. For a vector V r V and bin j, define u r j = a i, where a i is the ith item in the sequence σ r, i.e., a i = 2. Note that all u i+ j s i n k v r i =j are strictly larger than 0.5. Clearly, Opt(σ r ) = k for all r. We refer to the first n Opt(σ) items as small items and the last Opt(σ) items as large items. For example, assume n = 8 and Opt(σ) = 3. For a vector V r = (, 2, 3, 2, ), we have u r = ( ) = , ur 2 = ( ) = , and ur 3 = 6 = Hence, the sequence σ r associated with V r is 4, 8, 6, 32, 64, , , In fact, V r indicates in which bin each of the first n Opt(σ) items of σ r should be packed, and at the end, u r j fills the empty space of the jth bin to capacity to achieve an optimal packing P for 22

23 a given sequence (it is optimal since all bins are fully packed). The restriction that the sequence starts with k distinct items ensures that we do not need to consider permutations of the bins in P as additional optimal packings. We claim that P is the unique optimal packing. Suppose there is another optimal packing P. Observe that each bin includes at most one large item, and indeed exactly one since we assume it is also optimal. Let a i ( i n Opt(σ)) be the first item which is packed in some other bin in P than the one prescribed by P. Consider the bin B that a i is packed into in P. This bin cannot be fully packed in P since a i is strictly larger than the total size of all remaining small items, i.e., even if we put all of them in the empty space of a i, there is still some empty space in B. As a result P cannot be optimal. Hence there is unique solution to pack each sequence in the set S. Note that there are N = Opt(σ) n 2 Opt(σ) sequences S. We claim that these sequences need separate advice strings. Assume to the contrary that this is not the case, and let σ r, σ r S (r r ) be two different sequences with the same advice string. Note that the first n Opt(σ) items in these sequences are the same. Since the online algorithm performs deterministically and we assume it receives the same advice for both σ r and σ r, the partial packings of the algorithms after packing the first n Opt(σ) items are the same for both sequences. However, as discussed earlier, this implies that the final packing of the algorithm is different from the optimal packing prescribed by V r for at least one of the sequences. As discussed, such a packing is the unique optimal packing and deviating from that increases the number of bins used by the algorithm by at least one unit. As a result, the algorithm performs non-optimally for at least one of σ r or σ r. We conclude that the sequences in the set S need separate advice strings. Since there are N = Opt(σ) n 2 Opt(σ) sequences in S, at least log(opt(σ) n 2 Opt(σ) ) = (n 2 Opt(σ)) log Opt(σ) bits of advice are required to get that many distinct advice strings. Next, we consider a more realistic scenario where there are m = O() distinct item item sizes and the values of these item sizes are known to the algorithm. Theorem. Consider the online bin packing problem in which there are m = O() distinct item sizes. The item sizes are assumed to be known. There is an optimal online algorithm that receives m log n + o(log n) bits of advice. Proof. The offline oracle simply encodes the input sequence, considered as a multi-set, in m log(n + ) bits of advice. In order to do that, it writes the number of occurrences of each of the m distinct items on the tape. Provided with the frequencies of items, the algorithm can solve the problem in an offline manner and upon receiving items in the online manner, places them into the their designated spot in the offline solution (note that we are not concerned with the computational power of the online algorithm). The algorithms reads frequencies of items in chunks of X = log(n + ) bits and consequently needs to know the value of X. So, we add self-delimited encodings of X at the beginning of the tape using e(x) bits. The number of advice bits used by the algorithm is thus m log(n + ) + Olog log n, which is m log(n + ) + o(log n) as m o(n). We show that the above upper bound is asymptotically tight. We start with the following simple lemma. The proof is based on simple algebraic observations and we skip it here. Lemma 6. Consider the equation x + 2x αx α = X in which the x i s (i α) and X are ( ) α non-negative integers. If X is sufficiently large, then this equation has at least + 2X α(α+) solutions. 23

24 Theorem 2. At least (m 3) log n 2m log m bits of advice are required to achieve an optimal solution for the online bin packing problem on sequences of length n with m distinct item sizes. Proof. We define a family of sequences of length n and containing m distinct item sizes and show that the sequences in this family need separate advice strings to be optimally packed by an online algorithm. To define the family, we fix m item sizes as being { 2m, m+2 2m, m+3 2m,..., 2m 2m, }. To simplify the argument, we scale up the sizes of bins and items by a factor of 2m. So, we assume the item sizes are {, m + 2, m , 2m, 2m}, and the bins have capacity 2m. Each sequence in the family starts with n/2 items of size. Consider any packing of these items in which all bins have level at most equal to m 2. Such a packing includes a bins of level (one item of size in each), a 2 bins of level 2 (two items of size in each), etc., such that the a i s are non-negative integers ( ) m 3 n and a + 2a (m 2)a m 2 = n/2. By Lemma 6, there are at least + (m )(m 2) distinct packings with the desired property. For any of these packings, we define a sequence in our family. Such a sequence starts with n/2 items of size and is followed by another n/2 items. Let B denote the number of bins in a given packing of the first n/2 items, so that B n/2. The sequence associated with the packing is followed by B items of size larger than m + which completely fit these bins (in non-increasing order of their sizes). Finally, we include another n/2 B items of size 2m in the sequence to achieve a sequence of length n. We claim that any of the sequences in the family has a unique optimal packing of size n/2. This is because there are exactly n/2 large items of size strictly greater than m (more than half the capacity of the bin), and the other n/2 items have small size (which fit the empty space of all bins). So each bin is fully packed with one large item of size x and 2m x items of size (see Figure 4). The unique optimal packing of each sequence is defined by the partial packing of the first n/2 small items. Consider a deterministic online algorithm Alg receiving the same advice string for two sequence σ and σ 2. Since Alg is deterministic and both sequences start with the same subsequence of small items, the partial packing of the algorithm after packing the first n/2 items is the same for both σ and σ 2. As a result, the final packing of Alg is sub-optimal for at least one them. We conclude that any deterministic online algorithm should receive distinct advice strings for each ( m 3 n sequence in the family. Since there are at least + (m )(m 2)) sequences in the family, at ( ) n least (m 3) log + (m )(m 2) > (m 3) log n 2m log m bits of advice are required. 5.2 Sublinear Advice We start this section by showing that advice of size O(log n) is sufficient to achieve a competitive ratio of.5 for packing a sequence of n items. Recall that no online algorithm can have a competitive ratio better than.54 []. Hence, the algorithm that we present, named reserve-critical is strictly better than all online algorithms under competitive analysis. The reserve-critical algorithm works by classifying items based on their sizes as follows: Huge items are items larger than 2/3. Critical items are items with size in the range (/2, 2/3]. Mini items are items with size in the range (/3, /2]. Tiny items are items smaller than /3. 24

25 The advice for the reserve-critical algorithm is simply the number of critical items. Since there are n items in the sequence, the number of critical items can be encoded using O(log n) bits of advice. Assume there are x critical items in a sequence. Provided with the value of x, the reserve-critical algorithm opens x bins, named critical bins in which a space of size 2/3 is reserved for critical items. After this, the algorithms packs items of the inputs sequence as follows: If an incoming item is huge, a new bin is opened for it. If an incoming item is critical, it is placed in the reserved space of one of any critical bin. If an incoming item is mini, it is placed in a mini-bin opened for another mini item. If no such bin exist, a new bin is opened for the item and is declared as a mini-bin. In other words, pairs of mini items are placed in mini bins (and no other item goes into mini bins). If an incoming item is tiny, the algorithm applies the first-fit strategy to place it in the nonreserved space of critical bins. Note that there is a non-reserved spaces of size /3 in each critical bin. If no critical bin has enough space for tiny items, they are placed in tiny bins which only include tiny items (following the First-Fit strategy). Theorem 3. The reserve-critical algorithm has a competitive ratio of at most.5. Proof. Looking at the final packing of the reserve-critical algorithm for an input sequence, we distinguish two cases. In the first case, assume there is a tiny bin in the final packing; in this case we show that almost-all bins in the packing of reserve-critical are full to upto a level of 2/3 and hence the algorithm is.5-competitive. In the second case where there is no tiny bin, we use a weighting function to get the desired result. First assume a bin is opened by tiny items. We show the level of all bins is at least 2/3. Note that all huge bins include < 9 an 3 item 6 5 of size 3 larger than 4 5 2/3 6 8 and 6 4 hence 5 > have the desired level. Similarly, all bins opened by mini-items (except possibly the last one) include two mini items in the range (/3, /2]; hence, the level of these bins is in the range (2/3, ]. Next, we argue that all critical bins, except possibly one of them, receive tiny items with total size at least /6. Consider otherwise, i.e., Example: n=30, m=6 (bin capacities scaled up by 2) sequence: < (5) (7) > (a) The packing of sequence (5) (7) sequence: < (5) (6) > (b) The packing of sequence (5) (6) 2 2 Figure 4: The optimal packings for two sequences of the family when n = 30 and m = 6 (item sizes and bin capacities are scaled by 2m = 2)

26 assume there are two critical bins B and B 2 in each of which total size of tiny items is less than /6. Without loss of generality, assume B appears earlier than B 2 in the First-Fit least of bins. Since B has a non-reserved empty space of size at least /3 /6 = /6 (because the the total unreserved space is /3, and the occupied part of that has size /6), all tiny items placed in the bins opened after B have size larger than /6. This implies that the tiny items placed in B 2 are larger than /6. So the first tiny item placed in B 2 results in a sum of more than /6 for items placed in B 2. But we assumed that the total size of tiny items in B 2 is less than /6. This is only possible if no tiny item is placed in B 2. This contradicts, however, with the fact a tiny bin has been opened (that is, the algorithm had to place a tiny item in B 2 before opening a tiny bin). We conclude that the initial assumption that two critical bins each receive tiny items of total size less than /6 is wrong, i.e., except for possibly one critical bin, all others receive tiny items of total size at least /6. That means the level of these bins is at least /2 (for the critical item) plus /6 (for tiny items) which sums up to 2/3. Next, we show the level of tiny bins, except for possibly one, is at least 2/3. This is easy because tiny items have size at most /3; so tiny bin is opened unless previous tiny bins are filled upto level 2/3 (otherwise the item opening the new bin could fit in one of the existing bins). In summary, we proved that the level of all bins of the reserve-critical algorithm, except possibly one critical, one mini, and one tiny bin, is at least 2/3. Hence, if S denote the total size of items in the input sequence, the number of bins opened by reserve-critical is at most 3S/2 + 3 while the number of bins opened by Opt is at least S. We conclude that the competitive ratio of the algorithm is at most 3/2 in this case. Next, consider there is no tiny bin in the final packing of the reserve-critical algorithm. For this case we use a weighting argument. Define the weight of huge and critical items to be, the weight of mini items to be /2, and the weight of tiny items to be 0. We show that the weight of all bins, except possibly one bin, in the packing of reserve-critical is at least. Note that bins opened by huge items have an item of weight. Similarly, all critical bins have a critical item of weight, and all mini bins (except the last one) include two mini-items of weight /2. Note that there is no tiny bin in the packing of the algorithm. Hence, all bins have weight (except possibly one bin). Finally, we need to show that the weight of any bin in the optimal packing cannot be more than. Note that if a bin of Opt includes a huge item, it will not have enough space for any other item of non-zero weight (that is a non-tiny item). So, its weight cannot be more than. If a bin of Opt includes a critical item, it can possibly fit at most one mini item; the total weight of items will be +/2 =.5. If a bin does not include a huge or critical item, it can fit no more than two mini items with total weight. So, the weight of any bin of Opt cannot be more than.5. The above theorem implies that, provide with O(log n) bits of advice, we can achieve a competitive ratio of at most.5. In fact, the size of advice can be reduced to a constant. Consider an algorithm named Red-Blue which works as follows. The offline oracle for the Red-Blue algorithm applies the Reserve-Critical algorithm and finds the ratio between critical and tiny bins. The (approximate value of this) ratio is encoded using k bits of advice. Provided with the ratio, the Red-Blue algorithm attempts to pack the input sequence in the same way that reserve-critical does. Precisely, a bin is opened for each huge item and each pair of mini items. The algorithm packs critical and tiny items in a way to maintain the ratio between critical and tiny bins close to the one prescribed in advice. Namely, the algorithm places a critical item into the reserved space of a critical bin; if no such with reserved space exists, the algorithm opens a new bin and declare it as critical bin (a red bin). The algorithm places a tiny item in non-reserved space of critical bins (using the first-fit strategy). If no such critical bin exists, the algorithm places the item in the available space of a tiny bin (using the next-fit or first-fit strategy). If no suitable tiny bin exists, then the algorithm opens a new bin. This bin can be declared as a critical bin (red bin) with a reserved space 26

27 Figure 5: Packings of Opt, SBF, and LBF for σ = 5, 0.6, 0.75, 0.34,, 0.56, 0.35, 0.55, 0.5. for future critical items or a tiny bin (blue bin) dedicated to tiny items. The algorithm declares the new bin as a critical or a tiny bin so that the ratio between the number of these bins becomes closer to the ratio received in advice. We skip the details and refer the reader to [23] where it is shown that the competitive ratio of the Red-Blue algorithm in which the approximate value of the ratio is encoded in k bits achieves a competitive ratio of k/2+. This yields to the following theorem: Theorem 4. It is possible to achieve a competitive ratio better than all online bin packing algorithms when provided with O() bits of advice. The above theorem implies that, with advice of constant size, we can achieve a competitive ratio close to.5. In fact, with a more complicated argument, we can show that with advice of constant size, we can achieve an algorithm with competitive ratio of.47 (see [23] for details). That algorithm packs items larger than /3 separately from other items in certain scenarios. While we do not go through the details, we mention how advice can help packing items of size larger than /3. Assume all items are larger than /3. As before, call an item small if it is no-larger than /2 and large otherwise. Consider two algorithms named small-best-fit (SBF) and large-best-fit (LBF) which work as follows. SBF opens a new bin for each large item and applies the best-fit strategy to place small items. LBF opens a new bin for each small item and applies the best-fit strategy to place large items. As you can see, the two algorithm are somehow complements of each other. Figure 5 illustrates the two algorithms. One can easily check that the these two algorithms do not have a promising competitive ratio (as an exercise, try to find their competitive ratio). However, we have the following theorem for the competitive ratio of the better algorithm among Sbf and Lbf (from [23]): Theorem 5. When all items are larger than /3, the better algorithm among Sbf and Lbf has a competitive ratio of.39. The above theorem implies that, with only one bit of advice, we can achieve a competitive ratio of.39 (when items are larger than /3). Two algorithms that complement each other can be thought as two algorithms that run in parallel (and at the end of the packing, the better packing is saved and the other one is discarded). Such parallel schemes for online algorithms define a direction for the future work on practical applications of advice. Lower-bound: We review algorithms like reserve-critical, Red-Blue, Sbf, and Lbf which show us that advice of constant or sublinear size is very useful for improving the competitiveness of online algorithms. In this section, we describe a lower bound that reveals the limitations of advice of sublinear size. 27

28 Figure 6: An instance of a lower-bound input sequence; an online algorithm should place smaller white items in the bins opened for green items and the larger white items in separate bins to be matched with red items. Theorem 6. Advice of size Ω(n) is required to achieve an algorithm with competitive ratio better than 9/8 for packing inputs of length n. Proof. (sketch) We use a reduction from binary guessing problem. Consider σ = ɛ, ɛ, }{{} m green items a, a 2, a 3..., a 2m, }{{} b,... b m }{{} white items in range(/3,/2] complements of smaller white items Any online algorithm has to open m bins for the first m items (no two of them fit in the same bin). Ant of the following 2m white items can fit in the m bins opened for the first items. The algorithm places the larger m white items in those bins and places each of the smaller m white items into a separate bin so that when the complements of these items arrive at the end of the sequence (the last m items), they fit in these bins. This way, Opt opens 2m bins for packing σ. Figure 6 shows the packing of Opt for a sample input. One can check that if the online algorithm places a white item, belonging to the smaller half of white items into the bins opened for the first item, it cannot pack the input into 2m bins. Similarly, if the algorithm places a white item belonging to the larger half of white items into new bins, the packing of the algorithm will be sub-optimal. In a sense, the algorithm should guess whether each white item is among the larger half (has type large ) or smaller half (has type small ) of white items. The adversary can send the white items in a way that the algorithm cannot use the sizes of previously packed white items to guess the type of the current item. So, the algorithm should guess the type of a white item without any clue based on the sizes of previous items. This relates the problem to the binary guessing problem (where the online algorithm has to guess whether the current bin in a bit-string is 0 or ). In [23], it is proved that for any four mistakes in the guessing of the type of white items, the online algorithms has to open an extra bin. A careful reduction of binary guessing to these instances of bin packing completes the proof. So, in order to achieve a competitive ratio better than 9/8 a linear number of bits of advice is required. This result was later improved to show that, in order to achieve a competitive ratio better than , a linear number of bits of advice is required [24]. 28

COMP Online Algorithms. List Update with Advice & Bin Packing. Shahin Kamali. Lecture 14 - Oct. 23, 2018 University of Manitoba

COMP Online Algorithms. List Update with Advice & Bin Packing. Shahin Kamali. Lecture 14 - Oct. 23, 2018 University of Manitoba COMP 7720 - Online Algorithms List Update with Advice & Bin Packing Shahin Kamali Lecture 14 - Oct. 23, 2018 University of Manitoba COMP 7720 - Online Algorithms List Update with Advice & Bin Packing 1

More information

COMP Online Algorithms. Online Bin Packing. Shahin Kamali. Lecture 20 - Nov. 16th, 2017 University of Manitoba

COMP Online Algorithms. Online Bin Packing. Shahin Kamali. Lecture 20 - Nov. 16th, 2017 University of Manitoba COMP 7720 - Online Algorithms Online Bin Packing Shahin Kamali Lecture 20 - Nov. 16th, 2017 University of Manitoba COMP 7720 - Online Algorithms Online Bin Packing 1 / 24 Review & Plan COMP 7720 - Online

More information

Efficient Online Strategies for Renting Servers in the Cloud. Shahin Kamali, Alejandro López-Ortiz. University of Waterloo, Canada.

Efficient Online Strategies for Renting Servers in the Cloud. Shahin Kamali, Alejandro López-Ortiz. University of Waterloo, Canada. Efficient Online Strategies for Renting Servers in the Cloud Shahin Kamali, Alejandro López-Ortiz University of Waterloo, Canada. arxiv:408.456v [cs.ds] 8 Aug 04 Abstract. In Cloud systems, we often deal

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

On the Max Coloring Problem

On the Max Coloring Problem On the Max Coloring Problem Leah Epstein Asaf Levin May 22, 2010 Abstract We consider max coloring on hereditary graph classes. The problem is defined as follows. Given a graph G = (V, E) and positive

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Subhash Suri November 27, 2017 1 Bin Packing Algorithms A classical problem, with long and interesting history. One of the early problems shown to be intractable. Lends to simple

More information

Advanced Algorithms. On-line Algorithms

Advanced Algorithms. On-line Algorithms Advanced Algorithms On-line Algorithms 1 Introduction Online Algorithms are algorithms that need to make decisions without full knowledge of the input. They have full knowledge of the past but no (or partial)

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Approximation Algorithms CLRS 35.1-35.5 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 30 Approaching

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 22.1 Introduction We spent the last two lectures proving that for certain problems, we can

More information

COMP Online Algorithms. k-server Problem & Advice. Shahin Kamali. Lecture 13 - Oct. 24, 2017 University of Manitoba

COMP Online Algorithms. k-server Problem & Advice. Shahin Kamali. Lecture 13 - Oct. 24, 2017 University of Manitoba COMP 7720 - Online Algorithms k-server Problem & Advice Shahin Kamali Lecture 13 - Oct. 24, 2017 University of Manitoba COMP 7720 - Online Algorithms k-server Problem & Advice 1 / 20 Review & Plan COMP

More information

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely

More information

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017 COMPSCI 632: Approximation Algorithms August 30, 2017 Lecturer: Debmalya Panigrahi Lecture 2 Scribe: Nat Kell 1 Introduction In this lecture, we examine a variety of problems for which we give greedy approximation

More information

Primality Testing. Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers

Primality Testing. Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers Primality Testing Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers Exponential in p (number of bits to represent p) Improvement:

More information

The Encoding Complexity of Network Coding

The Encoding Complexity of Network Coding The Encoding Complexity of Network Coding Michael Langberg Alexander Sprintson Jehoshua Bruck California Institute of Technology Email: mikel,spalex,bruck @caltech.edu Abstract In the multicast network

More information

Approximation Algorithms

Approximation Algorithms Chapter 8 Approximation Algorithms Algorithm Theory WS 2016/17 Fabian Kuhn Approximation Algorithms Optimization appears everywhere in computer science We have seen many examples, e.g.: scheduling jobs

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Subhash Suri June 5, 2018 1 Figure of Merit: Performance Ratio Suppose we are working on an optimization problem in which each potential solution has a positive cost, and we want

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14 600.363 Introduction to Algorithms / 600.463 Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14 23.1 Introduction We spent last week proving that for certain problems,

More information

Approximation Algorithms for Wavelength Assignment

Approximation Algorithms for Wavelength Assignment Approximation Algorithms for Wavelength Assignment Vijay Kumar Atri Rudra Abstract Winkler and Zhang introduced the FIBER MINIMIZATION problem in [3]. They showed that the problem is NP-complete but left

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Spring 2019 Alexis Maciel Department of Computer Science Clarkson University Copyright c 2019 Alexis Maciel ii Contents 1 Analysis of Algorithms 1 1.1 Introduction.................................

More information

ARELAY network consists of a pair of source and destination

ARELAY network consists of a pair of source and destination 158 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL 55, NO 1, JANUARY 2009 Parity Forwarding for Multiple-Relay Networks Peyman Razaghi, Student Member, IEEE, Wei Yu, Senior Member, IEEE Abstract This paper

More information

Solution for Homework set 3

Solution for Homework set 3 TTIC 300 and CMSC 37000 Algorithms Winter 07 Solution for Homework set 3 Question (0 points) We are given a directed graph G = (V, E), with two special vertices s and t, and non-negative integral capacities

More information

Parameterized Complexity of Independence and Domination on Geometric Graphs

Parameterized Complexity of Independence and Domination on Geometric Graphs Parameterized Complexity of Independence and Domination on Geometric Graphs Dániel Marx Institut für Informatik, Humboldt-Universität zu Berlin, Unter den Linden 6, 10099 Berlin, Germany. dmarx@informatik.hu-berlin.de

More information

On Covering a Graph Optimally with Induced Subgraphs

On Covering a Graph Optimally with Induced Subgraphs On Covering a Graph Optimally with Induced Subgraphs Shripad Thite April 1, 006 Abstract We consider the problem of covering a graph with a given number of induced subgraphs so that the maximum number

More information

Algorithms for Grid Graphs in the MapReduce Model

Algorithms for Grid Graphs in the MapReduce Model University of Nebraska - Lincoln DigitalCommons@University of Nebraska - Lincoln Computer Science and Engineering: Theses, Dissertations, and Student Research Computer Science and Engineering, Department

More information

Greedy algorithms is another useful way for solving optimization problems.

Greedy algorithms is another useful way for solving optimization problems. Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These

More information

Randomized algorithms have several advantages over deterministic ones. We discuss them here:

Randomized algorithms have several advantages over deterministic ones. We discuss them here: CS787: Advanced Algorithms Lecture 6: Randomized Algorithms In this lecture we introduce randomized algorithms. We will begin by motivating the use of randomized algorithms through a few examples. Then

More information

3 No-Wait Job Shops with Variable Processing Times

3 No-Wait Job Shops with Variable Processing Times 3 No-Wait Job Shops with Variable Processing Times In this chapter we assume that, on top of the classical no-wait job shop setting, we are given a set of processing times for each operation. We may select

More information

Comp Online Algorithms

Comp Online Algorithms Comp 7720 - Online Algorithms Assignment 1: Introduction, Searching & List Update Shahin Kamalli University of Manitoa - Fall 2018 Due: Thursday, Octoer 4th at 11:59 pm Octoer 29, 2018 The real prolem

More information

Online algorithms for clustering problems

Online algorithms for clustering problems University of Szeged Department of Computer Algorithms and Artificial Intelligence Online algorithms for clustering problems Ph.D. Thesis Gabriella Divéki Supervisor: Dr. Csanád Imreh University of Szeged

More information

Some Applications of Graph Bandwidth to Constraint Satisfaction Problems

Some Applications of Graph Bandwidth to Constraint Satisfaction Problems Some Applications of Graph Bandwidth to Constraint Satisfaction Problems Ramin Zabih Computer Science Department Stanford University Stanford, California 94305 Abstract Bandwidth is a fundamental concept

More information

Batch Coloring of Graphs

Batch Coloring of Graphs Batch Coloring of Graphs Joan Boyar 1, Leah Epstein 2, Lene M. Favrholdt 1, Kim S. Larsen 1, and Asaf Levin 3 1 Dept. of Mathematics and Computer Science, University of Southern Denmark, Odense, Denmark,

More information

6 Randomized rounding of semidefinite programs

6 Randomized rounding of semidefinite programs 6 Randomized rounding of semidefinite programs We now turn to a new tool which gives substantially improved performance guarantees for some problems We now show how nonlinear programming relaxations can

More information

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory CSC2420 Fall 2012: Algorithm Design, Analysis and Theory Allan Borodin September 20, 2012 1 / 1 Lecture 2 We continue where we left off last lecture, namely we are considering a PTAS for the the knapsack

More information

Online file caching with rejection penalties

Online file caching with rejection penalties Online file caching with rejection penalties Leah Epstein Csanád Imreh Asaf Levin Judit Nagy-György Abstract In the file caching problem, the input is a sequence of requests for files out of a slow memory.

More information

Solutions for the Exam 6 January 2014

Solutions for the Exam 6 January 2014 Mastermath and LNMB Course: Discrete Optimization Solutions for the Exam 6 January 2014 Utrecht University, Educatorium, 13:30 16:30 The examination lasts 3 hours. Grading will be done before January 20,

More information

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings On the Relationships between Zero Forcing Numbers and Certain Graph Coverings Fatemeh Alinaghipour Taklimi, Shaun Fallat 1,, Karen Meagher 2 Department of Mathematics and Statistics, University of Regina,

More information

Matching Theory. Figure 1: Is this graph bipartite?

Matching Theory. Figure 1: Is this graph bipartite? Matching Theory 1 Introduction A matching M of a graph is a subset of E such that no two edges in M share a vertex; edges which have this property are called independent edges. A matching M is said to

More information

Treewidth and graph minors

Treewidth and graph minors Treewidth and graph minors Lectures 9 and 10, December 29, 2011, January 5, 2012 We shall touch upon the theory of Graph Minors by Robertson and Seymour. This theory gives a very general condition under

More information

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006 2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006 The Encoding Complexity of Network Coding Michael Langberg, Member, IEEE, Alexander Sprintson, Member, IEEE, and Jehoshua Bruck,

More information

Chapter 8 DOMINATING SETS

Chapter 8 DOMINATING SETS Chapter 8 DOMINATING SETS Distributed Computing Group Mobile Computing Summer 2004 Overview Motivation Dominating Set Connected Dominating Set The Greedy Algorithm The Tree Growing Algorithm The Marking

More information

Department of Mathematics and Computer Science University of Southern Denmark, Odense. Exercises for Week 47 on. Online Algorithms

Department of Mathematics and Computer Science University of Southern Denmark, Odense. Exercises for Week 47 on. Online Algorithms Department of Mathematics and Computer Science University of Southern Denmark, Odense November 7, 06 KSL Exercises for Week 7 on Online Algorithms a topic in DM5 Introduction to Computer Science Kim Skak

More information

Chapter 8 DOMINATING SETS

Chapter 8 DOMINATING SETS Distributed Computing Group Chapter 8 DOMINATING SETS Mobile Computing Summer 2004 Overview Motivation Dominating Set Connected Dominating Set The Greedy Algorithm The Tree Growing Algorithm The Marking

More information

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Recitation 4: Elimination algorithm, reconstituted graph, triangulation Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation 4: Elimination algorithm, reconstituted graph, triangulation

More information

PCP and Hardness of Approximation

PCP and Hardness of Approximation PCP and Hardness of Approximation January 30, 2009 Our goal herein is to define and prove basic concepts regarding hardness of approximation. We will state but obviously not prove a PCP theorem as a starting

More information

Math 5593 Linear Programming Lecture Notes

Math 5593 Linear Programming Lecture Notes Math 5593 Linear Programming Lecture Notes Unit II: Theory & Foundations (Convex Analysis) University of Colorado Denver, Fall 2013 Topics 1 Convex Sets 1 1.1 Basic Properties (Luenberger-Ye Appendix B.1).........................

More information

2 The Fractional Chromatic Gap

2 The Fractional Chromatic Gap C 1 11 2 The Fractional Chromatic Gap As previously noted, for any finite graph. This result follows from the strong duality of linear programs. Since there is no such duality result for infinite linear

More information

General properties of staircase and convex dual feasible functions

General properties of staircase and convex dual feasible functions General properties of staircase and convex dual feasible functions JÜRGEN RIETZ, CLÁUDIO ALVES, J. M. VALÉRIO de CARVALHO Centro de Investigação Algoritmi da Universidade do Minho, Escola de Engenharia

More information

CS261: Problem Set #1

CS261: Problem Set #1 CS261: Problem Set #1 Due by 11:59 PM on Tuesday, April 21, 2015 Instructions: (1) Form a group of 1-3 students. You should turn in only one write-up for your entire group. (2) Turn in your solutions by

More information

princeton univ. F 17 cos 521: Advanced Algorithm Design Lecture 24: Online Algorithms

princeton univ. F 17 cos 521: Advanced Algorithm Design Lecture 24: Online Algorithms princeton univ. F 17 cos 521: Advanced Algorithm Design Lecture 24: Online Algorithms Lecturer: Matt Weinberg Scribe:Matt Weinberg Lecture notes sourced from Avrim Blum s lecture notes here: http://www.cs.cmu.edu/

More information

Online Coloring Known Graphs

Online Coloring Known Graphs Online Coloring Known Graphs Magnús M. Halldórsson Science Institute University of Iceland IS-107 Reykjavik, Iceland mmh@hi.is, www.hi.is/ mmh. Submitted: September 13, 1999; Accepted: February 24, 2000.

More information

On the online unit clustering problem

On the online unit clustering problem On the online unit clustering problem Leah Epstein Rob van Stee June 17, 2008 Abstract We continue the study of the online unit clustering problem, introduced by Chan and Zarrabi-Zadeh (Workshop on Approximation

More information

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Mathematical and Algorithmic Foundations Linear Programming and Matchings Adavnced Algorithms Lectures Mathematical and Algorithmic Foundations Linear Programming and Matchings Paul G. Spirakis Department of Computer Science University of Patras and Liverpool Paul G. Spirakis

More information

Applied Algorithm Design Lecture 3

Applied Algorithm Design Lecture 3 Applied Algorithm Design Lecture 3 Pietro Michiardi Eurecom Pietro Michiardi (Eurecom) Applied Algorithm Design Lecture 3 1 / 75 PART I : GREEDY ALGORITHMS Pietro Michiardi (Eurecom) Applied Algorithm

More information

Approximation Algorithms: The Primal-Dual Method. My T. Thai

Approximation Algorithms: The Primal-Dual Method. My T. Thai Approximation Algorithms: The Primal-Dual Method My T. Thai 1 Overview of the Primal-Dual Method Consider the following primal program, called P: min st n c j x j j=1 n a ij x j b i j=1 x j 0 Then the

More information

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0). CS4234: Optimisation Algorithms Lecture 4 TRAVELLING-SALESMAN-PROBLEM (4 variants) V1.0: Seth Gilbert, V1.1: Steven Halim August 30, 2016 Abstract The goal of the TRAVELLING-SALESMAN-PROBLEM is to find

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Given an NP-hard problem, what should be done? Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one of three desired features. Solve problem to optimality.

More information

SAMPLING AND THE MOMENT TECHNIQUE. By Sveta Oksen

SAMPLING AND THE MOMENT TECHNIQUE. By Sveta Oksen SAMPLING AND THE MOMENT TECHNIQUE By Sveta Oksen Overview - Vertical decomposition - Construction - Running time analysis - The bounded moments theorem - General settings - The sampling model - The exponential

More information

CMPSCI611: Approximating SET-COVER Lecture 21

CMPSCI611: Approximating SET-COVER Lecture 21 CMPSCI611: Approximating SET-COVER Lecture 21 Today we look at two more examples of approximation algorithms for NP-hard optimization problems. The first, for the SET-COVER problem, has an approximation

More information

Lecture 2 - Introduction to Polytopes

Lecture 2 - Introduction to Polytopes Lecture 2 - Introduction to Polytopes Optimization and Approximation - ENS M1 Nicolas Bousquet 1 Reminder of Linear Algebra definitions Let x 1,..., x m be points in R n and λ 1,..., λ m be real numbers.

More information

8 Matroid Intersection

8 Matroid Intersection 8 Matroid Intersection 8.1 Definition and examples 8.2 Matroid Intersection Algorithm 8.1 Definitions Given two matroids M 1 = (X, I 1 ) and M 2 = (X, I 2 ) on the same set X, their intersection is M 1

More information

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007 CS880: Approximations Algorithms Scribe: Chi Man Liu Lecturer: Shuchi Chawla Topic: Local Search: Max-Cut, Facility Location Date: 2/3/2007 In previous lectures we saw how dynamic programming could be

More information

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 While we have good algorithms for many optimization problems, the previous lecture showed that many

More information

JOB SHOP SCHEDULING WITH UNIT LENGTH TASKS

JOB SHOP SCHEDULING WITH UNIT LENGTH TASKS JOB SHOP SCHEDULING WITH UNIT LENGTH TASKS MEIKE AKVELD AND RAPHAEL BERNHARD Abstract. In this paper, we consider a class of scheduling problems that are among the fundamental optimization problems in

More information

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic Principles of AI Planning June 8th, 2010 7. Planning as search: relaxed planning tasks Principles of AI Planning 7. Planning as search: relaxed planning tasks Malte Helmert and Bernhard Nebel 7.1 How to

More information

Welcome to the course Algorithm Design

Welcome to the course Algorithm Design Welcome to the course Algorithm Design Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 13, 15.7.2011 Friedhelm Meyer auf der Heide 1 Topics - Divide & conquer - Dynamic programming - Greedy Algorithms

More information

Notes for Lecture 24

Notes for Lecture 24 U.C. Berkeley CS170: Intro to CS Theory Handout N24 Professor Luca Trevisan December 4, 2001 Notes for Lecture 24 1 Some NP-complete Numerical Problems 1.1 Subset Sum The Subset Sum problem is defined

More information

Models of distributed computing: port numbering and local algorithms

Models of distributed computing: port numbering and local algorithms Models of distributed computing: port numbering and local algorithms Jukka Suomela Adaptive Computing Group Helsinki Institute for Information Technology HIIT University of Helsinki FMT seminar, 26 February

More information

1 The range query problem

1 The range query problem CS268: Geometric Algorithms Handout #12 Design and Analysis Original Handout #12 Stanford University Thursday, 19 May 1994 Original Lecture #12: Thursday, May 19, 1994 Topics: Range Searching with Partition

More information

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions Dr. Amotz Bar-Noy s Compendium of Algorithms Problems Problems, Hints, and Solutions Chapter 1 Searching and Sorting Problems 1 1.1 Array with One Missing 1.1.1 Problem Let A = A[1],..., A[n] be an array

More information

Lecture 2 September 3

Lecture 2 September 3 EE 381V: Large Scale Optimization Fall 2012 Lecture 2 September 3 Lecturer: Caramanis & Sanghavi Scribe: Hongbo Si, Qiaoyang Ye 2.1 Overview of the last Lecture The focus of the last lecture was to give

More information

Problem Set 1. Solution. CS4234: Optimization Algorithms. Solution Sketches

Problem Set 1. Solution. CS4234: Optimization Algorithms. Solution Sketches CS4234: Optimization Algorithms Sketches Problem Set 1 S-1. You are given a graph G = (V, E) with n nodes and m edges. (Perhaps the graph represents a telephone network.) Each edge is colored either blue

More information

Space vs Time, Cache vs Main Memory

Space vs Time, Cache vs Main Memory Space vs Time, Cache vs Main Memory Marc Moreno Maza University of Western Ontario, London, Ontario (Canada) CS 4435 - CS 9624 (Moreno Maza) Space vs Time, Cache vs Main Memory CS 4435 - CS 9624 1 / 49

More information

6 Distributed data management I Hashing

6 Distributed data management I Hashing 6 Distributed data management I Hashing There are two major approaches for the management of data in distributed systems: hashing and caching. The hashing approach tries to minimize the use of communication

More information

Lecture 4: 3SAT and Latin Squares. 1 Partial Latin Squares Completable in Polynomial Time

Lecture 4: 3SAT and Latin Squares. 1 Partial Latin Squares Completable in Polynomial Time NP and Latin Squares Instructor: Padraic Bartlett Lecture 4: 3SAT and Latin Squares Week 4 Mathcamp 2014 This talk s focus is on the computational complexity of completing partial Latin squares. Our first

More information

The k-server problem June 27, 2005

The k-server problem June 27, 2005 Sanders/van Stee: Approximations- und Online-Algorithmen 1 The k-server problem June 27, 2005 Problem definition Examples An offline algorithm A lower bound and the k-server conjecture The greedy algorithm

More information

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Michiel Smid October 14, 2003 1 Introduction In these notes, we introduce a powerful technique for solving geometric problems.

More information

COMP Online Algorithms. Online Graph Problems. Shahin Kamali. Lecture 23 - Nov. 28th, 2017 University of Manitoba

COMP Online Algorithms. Online Graph Problems. Shahin Kamali. Lecture 23 - Nov. 28th, 2017 University of Manitoba COMP 7720 - Online Algorithms Online Graph Problems Shahin Kamali Lecture 23 - Nov. 28th, 2017 University of Manitoba COMP 7720 - Online Algorithms Online Graph Problems 1 / 13 Review & Plan COMP 7720

More information

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem CS61: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem Tim Roughgarden February 5, 016 1 The Traveling Salesman Problem (TSP) In this lecture we study a famous computational problem,

More information

6.856 Randomized Algorithms

6.856 Randomized Algorithms 6.856 Randomized Algorithms David Karger Handout #4, September 21, 2002 Homework 1 Solutions Problem 1 MR 1.8. (a) The min-cut algorithm given in class works because at each step it is very unlikely (probability

More information

Real-time integrated prefetching and caching

Real-time integrated prefetching and caching Real-time integrated prefetching and caching Peter Sanders Johannes Singler Rob van Stee September 26, 2012 Abstract The high latencies for access to background memory like hard disks or flash memory can

More information

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Chapter 11 Approximation Algorithms Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved.

More information

Maximal Independent Set

Maximal Independent Set Chapter 4 Maximal Independent Set In this chapter we present a first highlight of this course, a fast maximal independent set (MIS) algorithm. The algorithm is the first randomized algorithm that we study

More information

Efficiently decodable insertion/deletion codes for high-noise and high-rate regimes

Efficiently decodable insertion/deletion codes for high-noise and high-rate regimes Efficiently decodable insertion/deletion codes for high-noise and high-rate regimes Venkatesan Guruswami Carnegie Mellon University Pittsburgh, PA 53 Email: guruswami@cmu.edu Ray Li Carnegie Mellon University

More information

Scan Scheduling Specification and Analysis

Scan Scheduling Specification and Analysis Scan Scheduling Specification and Analysis Bruno Dutertre System Design Laboratory SRI International Menlo Park, CA 94025 May 24, 2000 This work was partially funded by DARPA/AFRL under BAE System subcontract

More information

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS 11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: vertex cover LP rounding: vertex cover generalized load balancing knapsack problem Lecture slides by Kevin Wayne Copyright 2005

More information

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 36

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 36 CS 473: Algorithms Ruta Mehta University of Illinois, Urbana-Champaign Spring 2018 Ruta (UIUC) CS473 1 Spring 2018 1 / 36 CS 473: Algorithms, Spring 2018 LP Duality Lecture 20 April 3, 2018 Some of the

More information

Online Stochastic Matching CMSC 858F: Algorithmic Game Theory Fall 2010

Online Stochastic Matching CMSC 858F: Algorithmic Game Theory Fall 2010 Online Stochastic Matching CMSC 858F: Algorithmic Game Theory Fall 2010 Barna Saha, Vahid Liaghat Abstract This summary is mostly based on the work of Saberi et al. [1] on online stochastic matching problem

More information

1 The Traveling Salesperson Problem (TSP)

1 The Traveling Salesperson Problem (TSP) CS 598CSC: Approximation Algorithms Lecture date: January 23, 2009 Instructor: Chandra Chekuri Scribe: Sungjin Im In the previous lecture, we had a quick overview of several basic aspects of approximation

More information

Faster parameterized algorithms for Minimum Fill-In

Faster parameterized algorithms for Minimum Fill-In Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Technical Report UU-CS-2008-042 December 2008 Department of Information and Computing Sciences Utrecht

More information

Superconcentrators of depth 2 and 3; odd levels help (rarely)

Superconcentrators of depth 2 and 3; odd levels help (rarely) Superconcentrators of depth 2 and 3; odd levels help (rarely) Noga Alon Bellcore, Morristown, NJ, 07960, USA and Department of Mathematics Raymond and Beverly Sackler Faculty of Exact Sciences Tel Aviv

More information

AM 221: Advanced Optimization Spring 2016

AM 221: Advanced Optimization Spring 2016 AM 221: Advanced Optimization Spring 2016 Prof. Yaron Singer Lecture 2 Wednesday, January 27th 1 Overview In our previous lecture we discussed several applications of optimization, introduced basic terminology,

More information

1. Lecture notes on bipartite matching

1. Lecture notes on bipartite matching Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans February 5, 2017 1. Lecture notes on bipartite matching Matching problems are among the fundamental problems in

More information

PANCYCLICITY WHEN EACH CYCLE CONTAINS k CHORDS

PANCYCLICITY WHEN EACH CYCLE CONTAINS k CHORDS Discussiones Mathematicae Graph Theory xx (xxxx) 1 13 doi:10.7151/dmgt.2106 PANCYCLICITY WHEN EACH CYCLE CONTAINS k CHORDS Vladislav Taranchuk Department of Mathematics and Statistics California State

More information

1 Computing alignments in only linear space

1 Computing alignments in only linear space 1 Computing alignments in only linear space One of the defects of dynamic programming for all the problems we have discussed is that the dynamic programming tables use Θ(nm) space when the input strings

More information

Framework for Design of Dynamic Programming Algorithms

Framework for Design of Dynamic Programming Algorithms CSE 441T/541T Advanced Algorithms September 22, 2010 Framework for Design of Dynamic Programming Algorithms Dynamic programming algorithms for combinatorial optimization generalize the strategy we studied

More information

A Reduction of Conway s Thrackle Conjecture

A Reduction of Conway s Thrackle Conjecture A Reduction of Conway s Thrackle Conjecture Wei Li, Karen Daniels, and Konstantin Rybnikov Department of Computer Science and Department of Mathematical Sciences University of Massachusetts, Lowell 01854

More information

Vertex Cover Approximations

Vertex Cover Approximations CS124 Lecture 20 Heuristics can be useful in practice, but sometimes we would like to have guarantees. Approximation algorithms give guarantees. It is worth keeping in mind that sometimes approximation

More information

Parameterized graph separation problems

Parameterized graph separation problems Parameterized graph separation problems Dániel Marx Department of Computer Science and Information Theory, Budapest University of Technology and Economics Budapest, H-1521, Hungary, dmarx@cs.bme.hu Abstract.

More information

CSC 373: Algorithm Design and Analysis Lecture 3

CSC 373: Algorithm Design and Analysis Lecture 3 CSC 373: Algorithm Design and Analysis Lecture 3 Allan Borodin January 11, 2013 1 / 13 Lecture 3: Outline Write bigger and get better markers A little more on charging arguments Continue examples of greedy

More information

Theoretical Computer Science. Testing Eulerianity and connectivity in directed sparse graphs

Theoretical Computer Science. Testing Eulerianity and connectivity in directed sparse graphs Theoretical Computer Science 412 (2011) 6390 640 Contents lists available at SciVerse ScienceDirect Theoretical Computer Science journal homepage: www.elsevier.com/locate/tcs Testing Eulerianity and connectivity

More information