Online scheduling on the unrelated machines is a classical and well-studied problem. In this problem, there are jobs that need to be processed by one of different machines. The jobs arrive one by one and must be assigned to one machine upon their arrival, without knowing the future jobs. The time to process a job changes from machine to machine, and the goal is to allocate all jobs so as to minimize the makespan, that is, the maximum load over the machines. The load of a machine is the sum of the processing times of the jobs allocated to that machine.
Online algorithms are designed to solve the problems when the input is not known from the very beginning but released “piece-by-piece” as aforementioned. Since it is generally impossible to guarantee an optimal allocation, online algorithms are evaluated through the competitive ratio. An online algorithm whose competitive ratio is guarantees an allocation whose makespan is at most times the optimal makespan.
For scheduling on unrelated machines, online algorithms have a rather “bad” performance in terms of the competitive ratio. For example, the simple greedy algorithm has a competitive ratio of , the number of machines; the best possible online algorithm achieves a competitive ratio of . However, some well-known restrictions (e.g., the identical machines and related machines) admit a much better performance, that is, a constant competitive ratio.
In fact, many practical problems are neither as simple as the identical (or related) machines cases, nor so complicated as the general unrelated machines. In a sense, practical problems are somewhat “intermediate” as the following examples suggest.
Example 1 (Two types of jobs (Vakhania et al., 2014)).
This restriction of unrelated machines arises naturally when there are two types of products. For instance, consider the production of spare parts for cars. The manufacturer may decide to use the machines for the production of spare part 1 to produce spare part 2, and vice versa. The machine for spare part 1 (spare part 2, respectively) takes time for part 1 (part 2, respectively), but it can also manage to produce part 2 (part 1, respectively) in time .
Example 2 (CPU-GPU cluster (Chen et al., 2014)).
A graphics processing unit (GPU) has the ability to handle various tasks more efficiently than the central processing unit (CPU). These tasks include video processing, image analysis, and signal processing. Nevertheless, the CPU is still more suitable for a wide range of other tasks. A heterogeneous CPU-GPU system consists of a set of GPU processors and a set of CPU processors. The processing time of job is on a GPU processor and on a CPU processor. Therefore, some jobs are more suitable for GPU and others for CPU.
Inspired by these examples, we consider the general unrelated machines case by observing that each job in the system has a certain set of favorite machines which correspond to the shortest processing time for this particular job. In Example 1, the machines for spare parts are the favorite machines for these parts (processing time ), and similarly for spare parts . In Example 2, we also have two type of machines (GPU and CPU) and some jobs (tasks) have GPUs as favorite machines and others have CPUs as favorite machines.
1.1 Our contributions and connections with prior work
We study the online scheduling problem on what we call the favorite machine model. Denote the processing time of job on machine by and the minimum processing time of job by . Thus the set of favorite machines of job is defined as and the favorite machine model is as follows:
(-favorite machines) This model is simply the unrelated machine setting when every job has at least favorite machines (). The processing time of job on any favorite machine is , and on any non-favorite machine is an arbitrary value .
This model is motivated by several practical scheduling problems. Besides the two types of jobs/machines problems mentioned in Examples 1 and 2, the model also captures the features of some real life problems. For example, workers with different levels of proficiency for different jobs in manufacturing; tasks/data transfer cost in cloud computing and so on.
It is worth noting that this model interpolates between theunrelated machines where possibly only one machine has minimal processing time for the job () and the identical machines case . The -favorite machines setting can also be seen as a “relaxed” version of restricted assignment problem where each job can be allocated only to a subset of machines: the restricted assignment problem is essentially the case where the processing time of a job on a non-favorite machine is always .
We obtain tight bounds on the Greedy algorithm111This algorithm assigns each job to a machine whose load after this job assignment is minimized. and the well-known Assign-U algorithm (designed for unrelated machines by Aspnes et al. (1997)) for the -favorite machines case, and show the optimality of the Assign-U algorithm by providing a matching lower bound. For the Greedy algorithm, the competitive ratio is , which generalizes the well-known bounds on the competitive ratio of Greedy for unrelated machines () and identical machines (), that is, and , respectively. The Assign-U algorithm has the optimal competitive ratio , while it is for unrelated machines.
Easier instances and the impact of “speed ratio”.
Note that whenever , the competitive ratio is constant. In particular, for , Greedy has a competitive ratio of . We consider the following restriction of the model above such that a finer analysis is possible.
(symmetric -favorite machines) All machines are partitioned into two groups of equal size , and each job has favorite machines as exactly one of the two groups (therefore and is even). Moreover, the processing time on non-favorite machines is times that on favorite machines, where is the scaling factor (the “speed ratio” between favorite and non-favorite machines).
We show that the competitive ratio of Greedy is at most . A modified greedy algorithm, called GreedyFavorite, which assigns each job greedily but only among its favorite machines, has a competitive ratio of . As one can see, the Greedy is better than GreedyFavorite for smaller , and GreedyFavorite is better for larger . Thus we can combine the two algorithms to obtain a better algorithm (GGF) with a competitive ratio of at most . Indeed, we characterize the optimal competitive ratio for the two machines case. That is, for symmetric -favorite machines, we show that the GGF algorithm is -competitive and there is a matching lower bound.
For this problem, our results show the impact of the speed ratio on the competitive ratio. This is interesting because this problem generalizes the case of two related machines (Epstein et al., 2001), for which is the speed ratio between the two machines. The two machines case has also been studied earlier from a game theoretic point of view and compared to the two related machines (Chen et al., 2017; Epstein, 2010).
Relations with prior work.
As mentioned above, the -favorite machines is a special case of the unrelated machines and a general case of the identical machines. The symmetric 1-favorite machines is a generalization of the 2 related machines.
Besides, there are several other “intermediate” problems that have connections with our models and results in the literature (see Figure 1 for an overview). Specifically, in the two types of machines case (Imreh, 2003; Chen et al., 2014), they have two sets of machines, and , and the machines in each set are identical. Each job has processing time for any machine in , and for any machine in . The so-called balanced case is the restriction in which the number of machines in the two sets are equal. Note that our -favorite machines is a generalization of the balanced case, because each job has either or as favorite machines, and thus . The symmetric -favorite machines case is the restriction of the balance case in which the processing time on non-favorite machines is times that of favorite ones, i.e., either or .
1.2 Related work
The Greedy algorithm (also known as List algorithm) is a natural and simple algorithm, often with a provable good performance. Because of its simplicity, it is widely used in many scheduling problems. In some cases, however, better algorithms exist and Greedy is not optimal.
Identical machines. For identical machines, the Greedy algorithm has a competitive ratio exactly (Graham, 1966), and this is optimal for (Faigle et al., 1989). For arbitrary larger , better online algorithms exist and the bound is still improving (Karger et al., 1996; Bartal et al., 1995; Albers, 1999). Till now the best-known upper bound is 1.9201 (Fleischer and Wahl, 2000) and the lower bound is 1.88 (Rudin III, 2001).
Related machines (uniform processors). The competitive ratio of Greedy is for two machines (), and it is at most for . The bounds are tight for (Cho and Sahni, 1980).
When the number of machines becomes larger, the Greedy algorithm is far from optimal, as its competitive ratio is for arbitrary (Aspnes et al., 1997). Aspnes et al. (1997) also devise the Assign-R algorithm with the first constant competitive ratio of 8 for related machines. The constant is improved to 5.828 by Berman et al. (2000).
Some research focuses on the dependence of the competitive ratio on speed when is rather small. For the 2 related machines case, Greedy has a competitive ratio of and there is a matching lower bound (Epstein et al., 2001).
Unrelated machines. As to the unrelated machines, Aspnes et al. (1997) show that the competitive ratio of Greedy is rather large, namely . In the same work, they present the algorithm Assign-U with a competitive ratio of . A matching lower bound is given by Azar et al. (1992) in the problem of online restricted assignment.
Restricted assignment. The online restricted assignment problem is also known as online scheduling subject to arbitrary machine eligibility constraints. Azar et al. (1992) show that Greedy has a competitive ratio less than , and there is a matching lower bound . For other results of online scheduling with machine eligibility we refer the reader to the survey by Lee et al. (2013) and references therein.
Two types of machines (CPU-GPU cluster, hybrid systems). Imreh (2003) proves that Greedy algorithm is -competitive for this case, where and () are the number of two sets of machines, respectively. In our terminology, and , meaning that Greedy is -competitive for . The same work also improves the bound to with a modified Greedy algorithm. Chen et al. (2014) gives a -competitive algorithm for the problem, and a simple -competitive algorithm and a more involved -competitive algorithm for the balanced case, that is, the case .
Further models and results. Some work consider restrictions on the processing times in the offline version of scheduling problems. Specifically, Vakhania et al. (2014) consider the case of two processing times, where each processing time for all and . Kedad-Sidhoum et al. (2018) consider the two types of machines (CPU-GPU cluster) problem, and Gehrke et al. (2018) consider a generalization, the few types of machines problem. Some work also study similar models in a game-theoretic setting (Lavi and Swamy, 2009; Auletta et al., 2015). Regarding online algorithms, several works consider restricted assignment with additional assumptions on the problem structure like hierarchical server topologies (Bar-Noy et al., 2001) (see also Crescenzi et al. (2007)). For other results of processing time restrictions, we refer the reader to the survey by Leung and Li (2008). Finally, the -favorite machine model in our paper has been recently analyzed in a follow-up paper in the offline game-theoretic setting (Chen and Xu, 2018).
2 Model and preliminary definitions
The favorite machines setting.
There are machines, , to process jobs, . Denote the processing time of job on machine by , and the minimum processing time of job by . We define the favorite machines of a job as the machines with the minimum processing time for the job. Let be the set of favorite machines of job . Assume that each job has at least favorite machines, i.e., for . Thus, the processing time of job on its favorite machines equals to the minimum processing time (i.e., for ), while the processing time on its non-favorite machines can be any value that greater than (i.e., for ).
The symmetric favorite machines setting.
This setting is the following restriction of the favorite machines. There are machines partitioned into two subsets of machines each, that is, , where and . Each job has either or as its favorite machines, i.e., . The processing time of job is on its favorite machines and on non-favorite machines, where .
We say that job is a good job if it is allocated to one of its favorite machines, and it is a bad job otherwise.
Let denote the load on machine after jobs through are allocated by online algorithm:
In the analysis, we shall sometimes considered the machines in non-increasing order of their loads. For a sequence jobs, we denote by the highest load over all machines after the first jobs are allocated, i.e.,
The jobs arrive one by one (over a list) and must be allocated irrevocably upon each arrival without knowing the future jobs. the goal is to minimize the makespan, the maximum load over all machines. The competitive ratio of an algorithm is defined as where is taken over all possible sequences of jobs, is the cost (makespan) of algorithm on sequence , and is the optimal cost on the same sequence. We write and for simplicity whenever the job sequence is clear from the context.
3 The favorite machine model
In this section, we first analyze the performance of the Greedy algorithm and show its competitive ratio is precisely . We then show that no online algorithm can be better than and that algorithm Assign-U (Aspnes et al., 1997) has an optimal competitive ratio of for our problem.
3.1 Greedy Algorithm
Algorithm Greedy: Every job is assigned to a machine that minimizes the completion time of this job (the completion time of job if allocated to machine is the load of machine after the job is allocated).
The competitive ratio of Greedy is at most .
The key part in the proof of Theorem 3 is the following lemma which says that Greedy maintains the following invariant: the sum of the largest machines loads never exceeds the sum of all jobs’ minimal processing times.
For -favorite machines, and for every sequence of jobs, the allocation of Greedy satisfies the following condition:
The proof is by induction on the number of jobs released so far. The base case is . Since Greedy allocates the first job to one of its favorite machines, and the other machines are empty, we have , and thus (1) holds for .
As for the inductive step, we assume that (1) holds for , i.e.,
and show that the same condition holds for , i.e., after job is allocated.
If job is allocated as a good job, then the left-hand side of (2) will increase by at most , while the right-hand side will increase by exactly . Thus, equation (1) follows from the inductive hypothesis (2).
If job is allocated as a bad job on some machine , then the following observation allows to prove the statement: before job is allocated, the load of each favorite machine for job must be higher than (otherwise Greedy would allocate as a good job). Since there are at least favorite machines for job , there must be a favorite machine with
Thus, is not one of the largest loads before job is allocated. After allocating job , the load of machine increases to . We then have two cases depending on whether is one of the largest loads after job is allocated:
Case 1 (). In this case, the largest loads remain the same after job is allocated, meaning that the left-hand side of (2) does not change, while the right-hand side increases (when adding job ). In other words, (1) follows from the inductive hypothesis (2).
Case 2 (). In this case, will be no longer included in the first largest loads, after job is allocated, while will enter the set of largest loads:
Since Greedy allocates job to machine , it must be the case
Proof of Theorem 3.
Without loss of generality we, assume that the makespan of the allocation of Greedy is determined by the last job (otherwise, we can consider the last job which determines the makespan, and ignore all jobs after since they do not increase nor decrease ).
After allocating the last job , the cost of Greedy becomes
where the last inequality holds because job has at least favorite machines, and thus the least loaded among them must have load at most .
Since the optimum must allocate all jobs on machines, and job itself requires on a single machine, we have
where the last inequality holds because the first term decreases in and the second term increases in . ∎
The competitive ratio of Greedy is at least .
We will provide a sequence of jobs whose schedule by Greedy has a makespan , and the optimal makespan is 1. For simplicity, we assume that in case of a tie, the Greedy algorithm will allocate the job as a bad job to a machine with the smallest index. Without loss of generality, suppose is divisible by . We partition the machines into groups, , each of them containing machines, i.e., for .
The jobs are released in two phases (described in detail below): In the first phase, we force Greedy to allocate each machine in a load of bad jobs equal to , and a load of good jobs equal to for a suitable (except for ); In the second phase, several jobs with favorite machines in are released and contribute an additional to the load of one machine in , and thus the makespan is .
We use the notation to represent a sequence of identical jobs whose favorite machines are , the processing time on favorite machines is , and on non-favorite machines is with .
Phase 1. For each from to , release a sequence of jobs followed by a sequence . In this phase, we take , so that, for each , the jobs will be assigned as good jobs to the machines in , one per machine, and the jobs will be assigned as bad jobs to the machines in , one per machine (as shown in Figure 2).
At the end of Phase 1, each machine in () will have load , and each machine in will have load . The optimal schedule assigns every job to some favorite machine evenly so that all machines have load , except for the machines in the last group which are left empty.
Phase 2. In this phase, all jobs released have as their favorite machines, specifically followed by a single job . By taking , no jobs will be allocated as bad jobs by Greedy. Thus, this phase can be seen as scheduling on identical machines. Consequently, all jobs will be allocated as in Figure 2 increasing the maximum load of machines in by , while the optimal schedule can have a makespan 1.
At the end of Phase 2, the maximum load of machines in is , while the optimal makespan is 1. ∎
3.2 A general lower bound
In this section, we provide a general lower bound for the -favorite machines problem. The bound borrows the basic idea of the lower bound for the restricted assignment (Azar et al., 1992). The trick of our proof is that we always partition the selected machines into arbitrary groups of machines each, and apply the idea to each of the group respectively.
Every deterministic online algorithm must have a competitive ratio at least .
Suppose first that is a power of 2, i.e., . We provide a sequence of jobs having optimal makespan equal to , while any online algorithm will have a makespan at least .
We denote by a sequence of identical jobs whose favorite machines are , the processing time on favorite machines is , and the processing time on non-favorite machines is greater than , so that all jobs must be allocated to favorite machines.
We consider subsets of machines , where the first subset is and the others satisfy and for . We then release sets of jobs iteratively. At each iteration (), a set of jobs with favorite machines are released for allocation, and after the allocation, half of the “highly loaded” machines in are chosen for the next set . More in detail, for each iteration () we proceed as follows:
Partition the current set of machines into arbitrary groups of machines each, that is, into groups where . Then, release a set of jobs :
The next set of machines consists of the most loaded machines in each subgroup after jobs have been allocated. Specifically, we let , for being the subset of most loaded machines in group after jobs have been allocated.
We then show that the following invariant holds at every iteration. Note that the following lemma shows a separation of our method and the one of Azar et al. (1992). Specifically, the maximum load increases by at each iteration in our lower bound, but increases by in Azar et al. (1992).
The average load of machines in is at least before the jobs in are assigned for .
The proof is done by induction on . For the base case , the lemma is trivial. As for the inductive step, suppose the lemma holds for .
Denote the average load of before the allocation of jobs by , and the average load of after the allocation of jobs by . We claim that after the allocation of jobs . Note that and are the union of all groups and , respectively. Thus, we have that the average load of is at least , since the average load of is (the inductive hypothesis). This concludes the proof of the inductive step, and thus the lemma follows. Next, we prove that the claim holds:
Case 1. There is a machine in that has load at least . Since consists of the most loaded machines in , each machine in will also have load at least . Thus, we obtain that .
Case 2. Each machine in has load no greater than . Observe that the total load of is after the allocation of . Since has load at most , the average load of the machines in must be at least
By applying Lemma 7 with , we have that the average load of is at least before the allocation of jobs . Thus, after jobs in are allocated, the average load of is at least , i.e., the online cost is at least .
An optimal cost of can be achieved by using the machines in for (for and ) and using machines in for . Therefore, the competitive ratio is at least . Finally, if is not a power of , we simply apply the previous construction to a subset of machines, for and . This gives the desired lower bound . ∎
3.3 General upper bound (Algorithm Assign-U is optimal)
In this section, we prove a matching upper bound for -favorite machines. Specifically, we show that the optimal online algorithm for unrelated machines (algorithm Assign-U by Aspnes et al. (1997) described below) yields an optimal upper bound:
Algorithm Assign-U can be used to achieve competitive ratio.
Following Aspnes et al. (1997), we show that the algorithm has an optimal competitive ratio (Lemma 9) for the case the optimal cost is known, and then apply a standard doubling approach to get an algorithm with competitive ratio for the case the optimum is not known in advance (Theorem 8). In the following, we use a “tilde” notation to denote a normalization by the optimal cost , i.e., .
Algorithm Assign-U (Aspnes et al., 1997): Each job is assigned to machine , where is the index minimizing , where is a suitable constant.
If the optimal cost is known, Assign-U has a competitive ratio of .
Without loss of generality, we assume that the makespan of the allocation of Assign-U is determined by the last job (this is the same as the proof of Theorem 3 above). Let be the load of machine in the optimal schedule after the first jobs are assigned. Define the potential function:
Thus, it follows that
Suppose Assign-U assigns the last job to machine , it holds that
since we suppose job is the last completed job.
Case 1. Job is allocated as a good job, i.e., . According to the rule of Assign-U, machine must be one of the machines in that has the minimum load. Since there are at least favorite machines, it holds that . Thus, .
Case 2. Job is allocated as a bad job, i.e., . Let be the machine who has the minimum load in . Note that . According to the rule of Assign-U, it holds that ; otherwise, we have , which is contradictory to that Assign-U assigns job to machine .
Since and , we have
so that implying
4 The symmetric favorite machine model
This section focuses on the symmetric favorite machines problem, where (), for each job , and the processing time of job on a non-favorite machine is () times that on a favorite machine. We analyze the competitive ratio of Greedy as a function of the parameter . Though Greedy has a constant competitive ratio for this problem, another natural algorithm called GreedyFavorite performs better for larger . At last, a combination of the two algorithms, GreedyOrGreedyFavorite, obtains a better competitive ratio, and the algorithm is optimal for the two machines case.
4.1 Greedy Algorithm
The next two theorems regard the competitive ratio of the Greedy algorithm for the symmetric favorite machines case.
For the symmetric -favorite machines case, the Greedy algorithm has a competitive ratio at most
where and is the number of machines.
Since this upper bound increases in (), we have the following inequalities:
and both bounds can be achieved by the actual competitive ratio of algorithm Greedy. Note that for , the lower bound is indeed tight as it corresponds to the analysis of Greedy on identical machines (Graham, 1966). More generally, we have the following result (whose proof is deferred to Appendix A.3 for readability sake):
The upper bound in Theorem 11 is tight () in each of the following cases:
For , ;
For and , ;
For (implying ), ;
For and , ;
For , .
4.1.1 Proof of Theorem 11
Because this is a special case of the general model, we have from Theorem 3 (by recalling that ). Thus, we just need to prove
Without loss of generality, we assume that the makespan of the allocation of Greedy is determined by the last job . Suppose that the first jobs have been already allocated by Greedy, and denote . Also let and be the total load of good jobs of and , respectively. Observe that and . Without loss of generality, we assume that machines in are the favorite machines of the last job .
We first give a lower bound of the optimal cost