83
School of Computer Science Scheduling and Load Balancing This thesis was submitted in partial fulfillment of the requirements for the doctor of philosophy degree (Ph.D.) at Tel-Aviv University Submitted by Oded Regev This work was supervised by Prof. Yossi Azar. January 2001

Scheduling and Load Balancing

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Scheduling and Load Balancing

School of Computer Science

Scheduling and

Load Balancing

This thesis was submitted in partial fulfillment of the requirements for the doctor of philosophy degree (Ph.D.) at

Tel-Aviv University

Submitted by Oded Regev

This work was supervised by Prof. Yossi Azar.

January 2001

Page 2: Scheduling and Load Balancing

AcknowledgmentsI am indebted to Yossi Azar, my thesis advisor, without whom this thesis would not exist.His great insights guided me through the nights I spent solving the problems presented inthis thesis. Returning home late, I always found my parents, Gadi and Zehavit, and mybrother, Amit. I thank them and all my family for supporting me and helping me throughthe times when things seemed a little too diÆcult.

1

Page 3: Scheduling and Load Balancing

2

Page 4: Scheduling and Load Balancing

CreditsThe results in this thesis were obtained jointly with my advisor, Yossi Azar. I am gratefulto my co-authors for allowing me to include in this thesis results obtained in joint workwith them. These include the results in Chapter 2 which are a joint work with with Ji�r��Sgall and Gerhard J. Woeginger and appear in [16]. The results in Chapter 3 were obtainedjointly with Leah Epstein and appear as part of [4]. The results in Chapter 4 appear in[7] and were obtained jointly with Baruch Awerbuch and Stefano Leonardi. The results inChapter 5 are joint work with Baruch Awerbuch and appear in [9]. Finally, the results inChapter 6 can be found in [15].

3

Page 5: Scheduling and Load Balancing

4

Page 6: Scheduling and Load Balancing

AbstractIn this thesis, we consider scheduling and load balancing problems. In scheduling problemswe are given a set of jobs to be assigned to free time slots on one of several processors. Inthese problems the time axis is the only axis that exists. In load balancing problems on theother hand, each job arrives with its active time period and we have to choose a machineto which we assign it. So in these problems, in addition to the time axis, there exists a loadaxis which we wish to balance. The goal in both problems can be either to minimize a costfunction or to maximize a bene�t function. Providing optimal solutions for these problemsis usually intractable, hence we are considering approximated solutions for both o�-line andon-line aspects of the problems.A short summary of problems and results in this thesis follows. The �rst two problemsare load balancing problems, the next two are scheduling problems and the last one is arouting problem.Temporary Task Assignment on Identical MachinesWe consider the o�-line temporary task assignment problem. Jobs, in addition to theirweight, have an arrival and a departure time. The goal is to assign the jobs such that themaximum load over both machines and time is minimized. We show that no polynomialtime algorithm can achieve an approximation ratio below 1:5 for this problem. However,for the case where the number of machines is �xed, we present a PTAS.Online Load Balancing with Unrelated MachinesHere we consider on-line load balancing of temporary tasks on unrelated machines. Weprove an inapproximability result for the problem and show that a trivial algorithm almostachieves the best competitive ratio possible. In the special case of the related-restrictedmachines model we show tight results on the competitive ratio for a whole range of speeds.Our results apply to randomized algorithms as well.Multiprocessor Scheduling without MigrationFor the o�-line problem of scheduling jobs in a multiprocessor setting in order to min-imize the ow time, the SRPT algorithm is known to perform within a logarithmic factorof the optimal schedule. This algorithm both preempts jobs and migrates jobs betweenmachines. Unlike preemption, migration is not known to be necessary for achieving these5

Page 7: Scheduling and Load Balancing

6low approximation ratios. We show how one can achieve the same approximation ratiowithout migrating jobs. This result also applies to the on-line setting where the algorithmachieves the best competitive ratio possible.Bene�t Maximization for Online SchedulingIn this on-line scheduling problem jobs arrive over time. Our goal is to maximize thetotal bene�t gained from the scheduling of the jobs. A common model is to give each job itsown deadline and to take into account only jobs completed by their deadline. The relativelyhigh competitive ratios encountered in this model motivate the search for more reasonablemeasures of bene�t. We consider a model where the bene�t gained from a job is a functionof its processing time: the longer a job is delayed the lower the bene�t gained. A constantcompetitive algorithm is shown for this model.The Unsplittable Flow ProblemThe Unsplittable Flow Problem (UFP ) is a routing problem where we are given acapacitated graph and a set of connection requests with individual demands and pro�ts.The objective is to route a subset of the requests in order to maximize the total pro�t ofthe routed requests. The routing must obey edge capacities and use single ow paths. Wepresent algorithms for several variants of the problem. We identify the three main casesof the problem and either improve or match the previously known approximation ratiosfor all three. However, unlike previous algorithms, all of our algorithms are both stronglypolynomial and combinatorial. While the results above apply to the o�-line setting, we alsopresent several results for the on-line setting.

Page 8: Scheduling and Load Balancing

Contents1 Introduction 111.1 Load Balancing Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.2 Scheduling Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.3 Routing Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.4 Quality of Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.5 Organization of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Temporary Task Assignment on Identical Machines 192.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.3 The Polynomial Time Approximation Scheme . . . . . . . . . . . . . . . . . 202.4 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.5 The Unrestricted Number of Machines Case . . . . . . . . . . . . . . . . . . 252.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Online Load Balancing with Unrelated Machines 293.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.2 Inapproximability of the Unrelated Machines Model . . . . . . . . . . . . . 303.3 Tight Results for the Related-Restricted Machines Model . . . . . . . . . . 323.4 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

Page 9: Scheduling and Load Balancing

8 CONTENTS4 Multiprocessor Scheduling without Migration 374.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384.3 The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384.4 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.5 Tightness of the Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 Bene�t Maximization for Online Scheduling 515.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.3 The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525.4 The Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.5 Multiprocessor Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 The Unsplittable Flow Problem 596.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606.3 Algorithms for UFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616.3.1 Algorithm for Classical UFP . . . . . . . . . . . . . . . . . . . . . . 616.3.2 Strongly Polynomial Algorithm . . . . . . . . . . . . . . . . . . . . . 656.3.3 Algorithm for Extended UFP . . . . . . . . . . . . . . . . . . . . . . 666.4 Algorithms for K-bounded UFP . . . . . . . . . . . . . . . . . . . . . . . . 666.4.1 Algorithms for Bounded Demands . . . . . . . . . . . . . . . . . . . 676.4.2 A Combined Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 696.5 Lower Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706.6 Online Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Page 10: Scheduling and Load Balancing

CONTENTS 96.6.1 Online Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726.6.2 Online Lower Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . 736.7 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Page 11: Scheduling and Load Balancing

10 CONTENTS

Page 12: Scheduling and Load Balancing

Chapter 1IntroductionIn this thesis we consider resource allocation problems. In these problems a set of requestshas to be assigned to a set of resources, be it machines, network links, or time periods.The assignment is measured by using a cost function which we try to minimize or by usinga bene�t function which we try to maximize. An exact solution is a desirable result but,despite the deceptive simplicity of the problems, achieving this optimal solution is oftenimpossible, be it due to limited time or incomplete information. We therefore resort toalgorithms whose solution is only an approximation of the optimal solution. Finding suchalgorithms whose solutions are good approximations of the optimal solution is the mainfocus of this thesis.Interest in scheduling and load balancing problems can be traced back to the �fties. Ina paper from 1966, Graham studied some of the �rst algorithms for scheduling problems.The problem considered by Graham is perhaps the simplest of all and since then more andmore important cases have been identi�ed. In this thesis we present some recent results inthis �eld.Most of these problems exist in two avors: the o�-line setting and the on-line setting.In the o�-line setting the whole input is given in advance and the algorithm has to �nd anapproximate solution. In the on-line setting the input is given in small parts, usually onerequest after the other. An on-line algorithm has to handle each request with no knowledgeabout future requests. O�-line algorithms are usually more powerful and are limited only bytheir running time. The main limitation of on-line algorithms, however, is their uncertaintyof future events and not their running time. Nevertheless, the on-line algorithms presentedin this thesis are all polynomial time algorithms. In this thesis we consider both the o�-linesetting and the on-line setting of each problem.For us to be able to compare di�erent approximation algorithms a measure of the qualityof approximation has to be de�ned. This measure is known as the approximation ratiofor o�-line algorithms and the competitive ratio for on-line algorithms. In both cases webasically compare the value of a certain goal function achieved by a given algorithm to thatof an optimal solution. The maximum ratio ever achieved by an algorithm is known as its11

Page 13: Scheduling and Load Balancing

12 CHAPTER 1. INTRODUCTIONcompetitive ratio for on-line algorithms or as its approximation ratio for o�-line algorithms.The two main resource allocation problems found in this thesis are the load balancingproblem and the scheduling problem. Both problems are concerned with allocating jobs toa set of machines. In the load balancing problem each job has an arrival time, a departuretime and a weight and an algorithm should decide to which machine each job is assigned.The load on a machine at a certain time is the sum of weights of jobs assigned to it. A loadbalancing algorithm tries to minimize the cost, de�ned as the maximum machine load. Wealso consider a routing problem, that is, a generalization of a load balancing problem whereinstead of machines, jobs are assigned to paths in a network.In scheduling problems, on the other hand, no notion of load exists since each machinecan process at most one job at a time. Instead, each job has an arrival time and a processingtime and the algorithm has to �nd for each job a time period in which to run it and a freemachine to process it during that time period. The time period should not be beforethe job's arrival time and its length should match the job's processing time. Several goalfunctions exist but the simplest one is perhaps the last completion time of a job.In what follows we describe in more detail several aspects of the problems consideredso far. We begin with describing load balancing problems and scheduling problems. Wecontinue with describing a routing problem in which network load has to be balanced insteadof machine load. The exact de�nition regarding the quality of approximation in both o�-lineand on-line algorithms is then given. The chapter is completed by a summary of the resultsin this thesis.1.1 Load Balancing ProblemsIn the load balancing problem a set of jobs has to be assigned to a set of machines. Eachjob is given with a load vector indicating its weight on each machine, an arrival time anda departure time. Assigning a job to a machine increases that machine's load between thearrival and the departure time by the appropriate coordinate in the load vector. Di�erentgoals exist, but the most common one is minimizing maximum load ever achieved by amachine in an assignment and a low maximum load is usually a good indicator of a uniformand balanced assignment. Notice that online algorithms learn about events as they happenand, in particular, the departure of jobs in known only at their departure time.More formally, we are given a set J of n jobs to be assigned to m machines. Each jobj, 1 � j � n, is associated with a load vector (wj(1); :::; wj(m)), an arrival time aj and adeparture time dj . If job j is assigned to machine i, it increases the load of machine i byits weight on that machine, wj(i) from time aj to time dj . The cost function which we tryminimize is the maximum load, de�ned as maxi;t li;t where li;t = Pj2Ji;aj�t<dj wj(i) is theload on machine i at time t and Ji denotes the set of jobs assigned to machine i. Manypapers considered load balancing problems in the past and especially in the last decade(e.g., [2, 6, 10, 12, 18, 23, 27, 35, 41, 52, 60]).

Page 14: Scheduling and Load Balancing

1.1. LOAD BALANCING PROBLEMS 13The load balancing problem described above is known as load balancing of temporarytasks with unrelated machines. An important special case is the permanent jobs case whereall the jobs have the same departure time. Being a special case of the temporary tasksmodel, it is often easier to approximate.In either the permanent or the temporary tasks case one often examines a more restrictedmachine model in which the load vector has to be of a certain type. In addition to the onedescribed above, three such models exist in all of which the load vector is replaced by a valuewj indicating a job's weight. In the restricted machines model, each job is equipped withan additional set of admissible machines to which its assignment is allowed. Alternatively,this model can be thought of as load vectors which are allowed to contain only two values,in�nity and the job's weight. Another natural model is the related machines model in whicheach machine has its own speed and the load caused by assigning a job to a machine is thejob's weight divided by the machine's speed. The oldest and simplest of all models is theidentical machines model in which assigning a job to a machine increases its load by thejob's weight. This model is a special case of all the previous machine models considered.We begin a survey of results for the on-line model with the model of permanent identicalmachines which was one of the �rst to be considered. Graham presented in [36] an on-linealgorithm called \List Scheduling" that achieves a competitive ratio of 2� 1m , wherem is thenumber of machines. For cases of only two or three machines, this algorithm turns out tobe optimal [29]. Improved algorithms for the general case appeared in [2, 26, 32, 18] and thecurrent best upper bound is around 1.92 [30]. A series of lower bounds appeared [2, 19, 29]with the best lower bound being around 1.853 [34]. A constant competitive ratio is alsoachievable for the related machines model [5, 23]. For the restricted machines model theexact competitive ratio is �(logm), both for deterministic and randomized algorithms [14].A deterministic algorithm for the unrelated machines model exists with the same O(logm)competitive ratio [5] and is therefore tight.For load balancing of temporary tasks on identical machines, Graham's algorithm turnsout to be optimal [12]. A constant competitive algorithm exists for the related machinescase with temporary tasks as well [13]. The competitive ratio in the restricted temporarytasks is �(pm) [11, 53]. The last model left to consider is the load balancing of temporarytasks on unrelated machines. This is the only online load balancing model whose asymptoticcompetitive ratio was not known. In this thesis we present a lower bound of (m= logm)that almost matches an O(m) upper bound. This essentially settles an open problempresented in [24].In the o�-line setting, load balancing of permanent tasks was shown to have a polynomialtime approximation scheme (that is, a polynomial time (1 + �)-approximation algorithmfor any �xed � > 0) for any �xed number of machines in [57]. This was later improvedto an arbitrary number of machines by Hochbaum and Shmoys [39]. For load balancingof permanent jobs on unrelated machines, Lenstra et al. [50] showed a polynomial timeapproximation scheme for a �xed number of machines. On the other hand, they showedthat if the number of machines is part of the input then no algorithm with an approximationratio better than 32 can exist unless P = NP .

Page 15: Scheduling and Load Balancing

14 CHAPTER 1. INTRODUCTIONFor o�-line load balancing of temporary tasks, the \List Scheduling" algorithm was thebest algorithm known. In this thesis we present a polynomial time approximation schemefor the case in which the number of machines is �xed. For the case in which the numberof machines is given as part of the input, we show that no algorithm can achieve a betterapproximation ratio than 32 unless P = NP . A recent result considers the case of temporarytasks with unrelated machines [3]. That paper presents a polynomial time approximationscheme for a constant number of machines and a lower bound of 2 for the general case.1.2 Scheduling ProblemsThe second problem we consider is the scheduling problem. Here, each job has an arrivaltime and a processing time and should be assigned to one of the machines. Only one jobcan be assigned to a machine at any given time but jobs can be postponed and started aftertheir arrival time. Scheduling problems are considered in the uniprocessor case where thereis only one machine or in the multiprocessor case where more than one machine exists. Theuniprocessor case turns out to be an important case in many scheduling problems. In loadbalancing on the other hand, problems become interesting only when two or more machinesare involved. On-line algorithms learn about a job and its processing time only at its arrivaltime. An on-line algorithm has no information about a job before its arrival time. For asurvey of on-line scheduling see [58].Since a machine is fully occupied with processing just one job we may allow jobs to bepreempted. Without preemption, an algorithm has to schedule jobs by using a continuoustime period on a single machine. With preemption, an algorithm might stop processinga job and continue later from where it stopped. We say that an algorithm does not usemigration when preempted jobs run on the same machine on which their processing began.Thus, the use of preemption is allowed but is limited to a single machine. This property isregarded as an important one since migrating a job between machines in a multiprocessorsetting is often far from trivial and results in a considerable overhead.Schedules are measured by one of several di�erent ways. A schedule might be measuredby the last completion time or the average completion time. These two measures receivedconsiderable attention in the past. Both give a rough measure of the quality of the scheduleas a whole but do not represent the quality of service as seen by the individual jobs. Abetter way to measure the quality of a schedule is to consider the average ow time. The ow time of a job is de�ned as the di�erence between its completion time and its arrivaltime. The average ow is a better measure since it depends on the arrival times as well asthe completion times. It is also one of the most diÆcult to approximate. A di�erent modelbased on ow times is that of maximizing the bene�t given by jobs. Here, each job has abene�t function that depends on its ow time. The longer its processing takes, the lowerits bene�t is. In this thesis we consider both the minimization and the maximization owproblems described above. One important di�erence to notice between the two models isthat in the maximization problem the e�ect of a job with an exceedingly long ow timeis usually just a slight decrease in the total bene�t. In the minimization problem, on the

Page 16: Scheduling and Load Balancing

1.2. SCHEDULING PROBLEMS 15other hand, the long ow time greatly increases the average ow time.In the non-preemptive case it is impossible to achieve any \reasonable" approximationfor the average ow time. Speci�cally, even in the uniprocessor case one cannot achievean approximation ratio of O(n 12��) unless NP = P where n is the number of jobs [43].For the multiprocessor case it is impossible to achieve O(n 13��) approximation ratio unlessNP = P [51]. Thus, preemptions really seem to be essential. Minimizing the ow time onone machine with preemption can be done optimally in polynomial time using the naturalalgorithm shortest remaining processing time (SRPT) [17]. For more than one machine,the preemptive problem becomes NP -hard [28]. Leonardi and Raz [51] showed that SRPTachieves a logarithmic approximation ratio for the multiprocessor case by proving a tightbound of O(log(minfn=m;Pg)) on m > 1 machines with n jobs, where P denotes theratio between the processing time of the longest and the shortest jobs. In this thesis, wepresent an alternative algorithm whose approximation ratio is almost identical to that ofSRPT but, unlike SRPT , does not use migration. While these algorithms are the besto�-line algorithms known, in the on-line setting they are actually optimal, that is, theircompetitive ratio cannot be improved.For the easier cost model of minimizing the average completion time, on-line algorithmswith constant competitive ratios exist, e.g. [38]. By using o�-line algorithms, one can achievea PTAS [1]. The cost model of minimizing the total completion time is equivalent sincethe ratio between the two is constant for any given instance. These models will not beaddressed in this thesis. Instead, we will consider the ow time model that better capturesthe quality of a schedule.The prominent bene�t model considered before this thesis was the �rm deadline model.In this model each job has its own constant bene�t and its own threshold. The bene�tfunction is this constant for ow times of at most the threshold and zero otherwise. Theoptimal on-line deterministic competitive ratio for the uniprocessor case is �(�), where� is the ratio between the maximum and minimum bene�t density, de�ned as the bene�tdivided by the processing time [20, 21, 48]. For the special case where � = 1, there is a4-competitive algorithm. The optimal randomized competitive ratio for the uniprocessorcase is O(log(minf�;�g)), where � is the ratio between the processing time of the longestand the shortest job [40]. For the multiprocessor case, Koren and Shasha [49] showed thatwhen the number of machines is very large, a O(log �) competitive algorithm is possible.That result is shown to be optimal and moreover, their algorithm does not use migration.It can be seen that as a result of the �rm deadline, this real-time scheduling model ishard to approximate. Moreover, in many real cases, jobs that are delayed by some smallconstant should reduce our estimate of the overall system performance, but only by somesmall factor. In the �rm deadline model, jobs that are delayed beyond their deadline ceaseto contribute to the total bene�t. Thus, the property we are looking for is the possibilityof delaying jobs without drastically harming the overall system performance. In this thesiswe study the e�ects of di�erent bene�t functions on the competitive ratio.A scheduling problem is formally described as a sequence of n jobs to be assigned toone or more machines. Each job j has a release time rj and a processing time wj . The

Page 17: Scheduling and Load Balancing

16 CHAPTER 1. INTRODUCTIONon-line scheduler learns about a job only at its release time. The o�-line scheduler knowsthe whole sequence of jobs in advance. Both schedulers may schedule the job at any timeafter its release time. The system allows preemption, that is, the scheduler may stop a joband later continue running it. Migration however, is not allowed and a preempted job mustlater continue running on the same machine. Note that a machine can process only one jobat a given time. If job j is completed at time cj then we de�ne its ow time as fj = cj � rj(which is at least wj).1.3 Routing ProblemsClosely related to load balancing problems is the routing problem where an algorithm triesto balance the load on network links instead of machines. In this problem, known as UFPor unsplittable ow problem, each network link, or edge in the network graph, has a limitedcapacity that limits the amount of load that can be routed through it. The requests aregiven as source-sink pairs and each request has its own bene�t and demand. Requests shouldbe routed through the network using a single ow path such that the total demand routedthrough an edge is at most its capacity. Since routing all requests is usually impossible, wetry to maximize the total bene�t from routed requests.In this thesis we consider the three variants of the UFP problem. Classical UFP isthe case where demands are lower than the minimum edge capacity. The extended UFPcase is when some demands might be higher than some edge capacities and represents themost general UFP model. A more restricted case than the classical case is that of boundedUFP (or K-bounded UFP ) where demands are at most 1K of the minimum edge capacity.The well-known problem of maximum edge disjoint path, denoted EDP , is the specialcase where all demands, pro�ts and capacities are equal to 1 and is one of the �rst to beconsidered (see [37]).The EDP (and hence the UFP ) is one of Karp's original NP-complete problems [42].An O(pm) approximation algorithm is known for EDP [44] where m denotes the numberof edges in the network graph (for additional positive results see [55, 56]). Most of theresults for UFP deal with the classical case where the maximal demand is at most theminimal capacity. The most popular approach seems to be LP rounding [22, 47, 59] withthe best approximation ratio being O(pm) [22]. A matching lower bound of (m1=2��) forany �xed � > 0 is shown in [37] for directed graphs. In this thesis we provide a stronglypolynomial O(pm) approximation algorithm.Due to the complexity of the extended UFP , not many results addressed it. The �rstto attack the problem is a recent attempt by Guruswami et al. [37]. We improve in thisthesis the previous upper bound and, more importantly, show an almost matching hardnessresult. This hardness result separates the extended UFP and the classical UFP .We now consider the bounded UFP case where the maximum demand is at most 1Kthe minimum edge capacity (denoted K-bounded UFP ). It is a special case of classical

Page 18: Scheduling and Load Balancing

1.4. QUALITY OF APPROXIMATION 17UFP but better approximation ratios can be achieved. As a special case, it contains thehalf-disjoint paths problem where all the demands and pro�ts are equal to 12 and edgecapacities are all 1 [45]. For K � logn, where n denotes the number of requests, a constantapproximation is shown in [54] by using randomized rounding. For K < logn, previousalgorithms achieved an approximation ratio of O(Kn 1K�1 ) ([22, 59] by using LP roundingand [25, 46] based on [8]). In this thesis we achieve a better approximation ratio by showinga strongly polynomial time approximation algorithm with approximation ratio O(K �n1=K).1.4 Quality of ApproximationSince most of the algorithms we present in this thesis are approximation algorithms somenotion of the quality of an approximation has to be de�ned. Let COPT (I) denote the costof an optimal solution for the instance I and CA(I) denote the cost of the approximatesolution given by an algorithm A for I. The exact cost function depends on the problemconsidered. The following ratio is known as the approximation ratio of an o�-line algorithmA or as the competitive ratio of an on-line algorithm A:maxI CA(I)COPT (I) :For maximization problem, we denote by BOPT (I) the bene�t of an optimal solution andby BA(I) the bene�t of an approximation algorithm A. The de�nitions of approximationratio and competitive ratio are then de�ned asmaxI BOPT (I)BA(I) :We should also note that one often encounters a slightly di�erent de�nition where an extraadditive constant is taken into account. That is however unneeded since all the problemsconsidered in this thesis have arbitrary units and are scalable. When we consider randomizedalgorithms, the cost (or bene�t) of an algorithm is taken as its expected cost (or expectedbene�t).Approximation ratios of o�-line algorithms might be polynomial, logarithmic or evenconstant. As it turns out, for some o�-line problems, achieving approximation ratios ar-bitrarily close to 1 is possible. Then we say that we have a PTAS, or a polynomial timeapproximation scheme, a scheme that provides 1+� approximation algorithms for any � > 0.When the running time of the algorithm is polynomial in both the input size and 1=� wesay that the scheme is an FPTAS, or a fully polynomial time approximation scheme.1.5 Organization of the ThesisIn the following two chapters, we consider two load balancing problems. In Chapter 2 weconsider the o�-line temporary task assignment problem. In this model, jobs both arrive

Page 19: Scheduling and Load Balancing

18 CHAPTER 1. INTRODUCTIONand depart. The goal is to assign the jobs such that the maximum load over both machinesand time is minimized. We show that no algorithm can achieve an approximation ratiobelow 1:5 for this problem. However, for the case where the number of machines is �xed,we present a PTAS. These results appear in [16].In Chapter 3 we consider on-line load balancing of temporary tasks on unrelated ma-chines. We prove an inapproximability result for the problem and show that a trivialalgorithm is almost optimal. In the special case of related-restricted machines model weshow tight results on the competitive ratio for a whole range of speeds. We apply our resultsto randomized algorithms as well. The above results appear as part of [4].In the next two chapters we address preemptive scheduling problems. In Chapter 4,the o�-line problem of scheduling jobs in a multiprocessor setting in order to minimize theaverage ow time is considered. The only algorithm known for this problem, the SRPTalgorithm, is known to perform within a logarithmic factor of the optimal schedule. Thisalgorithm both preempts jobs and migrates jobs between machines. Our algorithm, withits O(minflog P; logng) approximation ratio, is almost as good as the SRPT algorithm butdoes not use migration. Our result also applies to the on-line setting where the algorithmachieves the best competitive ratio possible. The results in this chapter appear in [7].In Chapter 5 we consider an on-line bene�t model where the goal is to maximize thetotal bene�t gained from jobs. A common model is to give each job its own deadline andto take into account only jobs completed by their deadline. In Section 1.2 we have seenthat in this model, competitive ratios are relatively high. This motivated us to consider amodel where the bene�t gained from a job is a function of its processing time: the longera job is processed the lower the bene�t gained. A constant competitive algorithm is shownfor this model, both for the uniprocessor and the multiprocessor setting. The results in thischapter can also be found in [9].The last chapter deals with the Unsplittable Flow Problem (UFP ). We identify the threemain cases of the problem and either improve or match the previously known approximationratios for all three. However, unlike previous algorithms, all our algorithms are both stronglypolynomial and combinatorial. Speci�cally, for the classical UFP , we provide a stronglypolynomial O(pm) approximation algorithm. For the hardest of all three variants, theextended UFP , we improve the previous upper bound and, more importantly, we show analmost matching hardness result. This hardness result separates the extended UFP andthe classical UFP . For the bounded UFP we improve previous algorithms and show anO(K �n1=K) approximation algorithm. While the results above apply to the o�-line setting,we also present several results for the on-line setting. The results in this chapter appearin [15].

Page 20: Scheduling and Load Balancing

Chapter 2Temporary Task Assignment onIdentical Machines2.1 IntroductionIn this chapter we consider the o�-line problem of load balancing of temporary tasks on midentical machines. Recall that in this model each job has an arrival time, departure timeand some weight. Each job should be assigned to one machine. The load on a machine ata certain time is the sum of the weights of jobs assigned to it at that time. The goal is tominimize the maximum load over machines and time.This load balancing problem naturally arises in many applications involving allocation ofresources. As a simple concrete example, consider the case where each machine representsa communication channel with bounded bandwidth. The problem is to assign a set ofrequests for bandwidth, each with a speci�c time interval, to the channels. The utilizationof a channel at a speci�c time t is the total bandwidth of the requests, whose time intervalcontains t, which are assigned to this channel.In this chapter we show that when the number of machines is �xed a PTAS exists.However, for the case in which the number of machines is given as part of the input, weshow that no algorithm can achieve a better approximation ratio than 32 unless P = NP .Graham's algorithm is the best approximation algorithm for this case with an approximationratio of 2 � 1m . Also, recall that the on-line problem is already solved, since Graham'salgorithm is optimal [12].Note that similar phenomena occur at other scheduling problems. For example, in theintroduction of this thesis, we considered the load balancing problem on unrelated machines.For a �xed number of machines Lenstra et al. [50] showed a PTAS and if the number ofmachines is part of the input they showed that no algorithm with an approximation ratiobetter than 32 can exist unless P = NP . 19

Page 21: Scheduling and Load Balancing

20 CHAPTER 2. TEMPORARY TASK ASSIGNMENT ON IDENTICAL MACHINESOur algorithm works in four phases: the rounding phase, the combining phase, thesolving phase and the converting phase. The rounding phase actually consists of two sub-phases. In the �rst subphase the jobs' active time is extended: some jobs arrive earlier,others depart later. In the second subphase, the active time is again extended but eachjob is extended in the opposite direction to which it was extended in the �rst subphase.In the combining phase, we combine several jobs with the same arrival and departure timeand unite them into jobs with higher weights. Solving the resulting assignment problem inthe solving phase is easier and its solution can be converted into a solution for the originalproblem in the converting phase.The novelty of our algorithm is in the rounding phase. Standard rounding techniquesare usually performed on the weights. If one applies similar techniques to the time theresulting algorithm's running time is not polynomial. Thus, we designed a new roundingtechnique in order to overcome this problem.2.2 PreliminariesIn this chapter, we denote by � = �1; :::; �2n the sequence of events where each event is anarrival or a departure of a job. Without loss of generality, we assume that at each time onlyone job arrives or departs. Therefore, we can view � as a sequence of distinct times, thetime �i is the moment after the ith event happened. In addition, �0 denotes the momentat the beginning, before the arrival of any job. We denote the arrival time of job j by ajand its departure time by dj . We say that a job is active at time � if aj � � < dj . LetQi = fj j aj � �i < djg be the active jobs at time �i. For a given algorithm A let Aj bethe machine on which job j is assigned. LetlAk (i) = XfjjAj=k;j2Qigwjbe the load on machine k at time �i, which is the sum of weights of all jobs assigned to kand active at this time. The cost of an algorithm A is the maximum load ever achieved byany of the machines, i.e., CA = maxi;klAk (i).2.3 The Polynomial Time Approximation SchemeAssume without loss of generality that the optimal maximum load is in the range (1; 2].That is possible since Graham's algorithm can approximate the optimal solution up to afactor of 2, and thus, we can scale all the jobs' weights by 2=l where l denotes the value ofGraham's solution. This does not increase the running time of the scheme, since Graham'salgorithm runs in linear time (for �xed m).Let � > 0 be a constant, depending on the required precision (we will determine itlater). We �x three constants, � = �=dlog ne, � = ��=m = �2=(mdlog ne), and = ��=m =�3=(m2dlog ne).

Page 22: Scheduling and Load Balancing

2.3. THE POLYNOMIAL TIME APPROXIMATION SCHEME 21c1J1 c2J2 c3J3c4J4 c5J5 c6J6 c7J7::: ::: ::: :::dlogne8>>>>>>>><>>>>>>>>: Figure 2.1: Partitioning J �R into fJigIn order to describe the rounding phase with its two subphases we begin with de�ningthe partitions based on which the rounding will be performed. The set R contains all jobswith weight at least . We begin by de�ning a partition fJig of the set of jobs J �R. Weset M1 = J � R and de�ne sets Ji and Mi iteratively as follows. Let Mi be a set of jobsand consider the sequence of times � in which jobs of Mi arrive and depart. The number ofsuch times is 2r for some r, let ci be any time between the r-th and the r+1-st elements inthat set. The set Ji contains the jobs inMi that are active at time ci. The set M2i containsthe jobs in Mi that depart before or at ci and the set M2i+1 contains the jobs in Mi thatarrive after ci. We stop when all unexpanded Mi's are empty. The important property ofthat partition is that the set of jobs that are active at any particular time is partitionedinto at most dlog ne di�erent sets Ji.

S1i T 1i�:::� + � S2i T 2i�:::� + �s1i t1is2i t2ici::::::

Figure 2.2: Partitioning Ji into fSji ; T ji gWe continue by further partitioning the set Ji. We order the jobs according to theirarrival time. We denote the smallest pre�x of the jobs whose total weight is at least � byS1i . We order the same set of jobs according to their departure time. We take the smallestsuÆx whose weight is at least � and denote that set by T 1i . Note that there might be jobsthat are both in S1i and T 1i . We remove the jobs in S1i [ T 1i from Ji, repeat the processwith the jobs left in Ji and similarly de�ne S2i , T 2i , . . . , Skii ; T kii . Each set Si and Ti hastotal weight between � and � + , except for the last pair which may have smaller weightthan �. However, if the last pair has smaller weight than � then it satis�es Skii = T kii . Wedenote by sji the arrival time of the �rst job in Sji and by tji the departure time of the lastjob in T ji . Note that s1i � s2i � ::: � skii � ci � tkii � ::: � t2i � t1i .The �rst subphase of the rounding phase creates a new set of jobs J 0 which contains thesame jobs as in J with slightly longer active times. We change the arrival time of all thejobs in Sji for j = 1; :::; ki to sji . Also, we change the departure time of all the jobs in T ji to

Page 23: Scheduling and Load Balancing

22 CHAPTER 2. TEMPORARY TASK ASSIGNMENT ON IDENTICAL MACHINEStji . The jobs in R are left unchanged. We denote the sets resulting from the �rst subphaseby J 0, J 0i , S0ji , T 0ji .S01i T 01i�:::� + � S02i T 02i�:::� + �s1i t1is2i t2ici

::::::Figure 2.3: The set J 0i (after the �rst subphase)The second subphase of the rounding phase further extends the active time of the jobsresulting from the �rst subphase. We take one of the sets J 0i and the partition to S01i [ T 01i ,S02i [ T 02i , . . . , S0kii [ T 0kii we de�ned earlier. For every j � ki, we order the jobs in S0jiaccording to an increasing order of departure times. We take the smallest pre�x of thisordering whose total weight is at least �. We extend the departure time of all the jobs inthat pre�x to the departure time of the last job in that pre�x. The process is repeated untilthere are no more jobs in S0ji . The last pre�x may have a weight of less than �. Similarly,extend the arrival times of jobs in T 0ji . Note that if the weight of the last pair is smallerthan � then Skii = T kii and these jobs are left unchanged since they already have identicalarrival and departure times from the �rst phase. We denote the sets resulting from thesecond subphase by J 00, J 00i , S00ji , T 00ji .S001i T 001i�:::� + � S002i T 002i�:::� + �s1i t1is2i t2ici

::::::Figure 2.4: The set J 00i (after the rounding phase)The combining phase of the algorithm involves the weight of the jobs. Let J 00st be theset of jobs in J 00 that arrive at s and depart at t. Assume the total weight of jobs whoseweight is at most in J 00st is x. The combining phase replaces these jobs by dx= e jobs ofweight . We denote the resulting sets by J 000st . The set J 000 is created by replacing every J 00stwith its corresponding J 000st , that is, J 000 = Ss;t J 000st .The solving phase of the algorithm solves the modi�ed decision problem of J 000 by build-ing a layered graph. Note that J 000 contains both the modi�ed jobs from J � R and theoriginal jobs from R. Every time �i, i = 0; : : : ; 2n, in which jobs arrive or depart (includingthe initial state with no job) has its own set of vertices called a layer. Each layer holds avertex for every possible assignment of the current active jobs to machines; furthermore,we label each node by the maximum load of a machine in that con�guration. The �rst and

Page 24: Scheduling and Load Balancing

2.4. ANALYSIS 23last layers contain a single vertex, as there are no jobs at that point. These vertices arecalled a source and a sink.Two vertices of adjacent layers �i�1 and �i, i = 1; : : : ; 2n, are connected by an edge ifthe transition from one assignment of the active jobs to the other is consistent with thearrival and departure of jobs at time �i. More precisely, the vertices are connected if andonly if every job active both before and after �i is assigned to the same machine in theassignments of both vertices. At each event, jobs either arrive or depart but not both (dueto the assumption at the beginning that all the original events are distinct; during roundingwe do not mix arrival and departure events). If �i is an arrival, the indegree of all verticesin the layer �i is 1, since the new con�guration determines the old one. Similarly if �i is adeparture, the outdegree of all vertices in the layer �i�1 is 1. In both cases, the number ofedges between two layers is linear in the number of vertices on these layers. It follows thatthe total number of edges is linear in the number of vertices.We de�ne a value of a path from the source to sink as the maximal value of its nodes.Now we can simply �nd a path with smallest value by any shortest path algorithm in lineartime (since the graph is layered).In the converting phase the algorithm converts the assignment found for J 000 into anassignment for J . Assume the number of jobs of weight in J 000st that are assigned to acertain machine i is ri. Remove these jobs and assign all the jobs smaller than in J 00st suchthat a total weight of at most (ri+1) is assigned to each machine. This is possible since thereplacement involves jobs whose weight is at most and from volume consideration thereis always at least one machine with a load of at most ri of these jobs. The assignment forJ 00 is also an assignment for J 0 and J .2.4 AnalysisLemma 2.4.1 Given a solution for the original problem J whose maximum load is �, thesame solution applied to J 0 has a maximum load of at most � + � + �3=4. Also, given asolution for J 0 whose maximum load is �, the same solution applied to J has a maximumload of at most �.Proof: The second claim is obvious since the jobs in J are shorter than the correspondingjobs in J 0. As for the �rst claim, every time � is contained in at most dlog ne sets Ji.Consider the added load at � from jobs in a certain set Ji. If � < s1i or � � t1i then thesame load is caused by J 0i and Ji. Assume � < ci and de�ne ski+1i = ci, the other case issymmetrical. Then for some j, sji � � < sj+1i and the added load at � is at most the totalload of Sji which is at most � + . Summing on all sets Ji, we conclude that the maximalload has increased by at most (�+ )dlog ne = �+ �3=m2.Lemma 2.4.2 Given a solution for J 0 whose maximum load is �, the same solution applied

Page 25: Scheduling and Load Balancing

24 CHAPTER 2. TEMPORARY TASK ASSIGNMENT ON IDENTICAL MACHINESto J 00 has a maximum load of at most �(1+�). Also, given a solution for J 00 whose maximumload is �, the same solution applied to J 0 has a maximum load of at most �.Proof: The second claim is obvious since the jobs in J 0 are shorter than the correspondingjobs in J 00. As for the �rst claim, given a time � and a pair of sets S0ji , T 0ji from J 0i weexamine the increase in load at � . If � < sji or � � tji the load is not a�ected by thetransformation because no job in T 0ji [ S0ji arrives before sji or departs after tji . Assumethat � < ci, the other case is symmetrical. So � is a�ected by the decrease in arrival timeof jobs in T 0ji . It is clear that the way we extend the jobs in T 0ji increases the load at � byat most �. Also, since � � sji , we know that the load caused by S0ji is at least � if j < ki.Thus, an extra load of at most � is created by every pair S0ji , T 0ji for 1 � j < ki only if thepair contributes at least � to the load. If the last pair Skii , T kii has weight smaller than �,it does not contribute, as it is not changed from J 0 to J 00; otherwise the analysis is the sameas for j < ki. Since the total load on all machines at any time is at most �m, the increasein load of any machine and therefore in maximum load is at most � � �m=� = ��.Lemma 2.4.3 Given a solution for J 00 whose maximum load is �, the modi�ed problem J 000has a solution with a maximum load of �(1 + �+ �2). Also, given a solution for J 000 whosemaximum load is �, the solution given by the converting phase for the problem J 00 has amaximum load of at most �(1 + �+ �2).Proof: Consider a solution for J 00 whose maximum load is �. If the load of jobs smaller than in a certain J 00st on a certain machine i is x, we replace it by at most dx= e jobs of weight so that this is an assignment to J 000. The increase in load on every machine is at most times the number of sets J 00st that contain jobs which are assigned to that machine. Asfor the other direction, consider a solution whose maximum load is � to J 000. The increasein load on every machine by the replacement described in the algorithm is also at most times the number of sets J 00st that contain jobs which are assigned to that machine.It remains to estimate the number of sets J 00st that can coexist at a certain time. Mostof these sets have weight at least �; their number is at most �m=�, since the total load atany time is at most �m. For each set Sji and T ji , j < ki, we have at most one set J 00st withweight less than �, since the weight of Sji and T ji is at least �, there are at most �m=� suchsets (if Sji and T ji are not disjoint, the small sets J 00st in both of them have the same s andt, thus we do not need to multiply by 2). Last, there may be one set J 00st smaller than �in each Skii = T kii ; there are only dlog ne of such sets. Therefore, the increase in maximumload is at most (�m=� + �m=�+ dlog ne) = ��+ �2�=m+ �3=m2 � �(�+ �2).Theorem 2.4.1 The algorithm described in the last section is a PTAS running in timeO(nc��3m3 logm), where c is some absolute constant.Proof: We are given some �0 > 0 and want to �nd a solution with maximum load at most�(1 + �0). If �0 � 1, we use Graham's List Scheduling. Otherwise we use the algorithm

Page 26: Scheduling and Load Balancing

2.5. THE UNRESTRICTED NUMBER OF MACHINES CASE 25described above for � = �0=6. For an instance with optimal solution with maximum load �,the algorithm yields a solution with maximum load at most �(1+�+�3=4)(1+�)(1+�+�2)2 <�(1 + �0).Every layer in the graph stores all the possible assignments of jobs to machines. Sincethe smallest job is of weight , the maximum number of active jobs at a certain timeis �m= . So, the maximum number of edges in the graph and the running time of thealgorithm is O(nm�m= ) � O(nm2��3m3dlog ne) = O(n1+2��3m3 logm). This yields the result,with the constant c bounded by c < 2 � 63 + 1 = 433.2.5 The Unrestricted Number of Machines CaseIn this section we show that in case the number of machines is given as part of the input,the problem cannot be approximated up to a factor of 4=3 in polynomial time unless P =NP . Then we continue with improving this result by showing that the problem cannot beapproximated better than 3=2.Theorem 2.5.1 For every � < 43 , there does not exist a polynomial �-approximation algo-rithm for the temporary tasks assignment problem unless P = NP .Proof: We show a reduction from the exact cover by 3-sets (X3C) which is known to be NP-complete [33, 42]. In that problem, we are given a set of 3n elements, A = fa1; a2; :::; a3ng,and a family F = fT1; :::; Tmg of m triples, F � A �A �A. Our goal is to �nd a covering inF , i.e. a subfamily F 0 for which jF 0j = n and [Ti2F 0Ti = A.Given an instance for the X3C problem we construct an instance for our problem. Thenumber of machines is m, the number of triples in the original problem. There are threephases in time. First, there are times 1; :::;m, each corresponding to one triple. Then,times m+ 1; :::;m + 3n each corresponding to an element of A. And �nally, the two timesm+ 3n+ 1;m+ 3n+ 2.There are four types of jobs. The �rst type are m jobs of weight 3 starting at time 0.Job r, 1 � r � m ends at time r. To any appearance of aj in a triple Ti corresponds ajob of the second type of weight 1 that starts at i and ends at m + j and another job ofthe third type of weight 1 that starts at time m+ j. Among all the jobs that start at timem+ j, one ends at m + 3n + 2 while the rest end at m + 3n + 1. The fourth type of jobsare m� n jobs of weight 3 that start at m+ 3n+ 1 and end at m+ 3n+ 2.We show that there is an assignment with maximum load at most 3 if and only if thereis an exact cover by 3-sets. Suppose there is a cover. We assign a job of the �rst type thatends at time i to machine i. We assign the three jobs of the second type corresponding toTi to machine i. At time m + j, some jobs of type two depart and the same number ofjobs of type three arrives. One of these jobs is longer than the others since it ends at timem + 3n + 2. We assign that longer job to machine i where Ti is the triple in the covering

Page 27: Scheduling and Load Balancing

26 CHAPTER 2. TEMPORARY TASK ASSIGNMENT ON IDENTICAL MACHINES0 1 2 3 4 5 6 7 8 9 10 11 12(a1) (a2) (a3) (a4) (a5) (a6)

Type I Type II Type III Type IVType I Type II Type III Type IV0123012301230123load 432

1 machineFigure 2.5: An assignment for the problem corresponding to m = 4, n = 2, F =f(1; 2; 3); (1; 4; 5); (4; 5; 6); (2; 3; 4)gthat contains j. At time m+3n+1 many jobs depart. We are left with 3n jobs, three jobson each of the n machines corresponding to the 3-sets chosen in the cover. Therefore, wecan assign the m� n jobs of the fourth type on the remaining machines.Now, assume that there is an assignment whose maximum load is at most 3. Oneimportant property of our assignment problem is that at any time � , 0 � � < m + 3n+ 2the total load remains at 3m so the load on each machine has to be 3. We look at theassignment at time m + 3n + 1. Many jobs of type three depart and only the long onesstay. The number of these jobs is 3n and their weight is 1. Since m � n jobs of weight 3arrive at time m+3n+1, the 3n jobs must be assigned to n machines. We take the triplescorresponding to the n machines to be our covering. Assume by contradiction that this isnot a covering. Therefore, there are two 3-sets that contain the same element, say aj. Attime m + j only one long job arrives. The machine to which a shorter job was assignedremains with a load of 3 until time m+ 3n+ 1 and then the short job departs and its loaddecreases to at most 2. This is a contradiction since at time m+3n+1 there are n machineseach with 3 long jobs.We improve the above result in the following theorem:Theorem 2.5.2 For every � < 32 , there does not exist a polynomial time �-approximationalgorithm for the temporary tasks assignment problem unless P = NP .Proof: The proof is by reduction from edge-coloring of cubic graphs (cubic means that allvertices have degree three): A feasible edge 3-coloring of a simple cubic graph G = (V;E)is a coloring of E with the colors 1, 2 and 3, such that for every vertex the incident edgesreceive three distinct colors. Deciding whether a given cubic graph G = (V;E) possesses afeasible edge 3-coloring is NP-complete [33]. Since G is cubic, jV j = 2q and jEj = 3q holdsfor some positive integer q. Moreover, since in a feasible edge 3-coloring of G every colorclass forms a perfect matching, every color will occur exactly q times.

Page 28: Scheduling and Load Balancing

2.5. THE UNRESTRICTED NUMBER OF MACHINES CASE 27v1v2v3 v4e1e2 e3e4 e5 e6 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14v1 v2 v3 v4e1 e2 e3 e4 e5 e6

Type I Type II Type III Type IVType I Type II Type III Type IV012012012012012012load 654

321 machineFigure 2.6: A 3-colorable cubic graph and the corresponding assignmentGiven a graph G we describe an instance of the load balancing problem. Let e1; : : : ; e3qbe an arbitrary enumeration of the edges in E, and let v1; : : : ; v2q be an arbitrary enumer-ation of the vertices in V . We construct an instance of the temporary task assignmentproblem with m = 3q machines and n = 18q jobs.� For every edge ei (i = 1; : : : ; 3q), there is a corresponding job of weight 2 starting attime 0 and ending at time i.� Let vj (j = 1; : : : ; 2q) be a vertex, and let ex, ey and ez be the three edges incidentto vj . Then there are six jobs Jj;x, Jj;y, Jj;z and Kj;1, Kj;2, Kj;3 that correspond tovj and that all have weight 1. The jobs Jj;x, Jj;y, Jj;z start at times x, y, and z,respectively, and all end at time 3q+ j. The jobs Kj;1, Kj;2, Kj;3 start at time 3q+ jand end at times 5q + 1, 5q + 2, and 5q + 3, respectively.� Finally, there are 3q dummy jobs that all have weight 2. The dummy jobs are dividedinto three classes of q jobs. The q dummy jobs in class c (c = 1; 2; 3) start at time5q + c and end at time 5q + 4.This completes the description of the assignment instance. We claim that this assignmentinstance possesses an assignment with maximum load 2 if and only if the graph G possessesa feasible edge 3-coloring.Proof of the \if" part. Suppose that the graph G possesses a feasible edge 3-coloring.Let ei = [vj; vk] be an edge in E that receives color c 2 f1; 2; 3g in this coloring. Thefollowing jobs are processed on machine i: From time 0 to time i, process the job thatcorresponds to edge ei. From time i to time 3q + j process job Jj;i, and from time 3q + jto time 5q + c, process job Kj;c. Analogously, from time i to time 3q + k process job Jk;i,and from time 3q + k to time 5q + c, process job Kk;c. Finally, from time 5q + c to time5q + 4 process a dummy job from class c. It is easy to see that in this assignment all jobsare processed, and at any moment in time every machine has load at most 2.

Page 29: Scheduling and Load Balancing

28 CHAPTER 2. TEMPORARY TASK ASSIGNMENT ON IDENTICAL MACHINESProof of the \only if" part. Now assume that there is an assignment with maximumload 2. Note that at any moment � in time, 0 � � � 5q + 4, the total available load isexactly 6q = 2m. Hence, in an assignment with maximum load 2 every machine must beconstantly busy. Without loss of generality we assume that for 1 � i � 3q, machine iprocesses the job corresponding to edge ei. Moreover, at time 5q + 4 machine i completesone of the dummy jobs. We color edge ei by the class c of this dummy job.We claim that in the resulting coloring, every vertex is incident to three di�erentlycolored edges: Suppose otherwise. Then there exist two edges ex = [vj ; vk] and ey = [vj ; v`]that receive the same color c. Consider machine x at time x in the assignment. The jobcorresponding to ex ends at time x, and the only available jobs are Jj;x and Jk;x. Sincemachine x is busy all the time, it must process these two jobs. Consider machine x at time3q + j in the assignment. The processing of job Jj;x ends, and the machine must processsome job from time 3q+j to time 5q+c; the only possible job for this is job Kj;c. By similararguments we get that job Kj;c is simultaneously processed on machine y, a contradiction.Hence, the constructed edge-coloring indeed is a feasible edge 3-coloring.2.6 DiscussionBoth of the lower bounds shown above are proved directly by a reduction from NP -completeproblems. Although the gap between the 1:5 lower bound and the 2 upper bound is low,one should still consider how can the gap be closed. One interesting approach is to improvethe lower bound by using more sophisticated techniques such as PCP reductions.The approximation scheme described in this chapter applies to load balancing overidentical machines. Several extensions of the identical machines model exist, of which oneof the most powerful is the unrelated machines model. Recall that in this model each jobmachine pair has its own associated load. In a recent paper [3], an approximation schemefor load balancing over unrelated machines was shown.

Page 30: Scheduling and Load Balancing

Chapter 3Online Load Balancing withUnrelated Machines3.1 IntroductionThe eight basic on-line load balancing problems described in the introduction of this thesisare the identical, related, restricted and unrelated machines models with either permanentor temporary tasks. Asymptotically tight bounds were given to all these problems exceptone: the assignment of temporary tasks to unrelated machines remained open. In thischapter, we present an inapproximability result by employing a cyclic load transfer method.We ignore the o�-line version of the problem since it was recently solved in [3].We also investigate a model that is a combination of the restricted and the relatedmachines model. It is more powerful than both of them but is still not as powerful as theunrelated machines model. In this model, named the related-restricted machines model,each job has its own weight and an admissible machine set. In addition each machine hasa speed. A job can be assigned to one of its admissible machines where the added load isits weight divided by the machine's speed. As it turns out, tight results can be achievedfor the case where two di�erent machine speeds exist. This model seems like a realistic oneand is currently the most powerful model for which an approximability result exists.The results in [11] (and later in [53]) show a lower bound of (pm) on the competi-tive ratio that any on-line algorithm (deterministic or randomized) may have for restrictedassignment of temporary tasks. This (pm) lower bound for restricted assignment datesback to 1992 but was still the best lower bound for unrelated assignment. The lower boundfor the restricted assignment was shown to be tight in [13] by a matching O(pm) upperbound (the \Robin-Hood" algorithm). For the unrelated assignment, on the other hand, noon-line algorithm exists apart from a trivial upper bound. Our results show that this trivialO(m) competitive algorithm is almost optimal hence proving the inapproximability of thismodel. Speci�cally, by using a cyclic load transfer method we achieve an (m= logm) lower29

Page 31: Scheduling and Load Balancing

30 CHAPTER 3. ONLINE LOAD BALANCING WITH UNRELATED MACHINESbound. The open problem mentioned in [24] regarding the existence of a better approxi-mation algorithm is thus answered negatively. We extend the inapproximability result torandomized algorithms as well.3.2 Inapproximability of the Unrelated Machines ModelIn this section we present the inapproximability result for online load balancing of tempo-rary tasks on unrelated machines. Namely, we show a lower bound of (m= logm) almostmatching an upper bound of O(m). It can be seen that the simple algorithm assigning eachjob to its fastest machine is an O(m) competitive algorithm.We proceed with the inapproximability result:Theorem 3.2.1 Any online algorithm for the load balancing of temporary tasks on unre-lated machines is (m= logm) competitive.Proof: Let k be the largest integer power of 2 such that k � m=logm. Assume by contra-diction that there is an online algorithm whose competitive ratio is below k=2. We describea sequence of jobs given by an adversary such that there exists an optimal assignment whosemaximum load is at most 1. The sequence ends as soon as there is a machine whose loadin the online assignment is at least k=2.The lower bound uses l = log k sets of k machines each. The sets are denoted byM1;M2; :::;Ml. In addition, a machine denoted by m10 is used. Also, denote by mji the j'thmachine in the set Mi, 1 � i � l, 1 � j � k. Note that the total number of machines used,l � k + 1, does not exceed m (when m > 2).The adversary proceeds in phases. Before the start of phase t, we de�ne a set of l + 1machines which we call active. One machine in each Mi is active and we denote its indexby ai(t). The machine m10 is always active and we use the notation a0(t) = 1. The loadof mai(t)i , i = 0; :::; l, in the online assignment is denoted by bi(t). We begin with settingai(0) = 1 for i = 1; :::; l.A phase is composed of an arrival of one job and the departure of a set of jobs. The jobpresented by the adversary has in�nite weight on non-active machines. Its weight on mai(t)iis 2i=k for i = 0; :::; l. Assume the online algorithm assigns it to machine mai(t)i . In case thenew load, bi(t + 1), is k=2 or more the sequence stops. Otherwise, the phase is completedwith the departure of the jobs assigned by the online algorithm to mai+1(t)i+1 ; :::;mal(t)l (nojob leaves when i = l). The set of active machines for the next phase is set as follows:aj(t+ 1) = 1 for any i + 2 � j � l and unless i = l we also set ai+1(t + 1) = 1 + b2bi(t)c.All other active machines stay the same. Note that since bi(t) < k=2 the above de�nition ofai(t+1) is valid, that is, ai(t+1) � k. Also note that by the above construction, non-activemachines are always empty.

Page 32: Scheduling and Load Balancing

3.2. INAPPROXIMABILITY OF THE UNRELATED MACHINES MODEL 31If we consider the vector of loads of the online assignment, (b0(t); b1(t); :::; bl(t)), wenote that the vector increases lexicographically after each phase. That is, at least one ofthe coordinates increases while all previous coordinates do not change. The increase isby at least 1=k. Since the adversary sequence is completed once one of the coordinatesexceeds k=2, the sequence is completed after a �nite number of phases, or speci�cally, atmost O(k2l) = O(m2 logm) phases.In what follows we complete the proof by showing an optimal assignment where themaximum load does not exceed 1 during the whole sequence. In case the job arriving atphase t is assigned by the online algorithm to mai(t)i , i = 0; :::; l � 1, then the optimalalgorithm assigns it to machine mai+1(t)i+1 . Otherwise, the job arriving at phase t is assignedby the online algorithm to mal(t)l and the optimal algorithm assigns it to machine m10.First, jobs assigned by the optimal assignment tom10 are assigned by the online algorithmto an active machine in Ml. Since that machine's load is not more than k=2 and all othermachines in Ml are empty, the incurred load on m10 is at most 1=2. Now consider jobsassigned to mji+1, i = 0; :::; l � 1, by the optimal assignment. These are assigned by theonline algorithm to the active machine inMi. Moreover, when they were assigned, the loadon the active machine in Mi was at least (j � 1)=2 and less than j=2 because ai+1, whichwas equal to j, is de�ned as twice this load plus one rounded down. Therefore, their totalload on a machine in Mi is at most 1=2 and their total load on a machine in Mi+1 is atmost 1.Concluding, the above sequence was shown to have an optimal assignment of maximumload 1. Moreover, as long as the online maximum load is below k=2 the online load vectorwas shown to increase lexicographically. This contradicts our assumption that an onlinealgorithm with competitive ratio below k=2 exists and completes the proof.The following lemmas demonstrate a general technique for converting deterministic lowerbounds into randomized ones.Lemma 3.2.1 Let R be a randomized on-line algorithm for load balancing of temporarytasks on unrelated machines which achieves a competitive ratio of c. Then there exists adeterministic on-line algorithm D, allowed to split jobs between di�erent machines, whichachieves a competitive ratio � c against an optimal algorithm which is not allowed to splitjobs.Proof: Algorithm R determines the probability pj(i) that a job j is assigned to machinemi, Pi pj(i) = 1. We denote the expectation of the maximum load of R by lR. For anyinput sequence, lR � c � lOPT .We de�ne D as follows. For an arriving job j, D splits the job between the machinesaccording to the probabilities set by R. So D assigns a load of pj(i) � wj to each machinemi. We denote the maximum load of D by lD.

Page 33: Scheduling and Load Balancing

32 CHAPTER 3. ONLINE LOAD BALANCING WITH UNRELATED MACHINESWe now prove that for any input sequence lD � lR. Note that at any given timet, the load of D on machine mi is lDi (t) = E(lRi (t)). Hence, lD(t) = maxi(lDi (t)) =maxi(E(lRi (t))). Using the fact that the maximum of expectations is at most the expecta-tion of maxima, lD(t) � E(maxi(lRi (t))) = lR(t). The proof is completed by noting thatlD = maxt(lD(t)) � maxt(lR(t)) = lR � c � lOPT .Lemma 3.2.2 Let c be a lower bound on the competitive ratio of any deterministic algo-rithm for unrelated assignment of temporary tasks. If c can be proven with an adversarialstrategy of jobs in which each job has an admissible set of at most k machines, then thereis a lower bound of ck on the competitive ratio of any randomized on-line algorithm for thesame problem.Proof: We will prove that there is a lower bound of ck on the competitive ratio of anydeterministic on-line algorithm D which is allowed to split jobs (compared to an optimumwhich is not allowed to split them). According to the previous lemma, this implies a lowerbound of ck for randomized on-line algorithms as well. Consider the sequence used for thedeterministic lower bound. Since each job in that sequence can only be assigned to at mostk machines, D must assign at least 1k of the job's weight to one machine. Now, considera deterministic online algorithm D0 which simulates D and assigns each job to just onemachine: the machine to which D assigned the largest part of the job. This is an onlinealgorithm that does not split jobs and therefore our adversarial strategy creates a load of atleast lD0 � c � lOPT . Since D assigns at least a 1k -fraction of each job to the same machineas D0, its load at the end of the same sequence must be at least lD � 1k � c � lOPT which givesthe required competitive ratio.Theorem 3.2.2 Any online randomized algorithm for the load balancing of temporary taskson unrelated machines is (m=(logm)2) competitive.Proof: The construction in Theorem 3.2.1 uses admissible sets of at most logm machines.The theorem then follows as a corollary of Lemma 3.2.2.3.3 Tight Results for the Related-Restricted Machines ModelThe result in the previous section shows that approximating the unrelated machines modelis almost infeasible. As an alternative to the unrelated machines model we consider the socalled related-restricted machines model. Here, each machine has its own speed and eachjob has a weight and a set of admissible machines. However, note that the lower boundpresented in the last section still applies here so approximating is still infeasible. We showthat by limiting the number of di�erent machine speeds to a constant number, we canapproximate the problem better. Speci�cally, in the case where only two di�erent machinespeeds are involved we obtain the following lower bound. Later, we will present a matchingupper bound.

Page 34: Scheduling and Load Balancing

3.3. TIGHT RESULTS FOR THE RELATED-RESTRICTED MACHINES MODEL 33Theorem 3.3.1 Any online algorithm for the load balancing of temporary tasks in therelated-restricted machines model with speeds f1; sg is (minfmaxfm=s;pmg;pmsg) com-petitive. The same holds for randomized algorithms as well.Proof: A lower bound of (pm) already exists for the special case of the restricted assign-ment model and therefore we can limit ourselves to showing a lower bound of (minfm=s;pmsg)for s � pm. Let m0 = m=3 and b = minfm0=s;pm0sg. Assume by contradiction that thereis an online algorithm whose competitive ratio is below b. We describe a sequence of jobsgiven by an adversary such that there exists an optimal assignment whose maximum loadis at most 1. The sequence ends as soon as there is a machine whose load in the onlineassignment is at least b.The lower bound uses three sets of machines,M0,M1 andM2. BothM1 andM2 containm0 machines whereas M0 contains m0=b machines. The j'th machine in Mi is denoted mji .The idea behind the lower bound is to force the online algorithm to assign jobs to machinesin M0 while an optimal algorithm can assign them to machines in M1.The lower bound proceeds in phases and stops as soon as the load on a machine reaches b.At the beginning of a phase t we choose three active machines, one in eachMi. Their indicesare denoted by a0(t), a1(t) and a2(t). They are initially set to a0(0) = a1(0) = a2(0) = 1.One job is presented in each phase. Its weight on ma0(t)0 or on ma1(t)1 is 1=s where the weightonma2(t)2 is 1. In case the online algorithm assigned the job toma0(t)0 , all jobs assigned by theonline algorithm to M1 or M2 leave. If the job is assigned to ma1(t)1 all jobs assigned to M2leave. Otherwise, the job was assigned toma2(t)2 and no jobs leave. For the next phase, we seta0(t+1) = 1+bb2(t)=sc, a1(t+1) = 1+bb0(t)c and a2(t+1) = 1+bsb1(t)c where bi(t) denotesthe total on-line load on machines inMi. This is possible �rst because inM0 there are m0=bmachines each of which has a load of less than b so that a1(t+1) = 1+bb0(t)c � b�m0=b = m0.In addition, note that at any given time only one machine in M1 and one machine in M2are not empty in the online assignment. Therefore, a2(t+1) = 1+ bsb1(t)c � s � b � m0 anda0(t+ 1) = 1 + bb2(t)=sc � b=s � m0=b.Note that the vector (b0(t); b1(t); b2(t)) lexicographically increases after each phase byat least 1=s. Moreover, the adversary described above proceeds as long as the maximumload is below b. Therefore, after a �nite number of phases the load on one of the machinesis going to reach b.The proof is completed by showing an optimal assignment where the maximum loaddoes not exceed 1. In case the job arriving at phase t is assigned by the online algorithm tomachinemai(t)i , then the optimal algorithm assigns it to machinemaj(t)j where j = i+1mod3.Now consider jobs assigned to mj1 by the optimal assignment. These are assigned by theonline algorithm to a machine in M0. Moreover, when they were assigned, the total onlineload on machines inM0 was at least j�1 and less than j. Since jobs assigned by the onlinealgorithm to M0 never leave, the load on mj1 is at most 1. Similarly, consider jobs assignedto mj2 by the optimal assignment. These are assigned by the online algorithm to an active

Page 35: Scheduling and Load Balancing

34 CHAPTER 3. ONLINE LOAD BALANCING WITH UNRELATED MACHINESmachine in M1. When they were assigned, the total online load on the active machine inM1 was at least (j � 1)=s and less than j=s. Since jobs assigned by the online algorithm toM1 leave all together and never leave individually, the load on mj2 is at most s � 1=s = 1. Asimilar argument holds for jobs assigned to M0 by the optimal assignment.Concluding, the above adversarial sequence was shown to have an optimal assignmentof maximum load 1 and as long as the online maximum load is below b, an online loadvector was shown to increase lexicographically. This contradicts our assumption that ab-competitive online algorithm exists and completes the proof. By Lemma 3.2.2, the resultalso holds for the randomized case since there are exactly three machines in any admissibleset.In the rest of this section, we describe two online algorithms whose combination achievesa competitive ratio matching the lower bound stated above. In both algorithms we assumethat OPT = 1. Nevertheless, by using standard doubling techniques we can overcome thatassumption while increasing the competitive ratio by a factor of at most 4. Both algorithmsare based on a modi�ed Robin Hood algorithm [13] with some threshold b. A machine issaid to be poor at a certain time if its load it less than b and is said to be rich otherwise.For a machine rich at time t we de�ne its windfall time as t0 if it is rich from time t0 to tbut is poor at time t0 � 1. As its name implies, the Robin Hood algorithm tries to assignjobs to the poor machines or in case none exists, to the a rich machine with the most recentwindfall time.Algorithm 1 In case an incoming job has at least one admissible fast machine, removeall slow machines from its admissible machines. Then use the Robin Hood algorithm witha threshold b = maxfpm;m=sg.Claim 3.3.1 The above algorithm is O(maxfpm;m=sg) competitive.Proof: First notice that jobs assigned to slow machines are not allowed to be assigned toany fast machine. Therefore, the contribution of a job to the total load of an optimalassignment is at least its contribution to the total load of the online assignment. Hence,the total load on all machines at any given time is at most that of an optimal assignmentwhich is at most m. This implies that the number of rich machines at any given time is atmost m=b.By the de�nition of the algorithm, any job assigned to a slow rich machine i has onlyslow rich machines in its admissible set. Moreover, the windfall time of these machinesis before the windfall time of i, that is, they are all already rich at the windfall time of i.Therefore, in an optimal assignment, all jobs assigned to i after its windfall time are assignedto at most m=b slow machines. Their total load on i is at most m=b. Adding the job madei rich, we get that the total load on i at any given time is at most b+ 1 +m=b = O(b).Now consider a fast rich machine. Unlike slow machines, some of the jobs assigned tofast machines might result from the algorithm's removal of slow admissible machines. Thus

Page 36: Scheduling and Load Balancing

3.4. DISCUSSION 35jobs assigned to a fast rich machine i after its windfall time are assigned in an optimalassignment to one of at most m=b fast machines or to any one of the slow machines. Thetotal load on machine i is therefore at most b + 1 +m=b +m=s = O(b) and the requiredcompetitive ratio is achieved.Algorithm 2 Use the Robin Hood algorithm with a threshold b = pms.Claim 3.3.2 The above algorithm is O(pms) competitive.Proof: The total load on the fast machines at any given time is at most that of an optimalassignment which is at most m. The total load on the slow machines at any given time isat most sm since these jobs might be assigned to fast machines by an optimal assignment.This implies that the number of fast rich machines at any given time is at most m=b andthat the number of slow rich machines is at most sm=b.Consider a job assigned to a rich machine i. All other machines in its admissible setare rich and their windfall time is before the windfall time of i, that is, they are all alreadyrich at the windfall time of i. Therefore, all jobs assigned to i after its windfall time areassigned in an optimal assignment to at most sm=b slow machines and to at most m=b fastmachines. Therefore, if i is slow, their total load on i is at most 2sm=b and if i is fast, theirtotal load on i is at most 2m=b. Adding the job that made i rich, we get that the total loadon i at any given time is at most b+ s+ 2sm=b = O(pms).Algorithm 3 If s > m1=3 use the �rst algorithm; otherwise, use the second algorithm.Theorem 3.3.2 The above algorithm is O(minfmaxfm=s;pmg;pmsg)-competitive for loadbalancing of temporary tasks in the related-restricted machines model with speeds f1; sg.3.4 DiscussionThe main result presented in this chapter is almost tight. The gap of O(logm), as smallas it is, still exists and closing this gap is a problem of some interest. A problem that isof comparable importance is to determine the competitive ratio of the related-restrictedmachines model with three or more speeds. We conjecture that upper bounds better thanthe trivial O(m) upper bound should exist for a small constant number of machine speeds.

Page 37: Scheduling and Load Balancing

36 CHAPTER 3. ONLINE LOAD BALANCING WITH UNRELATED MACHINES

Page 38: Scheduling and Load Balancing

Chapter 4Multiprocessor Scheduling withoutMigration4.1 IntroductionThis chapter considers the problem of scheduling jobs in a multiprocessor setting in orderto minimize the average ow time or the total ow time (the two are equivalent since theirratio is the number of jobs). In the introduction of this thesis we have seen that withoutpreemption good approximation ratios cannot be achieved. The question we address in thischapter is whether migration is also a necessary component for a good scheduling algorithm,in either the online or the o�ine setting.The SRPT algorithm is the best approximation algorithm known for both the o�-line and the on-line settings. However, it can be seen that it uses migration. Withoutmigration, no o�ine or online approximations were known. In this chapter we introducea new algorithm that does not use migration and whose approximation ratio is as goodas SRPT . More speci�cally, our algorithm guarantees, on all input instances, a smallperformance gap in comparison to the optimal o�ine schedule that allows both preemptionand migration. Recall that n is the number of jobs, m is the number of machines, and denoteby P the ratio between the processing time of the longest and the shortest jobs. Thenour algorithm performs within an O(minflogP; log ng) factor of the optimal preemptivealgorithm that allows migration. The algorithm can be easily implemented in polynomialtime in the size of the input instance.Our algorithm is also on-line. We note that in the proof of the (logP ), (log(n=m))lower bounds of [51] for on-line algorithms, the optimal algorithm does not use migration.Hence, the (randomized) lower bound holds also for a non-migratory algorithm. This impliesthat our algorithm is optimal with respect to the parameter P , i.e., no on-line algorithm canachieve a better bound both when the o�-line algorithm is or is not allowed to migrate jobs(the �rst claim is obviously stronger), while there is still a small gap between the O(log n)37

Page 39: Scheduling and Load Balancing

38 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATIONupper bound and the (log(n=m)) lower bound. We also show an (logn) competitivelower bound for our algorithm.Our algorithm and its analysis draw on some ideas from the SRPT algorithm[51]. How-ever, unlike SRPT, our algorithm may continue to run a job on a machine even when ashorter job is waiting to be processed. This seems essential in the non-migratory settingsince being too eager to run a shorter job may result in an unbalanced commitment tomachines. A non-migratory algorithm has to trade o� between the commitment of a job toa machine and the decrease in the ow time yielded by running a shorter job. Our algo-rithm runs the job with the shortest remaining processing time among all the jobs that werealready assigned to that machine, and a new job is assigned to a machine if its processingtime is considerably shorter than the job that is currently running.4.2 PreliminariesWe use the notations described in the introduction for the on-line preemptive schedulingmodel. In this chapter, our model allows preemption but does not allow migration, i.e., ajob that is running can be preempted but must later continue its execution on the samemachine on which its execution began. The scheduling algorithm decides which of the jobsshould be executed at each time. Recall that a machine can process at most one job in anygiven time and that a job cannot be processed before its release time. We measure the total ow time, that is, Pj2J fj and denote the total ow time of algorithm A by FA. The goalof the scheduling algorithm is to minimize the total ow time for each given instance of theproblem. In the o�-line version of the problem all the jobs are known in advance. In theon-line version of the problem each job is introduced at its release time and the algorithmbases its decision only upon the jobs that were already released.4.3 The AlgorithmA job is called alive at time t for a given schedule if it has already been released but has notbeen completed yet. Our algorithm classi�es the jobs that are alive into classes according totheir remaining processing times. A job j whose remaining processing time is in [2k; 2k+1)is in class k for an integer �1 < k <1. Notice that a given job changes its class during itsexecution. The algorithm holds a pool of jobs that are alive and have not been processedat all. In addition, the algorithm holds a stack of jobs for each of the machines. The stackof machine i holds jobs that are alive and have already been processed by machine i. Thealgorithm works as follows:� Each machine processes the job at the top of its stack.� When a new job arrives the algorithm looks for a machine that is idle or currentlyprocessing a job of a higher class than the new job. In case it �nds one, the new job

Page 40: Scheduling and Load Balancing

4.4. ANALYSIS 39in pushed onto the machine's stack and its processing begins. Otherwise, the job isinserted into the pool.� When a job is completed on some machine it is popped from its stack. The algorithmcompares the class of the job at the top of the stack with the minimum class of a jobin the pool. If the minimum is in the pool then a job that achieves the minimum ispushed onto the stack (and removed from the pool).Clearly, when a job is assigned to a machine it will be processed only on that machineand thus the algorithm does not use migration. In fact, the algorithm bases its decisionsonly on the jobs that were released up to the current time and hence is an on-line algorithm.Note that it may seem that the algorithm has to keep track of all the in�nite number ofclasses through which a job evolves. However, the algorithm recalculates the classes of jobsonly at arrival or completion of a job.4.4 AnalysisWe denote by A our scheduling algorithm and by OPT the optimal o�-line algorithm thatminimizes the ow time for any given instance. For our analysis we can even assumethat OPT may migrate jobs between machines. Whenever we talk about time t we meanthe moment after the events of time t happened. For a given scheduling algorithm S wede�ne V S(t) to be the volume of a schedule at a certain time t. This volume is the sumof all the remaining processing times of jobs that are alive. In addition, we de�ne ÆS(t)to be the number of jobs that are alive. �V (t) is de�ned to be the volume di�erencebetween our algorithm and the optimal algorithm, i.e., V A(t) � V OPT (t). We also de�neby �Æ(t) = ÆA(t) � ÆOPT (t) the alive jobs di�erence at time t between A and OPT . Fora generic function f (V , �V , Æ or �Æ) we use f�h;�k(t) to denote the value of f at timet when restricted to jobs of classes between h and k. Similarly, the notation f=k(t) willrepresent the value of function f at time t when restricted to jobs of class precisely k.Let S(t) be the number of non-idle machines at time t. Notice that because ouralgorithm does not migrate jobs, there are situations in which A(t) < m and ÆA(t) � m.We denote by T the set of times in which A(t) = m, that is, the set of times in whichnone of the machines is idle. Denote by Pmin the processing time of the shortest job andby Pmax the processing time of the longest job. Note that P = Pmax=Pmin. Denote bykmin = blogPminc and kmax = blogPmaxc the classes of the shortest and longest jobs upontheir arrival.We start by observing the simple fact that the ow time is the integral over time of thenumber of jobs that are alive (for example, see [51]):Fact 4.4.1 For any scheduler S, F S = Zt ÆS(t)dt:

Page 41: Scheduling and Load Balancing

40 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATIONNext we note that the algorithm preserves the following property of the stacks:Lemma 4.4.1 In each stack the jobs are ordered in a strictly increasing class order andthere is at most one job whose class is at most kmin.Proof: At time t = 0 the lemma is true since all the stacks are empty. The lemma is provedby induction on time. The classes of jobs in the stacks change in one of three cases. The �rstis when the class of the currently processed job decreases. Since the currently processed jobis the job with the lowest class, the lemma remains true. The second case is when a new jobarrives. In case it enters the pool there is no change in any stack. Otherwise it is pushedonto a stack whose top is of a higher class which preserves the �rst part of the lemma. Sincethe class of the new job is at least kmin, the second part of the lemma remains true as well.The third case is when a job is completed on some machine. If no job is pushed onto thestack of that machine the lemma remains easily true. If a new job is pushed onto the stackthen the lemma remains true in much the same way as in the case of the arrival of a newjob.Corollary 4.4.1 There are at most 2 + logP jobs in each stack.Proof: The number of classes of jobs in each stack is at most kmax � kmin + 1 � 2 + logP .We look at the state of the schedule at a certain time t. First let's look at t =2 T :Lemma 4.4.2 For t =2 T , ÆA(t) � A(t)(2 + logP ).Proof: By de�nition of T , at time t at least one machine is idle. This implies that thepool is empty. Moreover, all the stacks of the idle machines are obviously empty. So, allthe jobs that are alive are in the stacks of the non-idle machines. The number of non-idlemachines is A(t) and the number of jobs in each stack is at most 2 + logP according toCorollary 4.4.1Now, assume that t 2 T and let t < t be the earliest time for which [t; t) � T . Wedenote the last time in [t; t) in which a job of class more than k was processed by tk. Incase such jobs were not processed at all in the time interval [t; t) we set tk = t. So,t � tkmax � tkmax�1 � ::: � tkmin � t.Lemma 4.4.3 For t 2 T , �V�k(t) � �V�k(tk).Proof: Notice that in the time interval [tk; t), algorithm A is constantly processing on allthe machines jobs whose class is at most k. The o�-line algorithm may process jobs of

Page 42: Scheduling and Load Balancing

4.4. ANALYSIS 41higher classes. Moreover, that can cause jobs of class more than k to actually lower theirclasses to k and below therefore adding even more to V OPT�k (t). Finally, the release of jobs ofclass � k in the interval [tk; t) is not a�ecting �V�k(t). Therefore, the di�erence in volumebetween the two algorithms cannot increase.Lemma 4.4.4 For t 2 T , �V�k(tk) �m2k+2.Proof: First we claim that at any moment tk� �, for any � > 0 small enough, the pool doesnot contain jobs whose class is at most k. In case tk = t, at any moment just before tkthere is at least one idle machine which means the pool is empty. Otherwise, tk > t and byde�nition we know that a job of class more than k is processed just before tk. Therefore,the pool does not contain any job whose class is at most k.At time tk jobs of class at most k might arrive and �ll the pool. However, these jobsincrease both V OPT�k (tk) and V A�k(tk) by the same amount, so jobs that arrive exactly at tkdo not change �V�k(tk) and can be ignored.Since the jobs in the pool at time tk can be ignored, we are left with the jobs in thestacks. Using Lemma 4.4.1, �V�k(tk) � m(2k+1 + 2k + 2k�1 + : : :) � m2k+2.Lemma 4.4.5 For t 2 T , �V�k(t) � m2k+2.Proof: Combining Lemma 4.4.3 and 4.4.4, we obtain �V�k(t) � �V�k(tk) � m2k+2The claim of the following lemma states a property that will be used in the proof ofboth the O(logP ) and the O(log n) approximation results.Lemma 4.4.6 For t 2 T , for kmin � k1 � k2 � kmax, ÆA�k1;�k2(t) � 2m(k2 � k1 + 2) +2ÆOPT�k2 (t).Proof: ÆA�k1;�k2(t) can be expressed as:k2Xi=k1 ÆA=i(t)� k2Xi=k1(�V=i(t) + V OPT=i (t)2i )� k2Xi=k1 �V�i(t)��V�i�1(t)2i + 2ÆOPT�k1;�k2(t)

Page 43: Scheduling and Load Balancing

42 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATION� �V�k2(t)2k2 + k2�1Xi=k1 �V�i(t)2i+1��V�k1�1(t)2k1 + 2ÆOPT�k1;�k2(t)� 4m+ k2�1Xi=k1 2m+ ÆOPT�k1�1(t) + 2ÆOPT�k1;�k2(t)� 2m(k2 � k1 + 2) + 2ÆOPT�k2 (t):The �rst inequality follows since 2i is the minimum processing time of a job of class i.The second inequality follows since the processing time of a job of class i is less than 2i+1.The fourth inequality is derived by applying Lemma 4.4.5, observing that �V�k1�1(t) ��V OPT�k1�1(t) and that 2k1 is the maximum processing time of a job of class at most k1 � 1.The claim of the lemma then follows.The following corollary of Lemma 4.4.6 is used in the proof of the O(logP ) approxima-tion ratio of Theorem 4.4.1Corollary 4.4.2 For t 2 T , ÆA(t) � 2m(4 + logP ) + 2ÆOPT (t).Proof: We express ÆA(t) = ÆA�kmax;�kmin(t) + ÆA<kmin(t)� 2m(kmax � kmin + 2) + 2ÆOPT (t) +m� 2m(4 + logP ) + 2ÆOPT (t)The second inequality follows from the claim of Lemma 4.4.6 when k2 = kmax andk1 = kmin, and from the claim of Lemma 4.4.1 stating that the stack of each machinecontains at most one job of class less than kmin. The third inequality is obtained sincekmax � kmin + 5=2 � logP + 4.Theorem 4.4.1 FA � 2(5+ log P ) �FOPT , that is, algorithm A has a 2(5+ log P ) approx-imation factor even compared to the optimal o�-line algorithm that is allowed to migratejobs.Proof: FA = Zt ÆA(t)dt= Zt=2T ÆA(t)dt+ Zt2T ÆA(t)dt

Page 44: Scheduling and Load Balancing

4.4. ANALYSIS 43� Zt=2T A(t)(2 + logP )dt+ Zt2T (2m(4 + logP ) + 2ÆOPT (t))dt� (2 + logP ) Zt=2T A(t)dt+2(4 + logP ) Zt2T mdt+ 2 Zt2T ÆOPT (t)dt� (8 + 2 logP ) Zt A(t)dt+ 2 Zt ÆOPT (t)dt� 2(5 + logP ) � FOPTThe �rst equality is from the de�nition of FA. The second is obtained by looking atthe time in which none of the machines is idle and the time in which at least one machineis idle separately. The third inequality uses Lemma 4.4.2 and Corollary 4.4.2. The �fthinequality is true since A(t) = m when t 2 T . Finally, Rt A(t)dt is the total time spentprocessing jobs by the machines which is exactly Pj2J wj. That sum is upper bounded bythe ow time of OPT since each job's ow time must be at least its processing time.We now turn to prove the O(log n) approximation ratio of the algorithm. A di�erentargument is required to prove this second bound. The main idea behind the proof of theO(logP ) approximation ratio was to bound for any time t 2 T , the alive jobs di�erencebetween A and OPT by O(m logP ). A similar approach does not allow us to prove theO(log n) approximation ratio: It is possible to construct instances where the the alive jobsdi�erence is (n).Leonardi and Raz [51] proved the O(log(n=m)) approximation ratio for SRPT whenmigration is allowed arguing that the worst case ratio between the SRPT ow time andthe optimal ow time can be raised only if a \big" alive jobs di�erence is kept for a \long"time period. This observation holds also for our non-migratory algorithm. This is formallystated in Lemma 4.4.7 for any time t 2 T when no machine is idle and in Lemma 4.4.8.These lemmas prove that the minimum remaining processing time of a set of un�nishedjobs is exponentially decreasing with the size of the alive jobs di�erence between A andOPT . Thus, either new jobs are released at a rate exponential in the size of the alivejobs di�erence, or the ongoing processed jobs are consumed and the alive jobs di�erence isreduced.We need to introduce more notation. Recall that T is de�ned to be the set of times inwhich A(t) = m. We denote by T = Rt2T dt the size of set T . For any t 2 T , de�ne byÆA;P (t) the number of jobs in the pool of algorithm A, i.e., not assigned to a machine, attime t, and by �ÆP (t) = ÆA;P (t) � 2ÆOPT (t) the di�erence between the number of jobs inthe pool of algorithm A and twice the number of jobs not �nished by the optimal algorithm.For any machine l, time t, de�ne by ÆA;l(t) the number of jobs assigned to machine l at

Page 45: Scheduling and Load Balancing

44 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATIONtime t in the schedule of algorithm A. Moreover, de�ne by T l = ftjÆA;l(t) > 0g, the set oftimes when machine l is assigned with at least one job, and by T l = Rt2T l dt the size of setT l.Lemma 4.4.7 For any time t 2 T , if �ÆP (t) � 2mi, for i � 3, then the pool of algorithmA contains at least 2m jobs of remaining processing time at most V A(t)m2i�3 .Proof: Let khigh be the maximum integer such that ÆA;P�khigh(t) � 2m and let klow be themaximum integer such that ÆA;P<klow(t) < 2m. Note that both numbers are well de�ned andklow � khigh since there are at least 6m > 2m jobs in the pool. Then,2m � ÆA;P�khigh(t) � ÆA�khigh(t)� V A(t)2khighthus yielding 2khigh � V A(t)2m . In particular, the last inequality follows since 2khigh is theminimum processing time of a job of class khigh.By the de�nition of khigh, we have:�ÆP�khigh(t) = ÆA;P�khigh(t)� 2ÆOPT�khigh(t)= ÆA;P (t)� ÆA;P>khigh(t)� 2(ÆOPT (t)� ÆOPT>khigh(t))= �ÆP (t)� ÆA;P>khigh(t) + 2ÆOPT>khigh(t)� 2m(i� 1):where the last inequality follows since ÆA;P>khigh(t) < 2m.From Lemma 4.4.6, we get:�ÆP�khigh(t) = ÆA;P�khigh;�klow(t) + ÆA;P<klow(t)� 2ÆOPT�khigh(t)� ÆA�khigh;�klow(t) + ÆA;P<klow(t)� 2ÆOPT�khigh(t)� ÆA;P<klow(t) + 2m(khigh � klow + 2);thus yielding ÆA;P<klow(t) � 2m(i + klow � khigh � 3). Therefore, we get that 2m > 2m (i +klow � khigh � 3) and thus klow � khigh � i+ 3. It follows that there exist at least 2m jobsof class at most klow � khigh� i+3 in the pool of the algorithm. The remaining processingtime of these 2m jobs is bounded by 2khigh�i+4 � V A(t)m2i�3 , thus proving the claim.

Page 46: Scheduling and Load Balancing

4.4. ANALYSIS 45Lemma 4.4.8 For any machine l, time t 2 T l, if ÆA;l(t) � i for i � 1 then there exists ajob with remaining processing time at most T l2i�2 assigned to machine l at time t.Proof: For any time t 2 T l, there is at most one job assigned to machine l for every speci�cclass. Assume machine l is assigned with a job of highest class k, obviously satisfyingT l � 2k. If ÆA;l(t) � i then there is a job of class at most k � i+ 1 assigned to machine l,with processing time at most 2k�i+2 � T l2i�2 .We partition the set of time instants T when no machine is idle into a collection ofdisjoint intervals Ik = [tk; rk), k = 1; : : : ; s, and associate an integer ik with each interval,such that for any time t 2 Ik, 2m(ik � 1) < �ÆP (t) < 2m(ik + 2).Each maximal interval of times [tb; te) contained in T is dealt with separately. Assumewe already dealt with all times in T which are smaller than tb, and we have created k � 1intervals. We then de�ne tk = tb. Given tk we choose ik = b�ÆP (tk)2m c. Given an interval'stk and ik, we de�ne rk = minfte; tjt > tk;�ÆP (t) � 2m(ik + 2) or �ÆP (t) � 2m(ik � 1)g,that is, rk is the �rst time �ÆP (t) reaches the value 2m(ik + 2), or the value 2m(ik � 1).As long as rk < te, we continue with the next interval beginning at tk+1 = rk.Observation 1 When an interval k begins, 2mik � �ÆP (tk) < 2m(ik + 1). When it ends,either �ÆP (rk) � 2m(ik � 1), �ÆP (rk) � 2m(ik + 2) or �ÆP (rk) � 0.Proof: The �rst part is clear by the way we choose ik. The second part is clear when rk isnot equal to some te, that is, tk 2 T . Otherwise, rk =2 T and therefore ÆA;P (rk) = 0 and�ÆP (rk) � 0.Denote by xk = rk � tk the size of interval Ik, and de�ne Ti = f[Ikjik = ig, i � 1, asthe union of the intervals Ik with ik = i. We indicate by Ti = Rt2Ti dt the size of set Ti. Wealso denote by D = maxfT;maxt2T fV A(t)=mgg. The following lemma relates the numberof jobs, n, and the values of Ti.Lemma 4.4.9 The following lower bound holds for the number of jobs:n � m8DXi�4 Ti 2i�5:Proof: Consider an interval Ik, with a corresponding ik � 4. According to Observation 1,when the interval starts �ÆP (tk) is between 2mik and 2m(ik +1). This interval ends when�ÆP (rk) goes above 2m(ik+2) or below 2m(ik�1) (it might also reach 0 but 0 < 2m(ik�1)).In the �rst case we have the evidence of at least m jobs �nished by OPT (recall that�ÆP (t) = ÆA;P (t)� 2ÆOPT (t)). In the second case we have the evidence of at least 2m jobs

Page 47: Scheduling and Load Balancing

46 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATIONthat either leave the pool to be assigned to a machine by algorithm A or arrive to both Aand OPT . In both cases we charge nk � m jobs to interval Ik. We can then conclude witha �rst lower bound nk � m on the number of jobs charged to any interval Ik 2 Ti, ik � 4.Next, we give a second lower bound, based on Lemma 4.4.7, stating that during aninterval Ik = [tk; rk) there exist in the pool 2m jobs with remaining processing time atmost D2ik�4 , since �ÆP (t) > 2m(ik � 1) for any t 2 [tk; rk). This implies that all the mmachines are processing jobs with remaining processing time at most D2ik�5 . We look at anysubinterval of Ik of length D2ik�5 . For each machine, during this subinterval, either a job is�nished by the algorithm or a job is preempted by a job of lower class. Therefore, we cancharge at least m jobs that are either released or �nished with any subinterval of size D2ik�5of Ik. A second lower bound on the number of jobs charged to any interval is then given bynk � mbxk2ik�5D c.Observe now that each job is charged at most 4 times, when it is released, when it isassigned to a machine by A, when it is �nished by A and when it is �nished by OPT . Then,m2DXi�4 Ti 2i�5 � Xkjik�4 m maxf1; bxk2ik�5D cg � 4n;where the �rst inequality is obtained by summing over Ik's instead of over Ti's and thesimple fact that � � maxf1; b2�cg and the second inequality follows from the lower boundswe have shown on the charged jobs. The lemma easily follows.We next bound the number of jobs that are assigned to a machine l during the timeinstants of T l. We partition the set of time instants T l into a set of disjoint intervalsI lk = [tlk; rlk), k = 1; : : : ; sl, and associate an integer ilk with each interval, such that forany time t 2 I lk, ÆA;l(t) = ilk. Consider a maximal interval of times [tlb; tle) contained in T l.Assume tlk = tlb. Given tlk and ilk, de�ne rlk = minftle; tjt > tlk; ÆA;l(t) 6= ilkg. In case rlk < tle,we set tlk+1 = rlk. Denote by xlk = rlk�tlk the size of interval I lk. De�ne by T li = f[I lkjilk = ig,i � 1, the union of the intervals I lk when the number of jobs assigned to machine l is exactlyi, and by T li = Rt2T li dt the size of set T li .Lemma 4.4.10 The following lower bound holds for the number of jobs assigned to machinel: nl � 14T l Xi�1 T li 2i�2:Proof: We will proceed charging at least one job with every interval I lk. Every job will becharged at most twice, when it is assigned to a machine by A and when it is �nished by A.

Page 48: Scheduling and Load Balancing

4.4. ANALYSIS 47Consider the generic interval I lk, with the corresponding ilk. The interval starts whenÆA;l(tk) reaches ilk, from above or from below. The interval ends when ÆA;l(rk) reaches ilk+1or ilk � 1. In the �rst case we have the evidence of one job that is assigned to a machine byA and in the second case of one job that is �nished by A. In both cases we charge one jobto interval I lk.Next we give a second lower bound, based on Lemma 4.4.8. Lemma 4.4.8 states thatduring an interval I lk = [tlk; rlk), machine l is constantly assigned with a job of remainingprocessing time at most T l2ilk�2 . We look at any subinterval of I lk of length T l2ilk�2 . Duringthis subinterval, either a job is �nished by the algorithm or a job is preempted by a job ofa lower class. In any case, a job that is assigned or �nished during any subinterval of sizeT l2ilk�2 is charged. A second lower bound on the number of jobs charged to any interval isthen given by nk � bxlk2ilk�2T l c.Observe now that each job is considered at most twice, when it is assigned to machinel and when it is �nished by A. Then, from the following inequalities:12T l Xi�1 T li 2i�2 � Xkjilk�1 maxf1; bxlk2ilk�2T l cg � 2nl;the claim follows.Before completing the proof, we still need a simple mathematical lemma:Lemma 4.4.11 Given a sequence a1; a2; ::: of non-negative numbers such that Pi�1 ai � Aand Pi�1 2iai � B then Pi�1 iai � log(4B=A)A.Proof: De�ne a second sequence, bi = Pj�i aj for i � 1. Then it is known that A � b1 �b2 � :::. Also, it is known that Pi�1 2i(bi � bi+1) � B. This implies that Pi�1 2ibi � 2B.The sum we are trying to upper bound is Pi�1 bi. It is upper bounded by assigningbi = A for 1 � i � k and bi = 0 for i > k where k is large enough such that Pi�1 2ibi � 2B.A choice of k = dlog(2B=A)e is adequate and the sum is upper bounded by kA from whichthe result follows.Theorem 4.4.2 FA = O(logn)FOPT , that is, algorithm A has an O(log n) approximationratio even compared with the optimal o�-line algorithm that is allowed to migrate jobs.Proof: FA = Zt ÆA(t)dt

Page 49: Scheduling and Load Balancing

48 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATION= mXl=1 Zt ÆA;l(t)dt+ Zt2T ÆA;P (t)dt= mXl=1 Zt2T l ÆA;l(t)dt+ Zt2T (2ÆOPT (t) + �ÆP (t))dt� mXl=1 Zt2T l ÆA;l(t)dt+ 2FOPT+Xi Zt2Ti 2m(i+ 2)dt� mXl=1Xi�1 i T li + 2FOPT + 2mXi (i+ 2) Ti= mXl=1Xi�1 i T li + 2FOPT + 2mXi (i� 3) Ti+2mXi 5 Ti� mXl=1Xi�1 i T li + 2FOPT + 2mXi�4(i� 3) Ti+10FOPT� mXl=1Xi�1 i T li + 12FOPT + 2mXi�1 i Ti+3The second equality is obtained by separately considering for any machine l the contri-bution to the ow time due to the jobs assigned to machine l, and the contribution to the ow due to jobs in the pool. The fourth inequality is obtained by partitioning T into theTi's, such that at any time t 2 Ti, �ÆP (t) < 2m(i + 2). The seventh inequality is obtainedby observing that mPi Ti �Pj wj � FOPT , since all machines are busy processing jobs atany time t 2 T .We upper bound Pi�1 i Ti+3 under the constraint Pi�1 Ti+3 � T � D, and the con-straint on n given by Lemma 4.4.9. By choosing ai = Ti+3 we see that Pi�1 ai � Dand Pi�1 2iai � 32 nmD. These two bounds together with Lemma 4.4.11 result in the up-per bound Pi�1 iai � (7 + log nm )D. A similar argument is used for the other sum. Wechoose ai = T li instead. First note that Pi�1 ai � T l. Then, according to Lemma 4.4.10,Pi�1 2iai � 16nlT l. The upper bound by Lemma 4.4.11 is Pi�1 iai � (6 + log nl)T l.We �nally express the total ow time of algorithm A as:FA � mXl=1Xi�1 iT li + 12FOPT + 2mXi�1 i Ti+3

Page 50: Scheduling and Load Balancing

4.5. TIGHTNESS OF THE ANALYSIS 49� mXl=1O(T l lognl) + 12FOPT +O(mD log nm)= O(log n) mXl=1 T l + 12FOPT +O(log nm)FOPT= O(log n)FOPT :The third equality follows since mD � maxfmT;maxt2T fV A(t)gg �Pj2J wj � FOPT .The fourth equality follows since Pml=1 T l =Pj wj � FOPT .4.5 Tightness of the AnalysisIn this section we present an (log n) lower bound on the competitive ratio of the algorithmanalyzed in the previous section. The number of machines is an arbitrary m but note thatthe lower bound only uses the �rst two machines. While presenting the lower bound weassume an order between jobs with the same release time. The algorithm deals with jobsreleased at the same time following the speci�ed order. Moreover, we assume that thealgorithm can schedule a job on a machine processing a job of a higher class even if thereis an idle machine. These assumptions agree with the de�nition of the algorithm.Let P be a power of 2. The maximum processing time of a job is 2P and the minimum is1. At each time ri = P (2�P 12 logP�1j=i 122j ), for i = 0; : : : ; 12 logP �1, three jobs are released;one job of processing time P22i followed by two jobs of processing time P22i+1 . Finally, twojobs of size 1 are released every time unit between time 2P and 4P � 1.Let us consider the behaviour of the algorithm and of the optimal solution on thisinstance. At time r0 the released job of processing time P is assigned to machine 1, a jobof processing time P=2 is assigned to machine 2 while the second job of processing timeP=2 preempts the job on execution on machine 1. The two jobs of processing time P=2 are�nished at time r0+P=2 where the job of size P is again executed on machine 1. In general,at time ri, i = 1; ::; 12 logP , i jobs are in the queue of machine 1, the smallest of remainingprocessing time P22i�1 , while no job is on execution on machine 2. The job on executionon machine 1 is preempted by the job of size P22i that is released at time ri. Immediatelyafterwards it is preempted by a job of size P22i+1 that is released at time ri while the otherjob of size P22i+1 released at time ri is scheduled on machine 2.At time 2P , 12 logP jobs are in the queue of machine 1, the smallest of size 2, while nojob is in the pool or assigned to the other machines. The two jobs of size 1 released everytime unit between time 2P and 4P � 1 are scheduled on machines 1 and 2. Observe that12 logP jobs are waiting on queue 1 between time 2P and 4P thus leading to a ow time of(P logP ) for the algorithm on this instance of n = 32 logP + 4P jobs.On the other hand, an optimal solution schedules the job of size P22i released at time ri

Page 51: Scheduling and Load Balancing

50 CHAPTER 4. MULTIPROCESSOR SCHEDULING WITHOUT MIGRATIONfor i = 0; ::; 12 logP � 1 on machine 1 and the two jobs of size P22i+1 released at time ri onmachine 2. Observe that in this schedule machines 1 and 2 are idle at time ri. Thus, thejobs of size 1 are scheduled at their release times on machines 1 and 2 and are completedbefore the next two jobs of size 1 are released. The ow time of the optimal solution is thenO(P ).It follows that the ratio between the ow time of the algorithm and the ow time of theoptimal solution is (logP ) that is also (logn).4.6 DiscussionIn our algorithm jobs are kept in a pool after their release time until they are assigned to amachine. An interesting open problem is to devise an eÆcient algorithm that assigns jobs tomachines at the time of release. Another challenging open problem is to devise a constanto�-line approximation algorithm for optimizing total ow time even if both preemption andmigration are allowed.

Page 52: Scheduling and Load Balancing

Chapter 5Bene�t Maximization for OnlineScheduling5.1 IntroductionIn this chapter we consider the bene�t model for on-line preemptive scheduling. In thismodel jobs arrive to the on-line scheduler at their release time. Each job arrives with itsown processing time and its bene�t function. Recall that the ow time of a job is the timethat passes from its release to its completion. The bene�t function speci�es the bene�tgained for any given ow time: the longer the processing of a job takes, the lower its bene�tis. A scheduler's goal is to maximize the total gained bene�t. We present a constantcompetitive ratio algorithm for that model in the uniprocessor case for bene�t functionsthat do not decrease too rapidly. We also extend the algorithm to the multiprocessor casewhile maintaining constant competitiveness. The multiprocessor algorithm does not usemigration, i.e., preempted jobs continue their execution on the same processor on whichthey were originally processed.5.2 PreliminariesWe use the notation described in the introduction for the on-line preemptive schedulingmodel. In this chapter, each job j, in addition to its arrival and processing time, has anarbitrary monotone non-increasing non-negative bene�t density function Bj(t) for t � wj ,and the bene�t gained is wjBj(fj), where fj is its ow time. Note that the bene�t densityfunction may be di�erent for each job. The goal of the scheduler is to schedule the jobs soas to maximize the total bene�t, i.e., Pj wjBj(fj). Note that the bene�t density functionof di�erent jobs can be uncorrelated and the ratio between their values can be arbitrarily51

Page 53: Scheduling and Load Balancing

52 CHAPTER 5. BENEFIT MAXIMIZATION FOR ONLINE SCHEDULINGlarge. We do, however, restrict each Bj(t) to satisfyBj(t)Bj(t+ wj) � Cfor some �xed constant C. That is, if we delay a job by its processing time then we loseonly a constant factor in its bene�t.5.3 The AlgorithmThe basic idea of the algorithm is to schedule a job whose current bene�t density is as highas possible. The problem with such an algorithm is that it may preempt jobs in order togain a small improvement in the bene�t density and hence delay a large number of jobs.To overcome this problem we schedule a new job only if its bene�t density is signi�cantlyhigher than that of the current job. In addition, we prefer partially processed jobs to non-processed jobs of similar bene�t density. The algorithm combines the above ideas and isformally described below.We begin by de�ning three `storage' locations for jobs. The �rst is the pool wherenew jobs arrive and stay until their processing begins. Once the scheduler decides a jobshould begin running, the job is removed from the pool and pushed onto the stack whereits processing begins. Two di�erent possibilities exist at the end of a job's life cycle. The�rst is a job that is completed and can be popped from the stack. The second is a job thatafter remaining too long in the stack got thrown into the garbage collection. The garbagecollection holds jobs whose processing we prefer to defer. The actual processing will onlyoccur when the system reaches an idle state. However, in the analysis we assume that a jobthrown into the garbage collection is never executed and we gain nothing from it.The job at the top of the stack is the job that is currently running. The other jobs inthe stack are preempted jobs. For each job j, denote by sj the time it enters the stack.We de�ne its breakpoint as the time sj + 2wj . If a job is still running when it reaches itsbreakpoint, it is thrown into the garbage collection. We also de�ne priorities for each jobin the pool and in the stack. The priority of job j at time t is denoted by dj(t). For t � sj,it is Bj(t + wj � rj) and for time t > sj, it is dj = Bj(sj + wj � rj). In other words, thepriority of a job in the pool is its bene�t density if it would have run to completion startingat the current time t. Once it enters the stack its priority becomes �xed, i.e. remains thepriority at time sj.We describe Algorithm ALG1 as an event-driven algorithm. The algorithm takes actionat time t when a new job is released, when the currently running job is completed or whenthe currently running job reaches its breakpoint. If some events happen at the same timewe handle the completion of jobs �rst.� A new job l arrives. If dl(t) > 4dk, where k is the job at the top of the stack or if thestack is empty, push job l into the stack and run it. Otherwise, just add job l to the

Page 54: Scheduling and Load Balancing

5.4. THE ANALYSIS 53pool.� The job at the top of the stack is completed or reaches its breakpoint. Then, pop jobsfrom the top of the stack and insert them into the garbage collection as long as theirbreakpoints have been reached. Unless the stack is empty, let k be the index of thenew job at the top of the stack. Continue running job k only if dj(t) � 4dk for all jin the pool. Otherwise, get the job from the pool with maximum dj(t), push it intothe stack, and run it.� Whenever the machine is idle (i.e., no jobs in the stack or in the pool) run anyuncompleted job from the garbage collection until a new job arrives.We note several facts about this algorithm:Observation 2 Every job enters the stack at some point in time. Then, by time sj +2wj,it is either completed or reaches its breakpoint and gets thrown into the garbage collection.Observation 3 The priority of a job is monotone non-increasing over time. Once the jobenters a stack, its priority remains �xed until it is completed or thrown away. At any timethe priority of each job in a stack is at least 4 times higher than the priority of the job belowit.Observation 4 Whenever the pool is not empty, the machine is not idle, that is, the stackis not empty. Moreover, the priority of jobs in the pool is always at most 4 times higherthan the priority of the currently running job.5.4 The AnalysisWe begin by �xing an input sequence and hence the behavior of the optimal algorithm andthe on-line algorithm. We denote by fOPTj the ow time of job j by the optimal algorithm.As for the on-line algorithm, we only consider the bene�t of jobs which were not throwninto the garbage collection. Denote the set of these jobs by A. So, for j 2 A, let fONj bethe ow time of job j by the on-line algorithm. By de�nition,V OPT =Xj wjBj(fOPTj )and V ON �Xj2AwjBj(fONj ) :We also de�ne the pseudo-bene�t of a job j by wj dj . That is, each job donates a bene�t ofwj dj as if it runs to completion without interruption from the moment it enters the stack.

Page 55: Scheduling and Load Balancing

54 CHAPTER 5. BENEFIT MAXIMIZATION FOR ONLINE SCHEDULINGDe�ne the pseudo-bene�t of the online algorithm asV PSEUDO =Xj wjdj :For 0 � t < wj , we de�ne Bj(t) = Bj(wj). In addition, we partition the set of jobs Jinto two sets, J1 and J2. The �rst is the set of jobs which are still processed by the optimalscheduler at time sj, when they enter the stack. The second is the set of jobs which havebeen completed by the optimal scheduler before they enter the stack.Lemma 5.4.1 For the set J1, Pj2J1 wjBj(fOPTj ) � C � V PSEUDO.Proof: We note the following:wjBj(fOPTj ) � C � wjBj(fOPTj + wj) � C � wjBj(sj � rj + wj) = C � wj djwhere the �rst inequality is by our assumptions on Bj and the second is by our de�nitionof J1. Summing over jobs in J1, we haveXj2J1wjBj(fOPTj ) � C Xj2J1wjdj � C � V PSEUDO:Lemma 5.4.2 For the set J2, Pj2J2 wjBj(fOPTj ) � 4C � V PSEUDO.Proof: For each j 2 J2, we de�ne its `optimal processing times' as�j = ftjjob j is processed by OPT at time tg:Xj2J2wjBj(fOPTj ) = Xj2J2 Zt2�j Bj(fOPTj )dt� Xj2J2 Zt2�j Bj(t� rj)dt� C � Xj2J2 Zt2�j dj(t)dt:According to the de�nition of J2, during the processing of job j 2 J2 by the optimalalgorithm, the on-line algorithm still keeps the job in its pool. By Observation 4 we knowthat the job's priority is not too high; it is at most 4 times the priority of the currentlyrunning job and, speci�cally, at time t 2 �j, its priority is at most 4 times the priority of

Page 56: Scheduling and Load Balancing

5.4. THE ANALYSIS 55the job at the top of the stack in the on-line algorithm. Denote that job by j(t). So,C � Xj2J2 Zt2�j dj(t)dt � 4C � Xj2J2 Zt2�j dj(t)dt� 4C � Zt2[�j dj(t)dt� 4C � Zt dj(t)dt� 4C �Xj2J wj dj = 4C � V PSEUDO:Corollary 5.4.1 V OPT � 5CV PSEUDO.Proof: Combining the two lemmas we get,V OPT = Xj2J1wjBj(fOPTj ) + Xj2J2wjBj(fOPTj )� C � V PSEUDO + 4C � V PSEUDO= 5CV PSEUDO:Lemma 5.4.3 V PSEUDO � 2C � V ONProof: We show a way to divide a bene�t of C � V ON between all the jobs such that theratio between the gain allocated to each job and its pseudo-gain is at most 2.We begin by ordering the jobs so that jobs are preempted only by jobs appearing earlierin the order. This is done by looking at the preemption graph: each node represents ajob and the directed edge (j; k) indicates that job j preempts job k at some time in theon-line algorithm. This graph is acyclic since the edge (j; k) exists only if dj > dk. We usea topological order of this graph in our construction. Jobs can only be preempted by jobsappearing earlier in this order.We begin by assigning a bene�t of wjdj to any job j in A, the set of jobs not throwninto the garbage collection. At the end of the process the bene�t allocated to each job, notnecessarily in A, will be at least 12wj dj .According to the order de�ned above, we consider one job at a time. Assume we arriveat job j. When j 2 A, it already has a bene�t of wj dj assigned to it. Otherwise, job j getsthrown into the garbage collection. This job enters the stack at time sj and leaves it attime sj + 2wj . During that time the scheduler actually processes the job for less than wj

Page 57: Scheduling and Load Balancing

56 CHAPTER 5. BENEFIT MAXIMIZATION FOR ONLINE SCHEDULINGtime. So, job j is preempted for more than wj time. For any job k running while job j ispreempted, we denote by Uk;j the set of times when job j is preempted by job k. Then, wemove a bene�t of jUk;jj � dj from k to j. Therefore, once we �nish with job j, its allocatedbene�t is at least wjdj .How much bene�t is allocated to each job j at the end of the process? We have seen thatbefore moving on to the next job, the bene�t allocated to job j is at least wjdj (whetheror not j 2 A). When job j enters the stack at time sj it preempts several jobs; these jobsappear later in the order. Since jobs are added and removed only from the top of the stack,as long as job j is in the stack, the set of jobs preempted by it remains unchanged. Eachjob k of this set gets a bene�t of at most wjdk from j. However, since all of these jobs existtogether with j in the stack at time sj, the sum of their priorities is at most 12 dj (accordingto Observation 3). So, after moving all the required bene�t, job j is left with at least 12wj dj ,as needed.In order to complete the proof,V PSEUDO = Xj wj dj = 2Xj 12wjdj� 2Xj2Awjdj� 2CXj2AwjBj(sj � rj + 2wj)� 2CXj2AwjBj(fONj )� 2C � V ON :Theorem 5.4.1 Algorithm ALG1 is 10C2 competitive.Proof: By combining the previous lemmas, we conclude thatV ON � V PSEUDO2C � V OPT10C2 :5.5 Multiprocessor SchedulingWe extend Algorithm ALG1 to the multiprocessor model. In this model, the algorithmholds m stacks, one for each machine, as well as m garbage collections. Jobs not completed

Page 58: Scheduling and Load Balancing

5.5. MULTIPROCESSOR SCHEDULING 57by their deadline get thrown into the corresponding garbage collection. Their processingcan continue later when the machine is idle. As before, we assume we get no bene�t fromthese jobs. The multiprocessor Algorithm ALG2 is as follows:� A new job l arrives. If there is a machine such that dl(t) > 4dk where k is the jobat the top of its stack or its stack is empty, push job l into that stack and run it.Otherwise, just add job l to the pool.� The job at the top of a stack is completed or reaches its breakpoint. Then, pop jobsfrom the top of that stack as long as their breakpoints have been reached. Unless thestack is empty, let k be the index of the new job at the top of the stack. Continuerunning job k only if dj(t) � 4dk for all j in the pool. Otherwise, get the job fromthe pool with maximum dj(t), push it into that stack, and run it.� Whenever a machine is idle (i.e., no jobs in its stack or in the pool) run any uncom-pleted job from its garbage collection until a new job arrives.We de�ne J1 and J2 in exactly the same way as in the uniprocessor case.Lemma 5.5.1 For the set J1, Pj2J1 wjBj(fOPTj ) � C � V PSEUDO.Proof: Since the proof of Lemma 5.4.1 used the de�nition of J1 separately for each job, itremains true in the multiprocessor case as well.The following lemma extends Lemma 5.4.2 to the multiprocessor case:Lemma 5.5.2 For the set J2, Pj2J2 wjBj(fOPTj ) � 4C � V PSEUDO.Proof: For each j 2 J2, we de�ne its `optimal processing times' by machine i as�j;i = ftjjob j is processed by OPT on machine i at time tg:Xj2J2wjBj(fOPTj ) = Xj2J2 X1�i�m Zt2�j;i Bj(fOPTj )dt� Xj2J2 X1�i�m Zt2�j;i Bj(t� rj)dt� C � Xj2J2 X1�i�m Zt2�j;i dj(t)dt:According to the de�nition of J2, during the processing of job j 2 J2 by the optimalalgorithm, the on-line algorithm still keeps the job in its pool. By Observation 4 we know

Page 59: Scheduling and Load Balancing

58 CHAPTER 5. BENEFIT MAXIMIZATION FOR ONLINE SCHEDULINGthat the job's priority is not too high; it is at most 4 times the priority of the currentlyrunning jobs and, speci�cally, at time t for machine i such that t 2 �j;i, its priority is atmost 4 times the priority of the job at the top of stack i in the on-line algorithm. Denotethat job by j(t; i). So,C � Xj2J2 X1�i�m Zt2�j;i dj(t)dt � 4C �Xj2J2 X1�i�m Zt2�j;i dj(t;i)dt� 4C � X1�i�m Zt2[�j;i dj(t;i)dt� 4C � X1�i�m Zt dj(t;i)dt� 4C �Xj2J wj dj = 4C � V PSEUDO:Lemma 5.5.3 V PSEUDO � 2C � V ON .Proof: By using Lemma 5.4.3 separately on each machine we obtain the same result for themultiprocessor case.Combining all the results together we getTheorem 5.5.1 Algorithm ALG2 for the multiprocessor case is 10C2 competitive.5.6 DiscussionAlthough a constant competitive algorithm is a signi�cant improvement, some kind of lowerbound is still missing. The lower bound should demonstrate the relation between thediÆculty of the problem and the ratio C. Moreover, a more careful analysis of the algorithmsmight provide a better competitive ratio.

Page 60: Scheduling and Load Balancing

Chapter 6The Unsplittable Flow Problem6.1 IntroductionIn this chapter we consider the three variants of the unsplittable ow problem (UFP ). Weare given a directed or undirected graph G = (V;E), jV j = n, jEj = m, a capacity functionu on its edges and a set of l terminal pairs of vertices (sj ; tj) with a demand dj and pro�trj . A feasible solution is a subset S of the terminal pairs and a single ow path for eachsuch pair such that the capacity constraints are fully met. The objective is to maximize thetotal pro�t of the satis�ed terminal pairs.Both before and after the O(pm) approximation algorithm for classical UFP in [22],there were attempts to achieve the same approximation ratio using combinatorial methods.Up to now however, these were found only for restricted versions of the problem [47, 37]and were not optimal. In this chapter we present a combinatorial algorithm that notonly achieves the O(pm) result for classical UFP but is also the �rst strongly polynomialalgorithm for that problem.Recall that the extended UFP is the case where both demands and capacities arearbitrary (speci�cally, some demands might be higher than some capacities). Due to itscomplexity, not many results addressed it. We improve the best approximation ratio througha strongly polynomial algorithm. By proving a lower bound for the extended UFP overdirected graphs we infer that this case is really harder than the classical UFP . Speci�cally,for large demands we show that unless P = NP it is impossible to approximate extendedUFP better than O(m1��) for any � > 0.We now consider the K-bounded UFP case, that is, the case where the maximumdemand is at most 1K the minimum edge capacity. Recall that for K < log n, previousalgorithms achieved an approximation ratio of O(Kn 1K�1 ). We improve the result to astrongly polynomial O(Kn 1K ) approximation algorithm which, as a special case, is a O(pn)approximation algorithm for the half disjoint case. Since this ratio is better than the59

Page 61: Scheduling and Load Balancing

60 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEM(m1=2��) lower bound for classical UFP , we achieve a separation between classical UFPand K-bounded UFP for K � 3 (this does not imply a separation for K = 2 since the lowerbound is shown using instances wherem = �(n)). The improvement is achieved by splittingthe requests into a low demand set and a high demand set. The sets are treated separatelyby algorithms similar to those of [8] where in the case of high demands the algorithm hasto be slightly modi�ed. We would like to note that in our approximation ratios involving n,we can replace n with D where D is an upper bound on the longest path ever used (whichis obviously at most n).As a by-product of our methods, we provide online algorithms for UFP . Here, thenetwork is known but requests arrive one by one and a decision has to be made withoutknowing which requests follow. We show on-line algorithms whose competitive ratio issomewhat worse than that of the o�-line algorithms. We also show that one of our algorithmsis optimal in the on-line setting by slightly improving a lower bound of [8].We conclude this introduction with a short summary of the main results in this chapter.We denote by dmax the maximum demand and by umin the minimum edge capacity.� Classical UFP (dmax � umin) - Strongly polynomial O(pm) approximation algo-rithm.� Extended UFP (arbitrary dmax, umin) - Strongly polynomial O(pm log(2 + dmaxumin ))approximation algorithm; A lower bound of (m1��) and of (m 12��qlog(2 + dmaxumin ))for directed graphs.� Bounded UFP (dmax � 1Kumin) - Strongly polynomial O(Kn 1K ) approximation algo-rithm.6.2 PreliminariesLet G = (V;E), jV j = n, jEj = m, be a (possibly directed) graph and a capacity functionu : E ! R+. An input request is a quadruple (sj; tj ; dj ; rj) where fsj; tjg is the source-sink terminal pair, dj is the demand and rj is the pro�t. The input is a set of the abovequadruples for j 2 T = f1; :::; lg. Let D be a bound on the length of any routing path; notethat D is at most n.We denote by umin (umax) the minimum (maximum) edge capacity in the graph. Sim-ilarly, we de�ne dmin, dmax, rmin and rmax to be the minimum/maximum demand/pro�tamong all input requests. We de�ne two functions on sets of requests, S � T :r(S) =Xj2S rj d(S) =Xj2S djA feasible solution is a subset P � T and a route Pj from sj to tj for each j 2 P subjectto the capacity constraints, i.e., the total demand routed through an edge is bounded by

Page 62: Scheduling and Load Balancing

6.3. ALGORITHMS FOR UFP 61the its capacity. Some of our algorithms order the requests so we will usually denote byLj(e) the relative load of edge e after routing request j, that is, the sum of demands routedthrough e divided by u(e). Without loss of generality, we assume that any single requestcan be routed. That is possible since we can just ignore unroutable requests. Note thatthis is not the dmax � umin assumption made in classical UFP .Before describing the various algorithms, we begin with a simple useful lemma:Lemma 6.2.1 Given a sequence fa1; :::; ang, a non-increasing non-negative sequence fb1; :::; bngand two sets X;Y � f1; :::; ng, let Xi = X \ f1; :::; ig and Y i = Y \ f1; :::; ig. If for every1 � i � n Xj2Xi aj > � Xj2Y i ajthen Xj2X ajbj > �Xj2Y ajbjProof: Denote bn+1 = 0. Since bj � bj+1 is non-negative,Xj2X ajbj = Xj2X aj nXi=j(bi � bi+1)= Xi=1;:::;n(bi � bi+1) Xj2Xi aj> � Xi=1;:::;n(bi � bi+1) Xj2Y i aj= �Xj2Y aj nXi=j(bi � bi+1)= �Xj2Y ajbjUsing this lemma we show that algorithms that maximize the total demand also maxi-mize the total pro�t if only they consider the requests in a nonincreasing order of pro�t todemand ratio.6.3 Algorithms for UFP6.3.1 Algorithm for Classical UFPIn this section we show a simple algorithm for classical UFP (the case in which dmax �umin). The algorithm's approximation ratio is the same as the best currently known algo-

Page 63: Scheduling and Load Balancing

62 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMrithm. Later, we show that unlike previous algorithms, this algorithm can be easily madestrongly polynomial and that it can even be used in the extended case.We split the set of requests T into two disjoint sets. The �rst, T1, consists of requestsfor which dj � umin=2. The rest of the requests are in T2. For each request j and a givenpath P from sj to tj de�ne F (j; P ) = rjdjPe2P 1u(e) , a measure of the pro�t gained relativeto the added network load.Given a set of requests, we use simple bounds on the values of these F (j; P ). The lowerbound, denoted �min, is de�ned as rminn and is indeed a lower bound on F (j; P ) since Pcannot be longer than n edges and the capacity of its edges must be at least dj. The upperbound, denoted �max, is de�ned as rmaxumaxdmin and is clearly an upper bound on F (j; P ).PROUTErun Routine2(T1) and Routine2(T2) and choose the better solutionRoutine2(S):foreach k from blog�minc to dlog�maxerun Routine1(2k; S) and choose the best solutionRoutine1(�; S):sort the requests in S according to a non-increasing order of rj=djforeach j 2 S in the above orderif 9 path P from sj to tj s.t. F (j; P ) > � and 8e 2 P;Lj�1(e) + dju(e) � 1then route the request on P and for e 2 P set Lj(e) = Lj�1(e) + dju(e)else reject the requestTheorem 6.3.1 Algorithm PROUTE is an O(pm) approximation algorithm for classicalUFP .Proof: First, we look at the running time of the algorithm. The number of iterations donein Routine2 is: log �max�min = log(nrmaxrmin umaxdmin )which is polynomial. Routine1 looks for a non over owing path P with F (j; P ) > �. Thelatter condition is equivalent to Pe2P 1u(e) < rjdj� and thus a shortest path algorithm can beused.Consider an optimal solution routing requests in Q � T . For each j 2 Q let Qj be theroute chosen for j in the optimal solution. The total pro�t of either Q \ T1 or Q \ T2 isat least r(Q)2 . Denote that set by Q0 and its index by i0 2 f1; 2g, that is, Q0 = Q \ Ti0 .Now consider the values given to � in Routine2 and let �0 = 2k0 be the highest such thatr(fj 2 Q0jF (j;Qj) > �0g) � r(Q)=4. It is clear that such an �0 exists. From now on we

Page 64: Scheduling and Load Balancing

6.3. ALGORITHMS FOR UFP 63limit ourselves to Routine1(�0; i0) and show that a good routing is obtained by it. Denoteby P the set of requests routed by Routine1(�0; i0) and for j 2 P denote by Pj the pathchosen for it.Let Q0high = fj 2 Q0jF (j;Qj) > �0g and Q0low = fj 2 Q0jF (j;Qj) � 2�0g be sets ofhigher and lower `quality' routes in Q0. Note that the sets are not disjoint and that thetotal pro�t in each of them is at least r(Q)4 by the choice of �0. From the de�nition of F ,r(Q0low) = Xj2Q0low F (j;Qj) Xe2Qj dju(e) � 2�0 Xj2Q0low Xe2Qj dju(e)� 2�0 Xj2Q Xe2Qj dju(e)= 2�0Xe Xj2Qje2Qj dju(e)� 2�0Xe 1 = 2m�0where the last inequality is true since an optimal solution cannot over ow an edge. There-fore, r(Q) � 8m�0:Now let Eheavy = fe 2 EjLl(e) � 14g be a set of the heavy edges after the completionof Routine1(�0; i0). We consider two cases. The �rst is when jEheavy j � pm. According tothe description of the algorithm, F (j; Pj) > �0 for every j 2 P. Therefore,r(P) = Xj2P F (j; Pj) Xe2Pj dju(e)� �0 Xj2P Xe2Pj dju(e)= �0Xe Xjje2Pj dju(e)= �0Xe Ll(e) � 14pm�0where the last inequality follows from the assumption that more than pm edges are loadedmore than fourth their capacity. By combining the two inequalities we get:r(Q)r(P) � 32pm = O(pm)which completes the �rst case.From now on we consider the second case where jEheavy j < pm. Denote by R =Q0high n P . We compare the pro�t given by our algorithm to that found in R by using

Page 65: Scheduling and Load Balancing

64 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMLemma 6.2.1. Since rjdj is a non increasing sequence, it is enough to bound the total demandrouted in pre�xes of the two sets. For that we use the notation Rk = R \ f1; :::; kg andPk = P \ f1; :::; kg for k = 1; :::; l. For each request j 2 Rk the algorithm cannot �nd anyappropriate path. In particular, the path Qj is not chosen. Since j 2 Q0high, F (j;Qj) > �0and therefore the reason the path is not chosen is that it over ows one of the edges. Denotethat edge by ej and by Ek = fej jj 2 Rkg.Lemma 6.3.1 Ek � EheavyProof: Let ej 2 Ek be an edge with j 2 Rk, a request corresponding to it. We claim thatwhen the algorithm fails �nding a path for j, Lj(ej) � 14 . For the case i0 = 1, the claim isobvious since the demand dj � umin=2 and in particular, dj � u(ej)=2. Thus, the load of ejmust be higher than u(ej)=2 for the path Qj to over ow it. For the case i0 = 2, we know thatumin=2 < dj � umin. In case u(ej) > 2umin, the only way to over ow it with demands of sizeat most dmax � umin is when the edge is loaded at least u(ej)�umin � u(ej)=2. Otherwise,u(ej) � 2umin and since dj � umin � u(e) we know that the edge cannot be empty. Sincewe only route requests from T2 the edge's load must be at least umin=2 � u(ej)=4.Since each request inRk is routed through an edge of Ek in the optimal solution, d(Rk) �Pe2Ek u(e). The highest capacity edge f 2 Ek is loaded more than fourth its capacity sinceit is in Eheavy and therefore d(PK) � u(f)4 . By Lemma 6.3.1, jEkj � jEheavy j < pm andhence, d(Rk) < pm � u(f) � 4pm � d(Pk):We use Lemma 6.2.1 by combining the inequality above on the ratio of demands andthe nonincreasing sequence rjdj . This yieldsXj2R rjdj dj � 4pmXj2P rjdj dj;or, r(R) � 4pm � r(P):Since Q0high = R [ P, r(Q0high) = r(R) + r(P) � (1 + 4pm)r(P):Recall that r(Q0high) � r(Q)=4 and thereforer(Q)r(P) � 4 + 16pm = O(pm)

Page 66: Scheduling and Load Balancing

6.3. ALGORITHMS FOR UFP 656.3.2 Strongly Polynomial AlgorithmRoutine1 is strongly polynomial. Routine2 however calls it log �max�min times. Therefore, it ispolynomial but still not strongly polynomial. We add a preprocessing step whose purposeis to bound the ratio �max�min . Recall that l denotes the number of requests.SPROUTE(T ):run Routine3(T1) and Routine3(T2) and choose the better solutionRoutine3(S):For each edge such that u(e) > l � dmax set u(e) to be l � dmax.Throw away requests whose pro�t is below rmaxl .Take the better out of the following two solutions:Route all requests in Stiny = fj 2 Sjdj � uminl g on any simple path.Run Routine2(S n Stiny).Theorem 6.3.2 Algorithm SPROUTE is a strongly polynomial O(pm) approximationalgorithm for classical UFP .Proof: Consider an optimal solution routing requests in Q � S. Since the demand of asingle request is at most dmax, the total demand routed through a given edge is at mostl � dmax. Therefore, Q is still routable after the �rst preprocessing phase. The total pro�tof requests whose pro�t is lower than rmaxl is rmax. In case r(Q) > 2rmax, removing theserequests still leaves the set Q0 whose total pro�t is at least r(Q)� rmax � r(Q)2 . Otherwise,we take Q0 to be the set containing the request of highest pro�t. Then, r(Q0) is rmax � r(Q)2 .All in all, after the two preprocessing phases we are left with an UFP instance for whichthere is a solution Q0 whose pro�t is at least r(Q)2 .Assume that the total pro�t in Q0 \ Stiny is at least r(Q)4 . Since the requests in Stinyhave a demand of at most uminl and there are at most l of them, they can all be routed onsimple paths and the pro�t obtained is at least r(Q)4 . Otherwise, the pro�t in Q0 nStiny is atleast r(Q)4 and since algorithm PROUTE is an O(pm) approximation algorithm, the pro�twe obtain is also within O(pm) of r(Q).The preprocessing phases by themselves are obviously strongly polynomial. Recall thatthe number of iterations performed by Routine2 is log(n rmaxrmin umaxdmin ). The ratio of pro�ts isat most l by the second preprocessing phase. The �rst preprocessing phase limits umax tok � dmax. So, the number of iterations is at most log(nl2 dmaxdmin ). In case S = T1, dmax � umin2and dmin � uminl since tiny requests are removed. For S = T2, dmax � umin and dmin �umin=2. We end up with at most O(log n+ log l) iterations which is strongly polynomial.

Page 67: Scheduling and Load Balancing

66 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEM6.3.3 Algorithm for Extended UFPIn this section we show that the algorithm can be used for the extended case in whichdemands can be higher than the lowest edge capacity.Instead of using just two sets in SPROUTE, we de�ne a partition of the set of requestsT into 2+maxfdlog dmax=umine; 0g disjoint sets. The �rst, T1 consists of requests for whichdj < umin=2. The set Ti for i > 1 is of requests for which 2i�3umin < dj � 2i�2umin. Thealgorithm is as follows:ESPROUTE(T ):for any 1 � i � 2 +maxfdlog dmax=umine; 0g such that Ti is not emptyrun Routine3(Ti) on the resulting graphchoose the best solution obtainedTheorem 6.3.3 Algorithm ESPROUTE is a strongly polynomial O(pm log(2 + dmaxumin ))approximation algorithm for extended UFP .Proof: The proof of Theorem 6.3.1 and of Theorem 6.3.2 hold also for the extended case.The only part which has to be proved is Lemma 6.3.1. The following replaces the lemma:Lemma 6.3.2 Ek � EheavyProof: Let ej 2 Ek be an edge with j 2 Rk, a request corresponding to it. We claim thatwhen the algorithm fails �nding a path for j, Lj(ej) � 14 . For the case i0 = 1, the claim isobvious as before. For the case i0 > 1, we know that 2i0�3umin < dj � 2i0�2umin. In caseu(ej) > 2i0�1umin, the only way to over ow it with demands of size at most 2i0�2umin iswhen the edge is loaded at least u(ej)� 2i0�2umin � u(ej)=2. Otherwise, u(ej) � 2i0�1uminand since j is routed through this edge in the optimal solution dj � u(ej). Therefore, theedge cannot be empty. Since we only route requests from Ti0 the edge's load must be atleast 2i0�3umin � u(ej)=4.The number of iterations ESPROUTE performs is at most l since we ignore empty Ti's.For T1, the number of iterations of Routine2 is the same as in SPROUTE. For a set Ti,i > 1, the number of iterations of Routine2 is log(n rmaxrmin umaxdmin ). As before, the preprocessingof Routine3 reduces this number to log(nl2 dmaxdmin ). Since the ratio dmaxdmin is at most 2 in eachTi, we conclude that ESPROUTE is strongly polynomial.6.4 Algorithms for K-bounded UFPIn the previous section we considered the classical UFP in which dmax � umin. We alsoextended the discussion to extended UFP . In this section we show better algorithms for

Page 68: Scheduling and Load Balancing

6.4. ALGORITHMS FOR K-BOUNDED UFP 67K-bounded UFP in which dmax � 1Kumin where K � 2.6.4.1 Algorithms for Bounded DemandsIn this section we present two algorithm for bounded UFP . The �rst deals with the case inwhich the demands are in the range [uminK+1 ; uminK ]. As a special case, it provides an O(pn)approximation algorithm for the half-disjoint paths problem where edge capacities are allthe same and the demands are exactly half the edge capacity. The second is an algorithmfor the K-bounded UFP where demands are only bounded by uminK from above.EKROUTE(T ):� 2Dsort the requests in T according to a non-increasing order of rj=djforeach j 2 T in the above orderif 9 a path P from sj to tj s.t.Pe2P (�Lj�1(e) � 1) < Dthen route the request on P and for e 2 P set Lj(e) = Lj�1(e) + 1bK�u(e)umin celse reject the requestBKROUTE(T ):� (2D)1+ 1K�1sort the requests in T according to a non-increasing order of rj=djforeach j 2 Ti in the above orderif 9 a path P from sj to tj s.t.Pe2P (�Lj�1(e) � 1) < Dthen route the request on P and for e 2 P set Lj(e) = Lj�1(e) + dju(e)else reject the requestNote that algorithm EKROUTE uses a slightly di�erent de�nition of L. This `virtual'relative load allows it to outperform BKROUTE on instances where the demands are inthe correct range.Theorem 6.4.1 Algorithm EKROUTE is a strongly polynomial O(K �D 1K ) approximationalgorithm for UFP with demands in the range [uminK+1 ; uminK ]. Algorithm BKROUTE is astrongly polynomial O(K �D 1K�1 ) approximation algorithm for K-bounded UFP .Proof: The �rst thing to note is that the algorithms never over ow an edge. For the �rstalgorithm, the demands are at most uminK and the only way to exceed an edge capacity is toroute request j through an edge e that holds at least bK�u(e)umin c requests. For such an edge,

Page 69: Scheduling and Load Balancing

68 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMLj�1(e) � 1 and �Lj�1(e) � 1 � � � 1 � D. For the second algorithm, it is suÆcient toshow that in case Lj�1(e) > 1 � 1K for some e then �Lj�1(e) � 1 � D; that is true since�Lj�1(e)�1 � ((2D)1+ 1K�1 )1� 1K �1 = 2D�1 � D. Therefore, the algorithms never over owan edge.Now we lower bound the total demand accepted by our algorithms. We denote by Qthe set of requests in the optimal solution and by P the requests accepted by either of ouralgorithm. For j 2 Q denote by Qj the path chosen for it in the optimal solution and forj 2 P let Pj be the path chosen for it by our algorithm. We consider pre�xes of the inputso let Qk = Q\ f1; :::; kg and Pk = P \ f1; :::; kg for k = 1; :::; l. We prove thatd(Pk) � Pe u(e)(�Lk(e) � 1)6KD� 1K :The proof is by induction on k and the induction base is trivial since the above expressionis zero. Thus, it is suÆcient to show that for an accepted request jPe2Pj u(e)(�Lj (e) � �Lj�1(e))6KD� 1K � dj :Note that for any e 2 Pj , Lj(e) � Lj�1(e) � 1K for both algorithms. In addition, for bothalgorithms Lj(e) � Lj�1(e) � 3 dju(e) where the factor 3 is only necessary for EKROUTEwhere the virtual load is higher than the actual increase in relative load. The worst case iswhen K = 2, u(e) = (1:5 � �)umin and dj = (13 + �)umin: the virtual load increases by 12whereas dju(e) is about 29 . Looking at the exponent,�Lj(e) � �Lj�1(e) = �Lj�1(e)(�Lj(e)�Lj�1(e) � 1)= �Lj�1(e)((� 1K )K(Lj(e)�Lj�1(e)) � 1)� �Lj�1(e)� 1KK(Lj(e)� Lj�1(e))� �Lj�1(e)� 1K 3K dju(e)where the �rst inequality is due to the simple relation xy � 1 � xy for 0 � y � 1; 0 � x andthat for e 2 Pj, Lj(e) � Lj�1(e) � 1K . Therefore,Xe2Pj u(e)(�Lj (e) � �Lj�1(e)) � Xe2Pj �Lj�1(e)� 1K 3Kdj= 3K� 1K dj Xe2Pj �Lj�1(e)= 3K� 1K dj(Xe2Pj(�Lj�1(e) � 1) + jPj j)� 3K� 1K (D +D)dj= 6KD� 1K dj

Page 70: Scheduling and Load Balancing

6.4. ALGORITHMS FOR K-BOUNDED UFP 69where the last inequality holds since the algorithm routes the request through Pj and thelength of Pj is at most D.The last step in the proof is to upper bound the total demand accepted by an optimalalgorithm. Denote the set of requests rejected by our algorithm and accepted by the optimalone by Rk = Qk nP k. For j 2 Rk, we know that Pe2Qj (�Lj�1(e)� 1) � D since the requestis rejected by our algorithm. Hence,D � d(Rk) � Xj2Rk Xe2Qj dj(�Lj�1(e) � 1)� Xj2Rk Xe2Qj dj(�Lk(e) � 1)= Xe Xj2Rkje2Qj dj(�Lk(e) � 1)= Xe (�Lk(e) � 1) Xj2Rkje2Qj dj� Xe (�Lk(e) � 1)u(e);where the last inequality holds since the optimal algorithm cannot over ow an edge.By combining the two inequalities shown above,d(Qk) � d(Pk) + d(Rk) � d(Pk) + d(Pk)6KDD � 1K = (1 + 6K� 1K )d(Pk)The algorithm followed a non-increasing order of rjdj and by Lemma 6.2.1 we obtain thesame inequality above for pro�ts. So, the approximation ratio of the algorithm is1 + 6K� 1K = O(K � � 1K )which, by assigning the appropriate values of �, yields the desired results.6.4.2 A Combined AlgorithmIn this section we combine the two algorithms presented in the previous section: the algo-rithm for demands in the range [uminK+1 ; uminK ] and the algorithm for theK-bounded UFP . Theresult is an algorithm for the K-bounded UFP with an approximation ratio of O(K �D 1K ).We de�ne a partition of the set of requests T into two sets. The �rst, T1, includes allthe requests whose demand is at most 1K+1 . The second, T2, includes all the requests whosedemand is more than 1K+1 and at most 1K .CKROUTE(T ):Take the best out of the following two possible solutions:Route T1 by using BKROUTE and reject all requests in T2Route T2 by using EKROUTE and reject all requests in T1

Page 71: Scheduling and Load Balancing

70 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMTheorem 6.4.2 Algorithm CKROUTE is a strongly polynomial O(K �D 1K ) approximationalgorithm for K-bounded UFP .Proof: Let Q denote an optimal solution in T . Since BKROUTE is used with demandsbounded by 1K+1 its approximation ratio is O(KD 1K ). The same approximation ratio isgiven by EKROUTE. Either T1 or T2 have an optimal solution whose pro�t is at leastr(Q)2 and therefore we obtain the claimed approximation ratio.6.5 Lower BoundsIn this section we show that in cases where the demands are much larger than the minimumedge capacity UFP becomes very hard to approximate, namely, (m1��) for any � > 0. Wealso show how di�erent demand values relate to the approximability of the problem. Thelower bounds are for directed graphs only.Theorem 6.5.1 [31] The following problem is NPC:2DIRPATH:INPUT: A directed graph G = (V;E) and four nodes x; y; z; w 2 VQUESTION: Are there two edge disjoint directed paths,one from x to y and the other from z to w in G ?Theorem 6.5.2 For any � > 0, extended UFP cannot be approximated better than (m1��).Proof: For a given instance A of 2DIRPATH with jAj edges and a small constant �, weconstruct an instance of extended UFP composed of l copies of A, A1; A2; :::; Al wherel = jAjd 1� e. The instance Ai is composed of edges of capacity 2l�i. A special node y0 isadded to the graph. Two edges are added for each Ai, (yi�1; xi) of capacity 2l�i � 1 and(yi�1; zi) of capacity 2l�i. All l requests share y0 as a source node. The sink of request1 � i � l is wi. The demand of request i is 2l�i and its pro�t is 1. The above structure isshown in the following �gure for the hypothetical case where l = 4. Each diamond indicatesa copy of A with x; y; z; w being its left, right, top and bottom corners respectively. Thenumber inside each diamond indicates the capacity of A's edges in this copy.87 8 43 4 21 2 10 1y0 w1 w2 w3 w4Figure 6.1: The UFP instance for the case l = 4

Page 72: Scheduling and Load Balancing

6.5. LOWER BOUNDS 71We claim that for a given Y ES instance of 2DIRPATH the maximal pro�t gained fromthe extended UFP instance is l. We route request 1 � i � l through [y0; x1; y1; x2; y2,...,yi�1; zi; wi]. Note that the path from xj to yj and from zj to wj is a path in Aj given bythe Y ES instance.For a NO instance, we claim that at most one request can be routed. That is becausethe path chosen for a request i ends at wi. So, it must arrive from either zi or xi. The onlyedge entering xi is of capacity 2l�i � 1 so zi is the only option. The instance Ai is a NOinstance of capacity 2l�i through which a request of demand 2l�i is routed form zi to wi.No other path can therefore be routed through Ai so requests j > i are not routable. Sincei is arbitrary, we conclude that at most one request can be routed through the extendedUFP instance and its pro�t is 1.The gap created is l = jAj 1� and the number of edges is l � (jAj + 2) = O(l1+�). Hence,the gap is (m 11+� ) = (m1��0) and since � is arbitrary we complete the proof.Theorem 6.5.3 For any � > 0 extended UFP with any ratio dmax=umin � 2 cannot beapproximated better than (m 12��qblog(dmaxumin )c).Proof: For a given instance A of 2DIRPATH with jAj edges and a small constant �, weconstruct an instance of extended UFP with the given ratio dmax=umin. We begin withdescribing our basic building block from which the UFP instance will be built. Let Æ < 1lkbe a small constant. The i'th building block, denoted Bi, contains k2+ k(k�1)2 copies of thegraph A with edge capacity 2l�i + kÆ which will be placed for clarity on a two dimensionalgrid. The copies are denoted by A(a;b) where 1 � a � k and 1 � b � 2k � a are twointegers and (a; b) is its position on the grid. There are 2k input nodes and 2k outputnodes. The �rst k input nodes xij, 1 � j � k, are located at (0; j) whereas the nextk input nodes zij , 1 � j � k, are at (0; k + j). The output nodes yij, 1 � j � k, arelocated at (k + 1; j) and zij , 1 � j � k, are at (k � j + 1; 0). The edges are describedby their location on the grid and are all of length one on that grid. A copy of A locatedat (a; b) is connected through its z node to an edge above it (the edge from (a; b + 1) to(a; b)), through its w node to the edge below it, through x to the left edge and throughy to the right edge. For each 1 � j � k there exist k + 1 horizontal edges, ((0; j); (1; j)),((1; j); (2; j)),...,((k; j); (k+1; j)). The capacity of each of these edges is 2l�i. For 1 � j � kwe also add k � j + 1 horizontal edges ((0; k + j); (1; k + j)), ((1; k + j); (2; k + j)),...,((k�j; k+j); (k�j+1; k+j)) and k+j vertical edges ((k�j+1; k+j); (k�j+1; k+j�1)),((k � j + 1; k + j � 1); (k � j + 1; k + j � 2)),...,((k � j + 1; 1); (k � j + 1; 0)). The capacityof each of these edges is 2l�i + jÆ.The UFP instance consists of the l blocks B1, B2,...,Bl. There are k additional nodesdenoted y0j , 1 � j � k, which act as input nodes. For 1 � i � l, 2k connecting edgesof capacity 2l are used, (yi�1j ; xij) and (yi�1j ; zij), 1 � j � k. The request set consists ofrequests denoted r(i;j) for 1 � i � l; 1 � j � k from y0j to wij with demand 2l�i + jÆ. Allrequests are of pro�t 1.

Page 73: Scheduling and Load Balancing

72 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMWe claim that for a given Y ES instance of 2DIRPATH the maximal pro�t gained fromthe extended UFP instance is l �k, that is, all requests can be routed. We route request r(i;j)through [y0j ; x1j ; y1j ; x2j ; y2j ; :::; yi�1j ; zij ; wij ]. Note that the path from xij to yij is a horizontalpath in Bi through k copies of A and the path from zij to wij is a path in Bi going throughthe point (k � j + 1; k + j) and passing 2k � 1 copies of A. The load in Bi on the edges ofthe path from xij to yij is 2l�i�1 + jÆ + 2l�i�2 + jÆ + ::: + 1 + jÆ � 2l�i � 1 + lkÆ � 2l�i.The load in Bi on the edges of the path from zij to wij is 2l�i + jÆ. Therefore, no edge isoverloaded and the total pro�t gained is as claimed.For a NO instance, we claim that at most one request can be routed. Assume requestr(i;j) is routed through the UFP instance. Request r(i;j) is of demand 2l�i + jÆ and bytracing back the request from its sink wij it can be seen that the capacities of the edges aresuch that the request must be routed through a vertical path from (k � j + 1; k + j) to thesink. This immediately implies that any request r(i;j) with i > i cannot be routed since itmust exit Bi through one of the y nodes and thus cross the path of request r(i;j) in one ofthe A junctions. In addition, a request r(i;j) with j < j cannot be routed since the sinkwij is located to the right of the vertical path and thus must cross it as well. By using thetwo observations above we conclude that at most one request can be routed through theextended UFP instance and its pro�t is 1.The ratio dmaxumin created is at most 2l and hence we choose l = blog(dmaxumin )c. In addition,we choose k = jAj1=�. The number of edges used is m = l(3k2 + 4k + (k2 + k(k�1)2 ) � jAj) =O(l � k2 � jAj) = O(l � k2+�). Therefore, the gap created is lk = (m 12+�qblog(dmaxumin )c) andby choosing a small � the proof is completed.6.6 Online Applications6.6.1 Online AlgorithmsSomewhat surprisingly, variants of the algorithms considered so far can be used in theonline setting with slightly worse bounds. For simplicity, we present here an algorithm forthe throughput K-bounded UFP in which rj = dj for every j 2 T .First note that for throughput K-bounded UFP , both EKROUTE and BKROUTEcan be used as online deterministic algorithms since sorting the requests becomes unneces-sary. By splitting T into T1 and T2 as in CKROUTE we can combine the two algorithms:

Page 74: Scheduling and Load Balancing

6.6. ONLINE APPLICATIONS 73ONLINECKROUTE(T ):Choose one of the two possible routing methods below with equal probabilities:Route T1 by using BKROUTE and reject all requests in T2Route T2 by using EKROUTE and reject all requests in T1Theorem 6.6.1 Algorithm ONLINECKROUTE is an O(K � D 1K ) competitive onlinealgorithm for throughput K-bounded UFP .Proof: The expected value of the total accepted demand of the algorithm for any giveninput is the average between the total accepted demands given by the two routing methods.Since each method is O(K �D 1K ) competitive on its part of the input, the theorem follows.6.6.2 Online Lower BoundIn this section we show an (K �n 1K ) lower bound for deterministic on-line algorithms in thethroughput K-bounded UFP . This matches the upper bound of EKROUTE and slightlyimproves the previously known lower bound of (n 1K ) [8]. The lower bound is proved overa line network of length n. For simplicity, we assume that n = rK for some integer r.Otherwise, we can just use the largest r such that rK � n and prove the lower bound overa part of the line. All the requests are of demand 1K and the edge capacities are all 1.The lower bound can be represented by a subtree of a tree of heightK with an outdegreeof n 1K . Each node in the subtree corresponds to one or more requests over some interval.The root corresponds to requests over the interval [0; n]. Node j in level 0 � i � Kcorresponds to the interval [rK�i � j; rK�i � (j + 1)]. Note that the segments correspondingto a node's children are a partition of its own segment.The lower bound is constructed together with its corresponding subtree by a DFS traver-sal of the tree. The traversal begins at the tree's root. At each node, the algorithm is givenat most K requests over the interval corresponding to the current node. If the algorithmdoes not accept any of the K requests, the node's children are not traversed and the nextnode in the DFS traversal is visited. Otherwise, once the algorithm accepts a request, westart traversing each of its children recursively.Note that in case we arrive to a leaf in the tree, the algorithm cannot accept any requestsover its interval. That is because its interval is contained in K other accepted intervals; onefor each of the node's ancestors. Therefore, the sequence of requests is well de�ned.We need the following simple lemma for trees:Lemma 6.6.1 For a tree in which the out-degree of each node is either zero (a leaf) orÆ > 1, the number of leaves is at least Æ� 1 times larger than the number of internal nodes.

Page 75: Scheduling and Load Balancing

74 CHAPTER 6. THE UNSPLITTABLE FLOW PROBLEMProof: We use induction on the tree growing from the root up. A tree with just one node(leaf) has the required property. Then, a tree that grows is a replacement of a leaf in aninternal node and Æ leaves. Therefore, the number of leaves has grown by Æ � 1 while thenumber of internal nodes has grown by 1. The required ratio is maintained.Theorem 6.6.2 The competitive ratio of any deterministic on-line algorithm for the K-bounded UFP is at least (K � n 1K ).Proof: The algorithm's value from the input described above is the number of internalnodes in the subtree. That is because the algorithm accepts one request from each internalnode but no requests from the leaves. A better solution for the same input is to acceptall the requests represented by the leaves of the subtree. In that case, the value is Ktimes the number of leaves since each leaf corresponds to K intervals. That is an allowedassignment since the intervals corresponding to the leaves do not intersect. By comparingthe two solutions and using the previous lemma, we obtain the stated lower bound on thecompetitive ratio.6.7 DiscussionUsing combinatorial methods we showed algorithms for all three variants of the UFP prob-lem. We improve previous results and provide the best approximations for UFP by usingstrongly polynomial algorithms. Due to their relative simplicity we believe that furtheranalysis should lead to additional performance guarantees such as non linear bounds. Also,the algorithms might perform better over speci�c networks. An interesting open problemto consider is �nding better results for the half-disjoint case and for the undirected case.No known lower bounds exist for these two cases and the upper bounds are relatively high.We conjecture that a considerably better upper bound exists but there is no compellingevidence to believe that this is indeed the case.

Page 76: Scheduling and Load Balancing

Bibliography[1] F. Afrati, E. Bampis, C. Chekuri, D. Karger, C. Kenyon, S. Khanna, I. Milis,M. Queyranne, M. Skutella, C. Stein, and M. Sviridenko. Approximation schemesfor minimizing average weighted completion time with release dates. In Proceedings ofthe 40th Annual IEEE Symposium on Foundations of Computer Science, pages 32{43,October 1999.[2] S. Albers. Better bounds for on-line scheduling. In Proc. 29th ACM Symp. on Theoryof Computing, pages 130{139, 1997.[3] A. Armon. On Approximation and On-Line Algorithms for Load Balancing of Tempo-rary Tasks. PhD thesis, Tel-Aviv University, 2000.[4] A. Armon, Y. Azar, L. Epstein, and O. Regev. Temporary tasks assignment resolved.Submitted, 2000.[5] J. Aspnes, Y. Azar, A. Fiat, S. Plotkin, and O. Waarts. On-line routing of virtualcircuits with applications to load balancing and machine scheduling. Journal of theACM, 44(3):486{504, 1997. Also in Proc. 25th ACM STOC, 1993, pp. 623-631.[6] J. Aspnes, Y. Azar, A. Fiat, S. Plotkin, and O. Waartz. On-line machine schedulingwith applications to load balancing and virtual circuit routing. In Proc. 25th ACMSymp. on Theory of Computing, pages 623{631, May 1993.[7] B. Awerbuch, Y. Azar, S. Leonardi, and O. Regev. Minimizing the ow time withoutmigration. In Proc. 31st ACM Symp. on Theory of Computing, pages 198{205, 1999.[8] B. Awerbuch, Y. Azar, and S. Plotkin. Throughput-competitive online routing. In34th IEEE Symposium on Foundations of Computer Science, pages 32{40, 1993.[9] B. Awerbuch, Y. Azar, and O. Regev. Maximizing job bene�ts on-line. In 3rd In-ternational Workshop on Approximation Algorithms for Combinatorial OptimizationProblems(APPROX), pages 42{50, 2000.[10] Y. Azar. On-line load balancing. In A. Fiat and G. Woeginger, editors, Online Algo-rithms - The State of the Art, chapter 8, pages 178{195. Springer, 1998.[11] Y. Azar, A. Z. Broder, and A. R. Karlin. On-line load balancing. Theoretical ComputerScience, 130(1):73{84, 1994. Also in Proc. 33rd IEEE FOCS, 1992, pp. 218-225.75

Page 77: Scheduling and Load Balancing

76 BIBLIOGRAPHY[12] Y. Azar and L. Epstein. On-line load balancing of temporary tasks on identical ma-chines. In 5th Israeli Symp. on Theory of Computing and Systems, pages 119{125,1997.[13] Y. Azar, B. Kalyanasundaram, S. Plotkin, Kirk R. Pruhs, and Orli Waarts. On-lineload balancing of temporary tasks. Journal of Algorithms, 22(1):93{110, 1997. Also inProc. WADS'93, pp. 119-130.[14] Y. Azar, J. Naor, and R. Rom. The competitiveness of on-line assignments. Journalof Algorithms, 18(2):221{237, 1995. Also in Proc. 3rd ACM-SIAM SODA, 1992, pp.203-210.[15] Y. Azar and O. Regev. Strongly polynomial algorithms for the unsplittable ow prob-lem. To be presented in IPCO'01.[16] Y. Azar, O. Regev, J. Sgall, and G. Woeginger. O�-line temporary tasks assignment.Theoretical Computer Science. To appear. Also in Proc. 7th Annual European Sympo-sium on Algorithms 1999, pp. 163-171.[17] K.R. Baker. Introduction to Sequencing and Scheduling. Wiley, 1974.[18] Y. Bartal, A. Fiat, H. Karlo�, and R. Vohra. New algorithms for an ancient schedulingproblem. In Proc. 24th ACM Symposium on Theory of Algorithms, pages 51{58, 1992.Also in Journal of Computer and System Sciences (1995) 359-366.[19] Y. Bartal, H. Karlo�, and Y. Rabani. A better lower bound for on-line scheduling.Information Processing Letters, 50:113{116, 1994.[20] S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunathan, L. Rosier, D. Shasha,and F. Wang. On the competitiveness of on-line real-time task scheduling. In IEEEReal-Time Systems Symposium, pages 106{115, 1991.[21] S. Baruah, G. Koren, B. Mishra, A. Raghunathan, L. Rosier, and D. Shasha. On-line scheduling in the presence of overload. In 32nd IEEE Annual Symposium onFoundations of Computer Science, pages 100{110, San Juan, Puerto Rico, 1991.[22] A. Baveja and A. Srinivasan. Approximation algorithms for disjoint paths and relatedrouting and packing problems. To appear in Mathematics ofOperations Research.[23] P. Berman, M. Charikar, and M. Karpinski. A note on on-line load balancing forrelated machines. In 5th annual Workshop on Algorithms and Data Structures, 1997.[24] A. Borodin and R. El-Yaniv. Online Computation and Competitive Analysis. Cam-bridge University Press, 1998.[25] A. Borodin and R. El-Yaniv. Online computation and competitive analysis (cambridgeuniversity press, 1998). SIGACTN: SIGACT News (ACM Special Interest Group onAutomata and Computability Theory), 29, 1998.[26] B. Chen, A. van Vliet, and G. Woeginger. New lower and upper bounds for on-linescheduling. Operations Research Letters, 16:221{230, 1994.

Page 78: Scheduling and Load Balancing

BIBLIOGRAPHY 77[27] B. Chen, A. van Vliet, and G. J. Woeginger. New lower and upper bounds for on-linescheduling. Operations Research Letters, 16:221{230, 1994.[28] J. Du, J. Y. T. Leung, and G. H. Young. Minimizing mean ow time with release timeconstraint. Theoretical Computer Science, 75(3):347{355, 1990.[29] U. Faigle, W. Kern, and G. Turan. On the performance of online algorithms forpartition problems. Acta Cybernetica, 9:107{119, 1989.[30] R. Fleischer and M. Wahl. Online scheduling revisited. In Proceedings of the 8th AnnualEuropean Symposium on Algorithms, 2000.[31] S. Fortune, J. Hopcroft, and J. Wyllie. The directed homeomorphism problem. Theo-retical Computer Science, 10:111{121, 1980.[32] G. Galambos and G. J. Woeginger. An on-line scheduling heuristic with better worstcase ratio than graham's list scheduling. SIAM J. Computing, 22:349{355, 1993.[33] M.R. Garey and D.S. Johnson. Computers and Intractability. W.H. Freeman andCompany, San Francisco, 1979.[34] T. Gormley, N. Reingold, E. Torng, and J. Westbrook. Generating adversaries forrequest-answer games. In Proc. 11th ACM-SIAM Symp. on Discrete Algorithms, 2000.[35] R. L. Graham. Bounds for certain multiprocessing anomalies. Bell System TechnicalJournal, 45:1563{1581, 1966.[36] R.L. Graham. Bounds for certain multiprocessor anomalies. Bell System TechnicalJournal, 45:1563{1581, 1966.[37] V. Guruswami, S. Khanna, R. Rajaraman, B. Shepherd, and M. Yannakakis. Near-optimal hardness results and approximation algorithms for edge-disjoint paths andrelated problems. Proc. of STOC '99, pages 19{28.[38] L. A. Hall, A. Schulz, D. B. Shmoys, and J. Wein. Scheduling to minimize averagecompletion time: O�-line and on-line approximation algorithms. Mathematics of Op-erations Research, 1997.[39] D. S. Hochbaum and D. B. Shmoys. Using dual approximation algorithms for schedul-ing problems: Theoretical and practical results. J. Assoc. Comput. Mach., 34(1):144{162, January 1987.[40] B. Kalyanasundaram and K. Pruhs. Real-time scheduling with fault-tolerance. Tech-nical report, Computer Science Dept. University of Pittsburgh.[41] D. Karger, S. Phillips, and E. Torng. A better algorithm for an ancient schedulingproblem. In Proc. 5th ACM-SIAM Symp. on Discrete Algorithms, pages 132{140,1994.[42] R.M. Karp. Reducibility among Combinatorial Problems, R.E. Miller andJ.W. Thatcher (eds.), Complexity of Computer Computations. Plenum Press, 1972.

Page 79: Scheduling and Load Balancing

78 BIBLIOGRAPHY[43] H. Kellerer, T. Tautenhahn, and G. J. Woeginger. Approximability and nonapprox-imability results for minimizing total ow time on a single maching. In Proceedingsof the Twenty-Eighth Annual ACM Symposium on the Theory of Computing, pages418{426, Philadelphia, Pennsylvania, 1996.[44] J. Kleinberg. Approximation Algorithms for Disjoint Paths Problems. PhD thesis,Massachusetts Institue of Technology, 1996.[45] J. Kleinberg. Decision algorithms for unsplittable ow and the half-disjoint pathsproblem. In Proceedings of the 30th Annual ACM Symposium on Theory of Computing(STOC '98), pages 530{539, New York, May 23{26 1998. ACM Press.[46] J. Kleinberg and �E. Tardos. Approximations for the disjoint paths problem in high-diameter planar networks. Proc. of STOC '95, pages 26{35.[47] S. Kolliopoulos and C. Stein. Approximating disjoint-path problems using greedyalgorithms and packing integer programs. In IPCO: 6th Integer Programming andCombinatorial Optimization Conference, 1998.[48] G. Koren and D. Shasha. Dover: An optimal on-line scheduling algorithm for over-loaded real-time systems. IEEE Real-time Systems Symposium, pages 290{299, 1992.[49] G. Koren and D. Shasha. MOCA: a multiprocessor on-line competitive algorithm forreal-time system scheduling. Theoretical Computer Science, 128(1{2):75{97, 1994.[50] J.K. Lenstra, D.B. Shmoys, and E. Tardos. Approximation algorithms for schedulingunrelated parallel machines. Math. Prog., 46:259{271, 1990.[51] S. Leonardi and D. Raz. Approximating total ow time on parallel machines. InProceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing,pages 110{119, El Paso, Texas, 1997.[52] S. Phillips and J. Westbrook. On-line load balancing and network ow. In Proc. 25thACM Symposium on Theory of Computing, pages 402{411, 1993.[53] S. Plotkin and Y. Ma. An improved lower bound for load balancing of tasks withunknown duration. Inform. Process. Lett., 62:301{303, 1997.[54] P. Raghavan and C.D. Thompson. Provably good routing in graphs: Regular arrays.In Proc. 17th ACM Symp. on Theory of Computing, May 1985.[55] N. Robertson and P. D. Seymour. An outline of a disjoint paths algorithm. In Paths,Flows and VLSI Design, Algorithms and Combinatorics, volume 9, pages 267{292,1990.[56] N. Robertson and P. D. Seymour. Graph minors. XIII. the disjoint paths problem.JCTB: Journal of Combinatorial Theory, Series B, 63, 1995.[57] S. Sahni. Algorithms for scheduling independent tasks. Journal of the Association forComputing Machinery, 23:116{127, 1976.

Page 80: Scheduling and Load Balancing

BIBLIOGRAPHY 79[58] J. Sgall. On-line scheduling. In A. Fiat and G. Woeginger, editors, Online Algorithms- The State of the Art, chapter 9, pages 196{231. Springer, 1998.[59] A. Srinivasan. Improved approximations for edge-disjoint paths, unsplittable ow, andrelated routing problems. In Proc. 38th IEEE Symp. on Found. of Comp. Science,pages 416{425.[60] J. Westbrook. Load balancing for response time. In 3rd Annual European Symposiumon Algorithms, 1995.

Page 81: Scheduling and Load Balancing

בית-ספר למדעי המחשב

תזמון ואיזון עומסיםחיבור זה הוגש כחלק מהדרישות לקבלת התואר דוקטור לפילוסופיה

על-ידיעודד רגב

העבודה הוכנה בהדרכתו של פרופ' יוסי עזר

2001ינואר

Page 82: Scheduling and Load Balancing

תזמון ואיזון עומסים בעבודה זו נחקרות מספר גרסאות של בעיות בתזמון ואיזוןועלינו משימות של קבוצה נתונה תזמון, בבעיות עומסים. לקבוע את הזמנים ואת המעבדים בהם הן תרוצנה. בבעיותבכל שיטפל המעבד את לבחור רק עלינו עומסים איזון משימה. בכל אחד מהמקרים נרצה להקטין ככל האפשר את מחיר הפתרון או להגדיל ככל האפשר את הרווח ממנו. ברוב המקרים בהם נטפל פתרון אופטימלי שכזה יהיה בלתי ניתןככל טובים מקורבים פתרונות למצוא ננסה ולכן להשגה

האפשר.

הבעיה הראשונה בה נטפל היא בעיית איזון עומסים זמניים.זמן ידי על לעומס, מתוארת כל משימה זו, בנוסף בבעיה ההגעה והעזיבה שלה. מטרתנו היא למצוא השמה למשימות כך שהעומס הגדול ביותר שמופעל על מכונה הוא קטן ככל האפשר. נראה כי אין אלגוריתם שיפתור בעיה זו ביחס קירוב

מ- קבוע,1.5הפחות המכונות במקרה שמספר כן, כמו . נראה כי ניתן למצוא שיטת קירוב, כלומר, קירוב עד כדי קבוע

קטן כרצוננו.

איזון בעיית היא נטפל בה נוספת עומסים איזון בעיית העומסים המקוונת. כמעט כל גרסאותיה של הבעיה נפתרומקשורות. בלתי הנן המכונות בו המקרה מלבד בעבר בהמשך נראה כי בעיה זו כמעט ואיננה ניתנת לקירוב ועקב כך כמעט הופך האלגוריתם הפשוט לבעיה, לאופטימלי. אנולהשיג ניתן בו מהירויות מיוחד של שתי במקרה גם נדון

תוצאות קירוב מדויקות.

נתייחס היא בעיית התזמון בעיית התזמון הראשונה אליה ללא נדידה במערכת רבת מעבדים. בבעיית התזמון הרגילהשימוש ידי על להשגה ניתן לוגריתמי קירוב יחס כי ידוע ב"עקרון שארית זמן ריצה מינימלית". למרות כוחה ופשטותה של שיטה זו, השימוש בנדידה מהווה חלק בלתי נפרד ממנה. אנו נראה כיצד ניתן להשיג את אותם יחסי קירוב ללא שימוש

בנדידה. תוצאה זו ניתנת לשימוש גם במערכות מקוונות.

Page 83: Scheduling and Load Balancing

נמשיך ונעסוק בבעיות תזמון כאשר הפעם נשאף להגדיל ככל שניתן את הרווח בתזמון מקוון. בעבר נהוג היה להגדיר לכל משימה מועד סופי שלאחריו אובד כל רווח מן המשימה. קירוב טוב לפי הגדרה זו הסתבר כדבר קשה להשגה. אנו נציג הגדרה חלופית בה הרווח המושג מכל משימה תלוי בזמן בו עוכבה. הרווח המושג ממשימות שעוכבו זמן רב יהיה קטןמיידית. מורצות שמשימות במקרה המושג מהרווח האלגוריתם שיוצג לבעיה זו יוכח כאלגוריתם בעל יחס קירוב

קבוע.

יש קישור לכל בה ברשת ניתוב בבעיות נתבונן לבסוף קיבולת משלו ולכל בקשת ניתוב מצורפת דרישה ורווח. עלינו לנתב ברשת תת קבוצה של בקשות כך שהרווח הכללי יהיהשל מקיבולתו לחרוג באפשרותנו אין האפשר. ככל גדול לאחר בקשה. לכל יחיד ניתוב מסלול למצוא ויש קישור נציג זו בעיה של העיקריים המקרים שלושת את שנזהה אלגוריתמים לכל אחד מהם. יחסי הקירוב אותם נשיג לכלמיחסי יותר טובים או זהים יהיו המקרים משלושת אחד האלגוריתמים כל לכך, מעבר הקודמים. הידועים הקירוב אותם נציג הנם קומבינטוריים ופולינומיאליים בצורה החזקה וזאת בניגוד לתוצאות הקודמות. חלק מתוצאותינו יורחבו גם

למקרה המקוון.