Scheduling unrelated machines with two types of jobs

1 downloads 793 Views 182KB Size Report
that an earlier open problem of scheduling jobs with two possible processing ... integer job processing times p and q, p
Scheduling unrelated machines with two types of jobs Nodari Vakhania, Jose Alberto Hernandez Science Faculty, UAEM University Ave. 1001, Cuernavaca 62210, Mor., Mexico Email address: [email protected] Frank Werner Fakult¨at f¨ ur Mathematik, Otto-von-Guericke-Universit¨at, PSF 4120, 39106 Magdeburg, Germany Email address: [email protected] Abstract In this paper, we consider the problem of scheduling a set of jobs having only two possible processing times on a set of unrelated parallel machines. This problem is a generalization of the much more common problem of scheduling equal-length jobs on identical machines. Such a situation may occur in the production of two different types of products. First, we show that an earlier open problem of scheduling jobs with two possible processing times p and 2p on unrelated machines with the objective to minimize the makespan can be polynomially solved by an algorithm consisting of two phases. A slight modification of this algorithm yields an absolute worst-case error of q for the case of two arbitrary processing times p and q, p < q. Thus, for practical problems of a large size with two types of products and two possible processing times, the approximation algorithm generates schedules very close to an optimal one. Key words: scheduling; unrelated machines; linear programming; polynomial-time algorithm; approximation algorithm; worst-case analysis MSC classification: 90 B 35

1 1.1

Introduction Problem definition and overview

Scheduling unrelated parallel machines non-preemptively with the objective to minimize the makespan (i.e., the maximum job completion time), commonly abbreviated as R//Cmax (see 1

Graham et al. [9]), is among the heaviest strongly NP-hard problems. The best known polynomial approximation algorithm for this problem has an asymptotic performance ratio 2 (the performance ratio of a schedule is the ratio of the objective function value of that schedule to the optimal objective function value). For many NP-hard scheduling problems, a strong restriction on the job processing times may convert the problem to a polynomially solvable one. For R//Cmax however, the problem is known to remain NP-hard even for two allowable integer job processing times p and q, p < q, such that q 6= 2p (see Lenstra et al. [13]). The authors in [13] have shown that the version with p = 1 and q = 2 can be polynomially solved using a reduction from a version of the assignment (matching) problem. On the negative side, we show that a similar kind of reduction is not possible for times p and 2p. On the positive side, we propose another polynomial-time algorithm using linear programming. A slight modification of this algorithm yields an absolute worst-case error of q for two arbitrary processing times p and q, p < q. In the rest of this section, we first give more details on the problem under consideration, and then we overview the related work in more detail and describe briefly our algorithm. Multiprocessor scheduling problems deal with a group of parallel machines (or processors) that can process a given set of jobs {1, 2, . . . , n} under certain restrictions. A group of identical machines processes every job for the same time, whereas in the uniform machine environment machine Mi has its own speed si (the same for all jobs). Assuming that the slowest machine M1 has speed 1, the speed of any other machine is a real number no less than 1. Let pji denote the processing time of job j on machine Mi . Given the processing time of job j on the slowest machine M1 , the processing times of j on the rest of the machines are obtained as pji = pj1 /si . In the unrelated machine environment, the machines have no uniform speed characteristic (i.e., the speed of each machine is job-dependent), hence the job processing times must be given individually for each machine. The problem of scheduling already two identical machines with the objective to minimize the makespan is NP-hard. However, the approximation in polynomial time for scheduling identical and also uniform machines can be done efficiently. An O(n log n) MULTIFIT algorithm for the problem P//Cmax gives a performance ratio of 13/11 for identical machines and of 7/5 for uniform machines (see Friesen [4], Yue [16], Friesen & Langston [5]). There also exist polynomial approximation schemes for uniform machines, see Hochbaum and Shmoys [10]. On the contrary to the above, the first polynomial-time approximation algorithm for the problem R//Cmax was proposed by Ibarra and Kim [11] with a performance ratio of m, and √ a better polynomial-time algorithm with a performance ratio within 2 m was suggested by Davis and Jaffe [1]. Potts [14] gave an approximation algorithm with the performance ratio 2, which is polynomial in n and exponential in m. One decade later (and more than two decades ago), Lenstra et al. [13] have developed the first polynomial-time algorithm (in both the number of jobs n and the number of machines m) with the same performance ratio 2. The authors in [13] have also shown that no polynomial algorithm with a performance ratio of 1.5 or less may exist for the problem R//Cmax (unless P = N P ). The algorithm from [13] is based on rounding of a fractional solution obtained by linear 2

programming. Relatively recently, the rounding approach was used in a slightly better performance algorithm with the ratio 2−1/m (see Shchepin & Vakhania [15]), and it was shown that no rounding-based algorithm can give a better performance ratio than 2 − 1/m. Also recently, Ebenlendr et al. [3] have proposed a special case of scheduling on unrelated machines in which each job can be assigned to at most two machines. Their 1.75-approximation algorithm also applies the rounding of the fractional solution obtained by linear programming. Even for this restricted version, it remains NP-hard to find a better than a 1.5-approximation algorithm. Based on the state of art on scheduling unrelated machines, there remain two research directions. First, the search of polynomial approximation algorithms with a performance ratio closer to 1.5. Second, one may naturally simplify the problem imposing certain restrictions on the job processing times aiming to solve the derived versions in polynomial time. Scheduling problems on identical and uniform machines when the job processing times are restricted have been widely studied. Among such problems ones with unit and equal-length jobs are well studied (see, for example, a recent overview by Kravchenko and Werner [12]). For unrelated machines, at least two possible job processing times must be specified (otherwise we will be brought to the identical/uniform machine environment). As we have already noted, the problem R//Cmax remains NP-hard for two allowable integer processing times p and q whenever q 6= 2p. Thus, before considering the case q 6= 2p, we first assume q = 2p, i.e., the processing time of a job j on machine M , pjM , is either p or 2p. Adopting the standard threefield notation for scheduling problems, we abbreviate this problem by R/pji ∈ {p, 2p}/Cmax . To the best of our knowledge, no such model have yet been studied. Note that our result implies that R/pji ∈ {p, 2p}/Cmax is the maximal polynomially solvable special case of the problem R//Cmax (with restricted job processing times). We also note that the problem of scheduling n jobs with equal processing times on two different types of uniform machines (i.e., only two machine speeds are possible) is a special case of the problem R/pji ∈ {p, q}/Cmax considered in this paper. However, this special case can be polynomially solved by the O(n log n) algorithm given in [2] for the problem Q|rj , pj = p|Cmax . Since we exclusively deal with polynomial-time exact and approximation algorithms here, we neither discuss heuristic algorithms without a guaranteed performance nor enumerative algorithms for the general case of scheduling jobs on unrelated machines in detail. We only mention that e.g. for the general problem R//Cmax , there exist some recent papers on heuristics, where excellent results have been obtained. If any job can be processed on any machine, we refer e.g. to the works by Fanjul-Peyro and Ruiz [6, 7], and if jobs can be processed only on particular machines, we refer the reader to [8] and the works cited in these papers. Next we give a brief description of our algorithm for the problem R/pji ∈ {p, 2p}/Cmax which can also be used in a slightly modified form as an approximation algorithm for the problem R/pji ∈ {p, q}/Cmax . It consists of two phases. In Phase 1, first the preemptive version of this problem is solved, where only processing times p are considered. The resultant optimal preemptive solution is then rounded to an optimal non-preemptive schedule of the version the problem with only processing times p. In Phase 2, the solution obtained in Phase 1 is iteratively modified by moving a job with the current processing time p from a most loaded machine to a least loaded one (due to the desired property of the schedule obtained at Phase 3

1, the processing time of the moved job on the latter machine is 2p). The procedure of Phase 2 continues until the maximal machine load (the makespan) cannot be reduced further by the above operation. Finally, jobs that may only be processed in time 2p (on all the machines) are added. While Phase 2 is accomplished by a direct combinatorial algorithm, linear programming is used in Phase 1. Applying linear programming, we first obtain an optimal fractional solution, which results in no more than m − 1 preempted jobs. Then we round the corresponding variables in an optimal fashion.

1.2

Practical applications

Our model has some real life-applications. First, as mentioned before, it is a generalization of the problem of scheduling jobs with equal processing times on parallel machines. Kravchenko and Werner [12] summarized a few practical applications of such problems. For instance, problems with equal processing times arise in data communication networks during the transmission of a packet of bins with constant lengths, in logistics models of a food processing plant, in the production planning in a microbiological laboratory or in scheduling burn-in operations in integrated circuit manufacturing. In principle, all these examples can be generalized to the case under construction, provided that only two processing times are possible. The problem under consideration may also appear if two types of products are considered, where it is assumed that only two processing times are possible. For instance, consider the production of spare parts for cars. Due to a recent high demand on these two spare parts, the manufacturer (or a particular small department) decides to produce these parts simultaneously, in an excessive amount, using the machines for the production of spare part 1 for the production of spare part 2, and vice versa. The machine for spare part 1 (spare part 2, respectively) takes time p for part 1 (part 2, respectively), but it can also manage to produce part 2 (part 1, respectively) in time q. The manufacturer needs to minimize the total production time of all spare parts to deliver them as soon as possible to the customers. Such a situation may arise for the production of two types of microchips, screens, smartphones, etc. Often the underlying model can also be applied to problems with more general processing restrictions (e.g. setup times, delivery times, etc.) for the production provided that these additional constraints can be included into the processing times. In practice, uniform or unrelated machines often occur because not all old machines are simultaneously replaced at the same time by new machines so that both new machines and old machines may exist. While the new machines may shorten the processing time for new products produced with new technologies, it is also possible to produce older products but this might be slower. A similar situation may arise if more than two processing times are possible, however, they are grouped around two processing times. Such a situation is also possible for problems with uncertain processing times when it is only known in advance that the processing times of the jobs may take values from small intervals around the two expected possible processing times. The remainder of the paper is as follows. We give some preliminaries in the next section. 4

Then we describe Phase 1 and 2 of our exact algorithm for the processing times p and 2p in Sections 3 and 4, respectively. In Section 5, we present an estimation of the absolute error of the schedule obtained by a slight modification of our algorithm for the case of two arbitrary processing times p and q. Finally, Section 6 gives some concluding remarks.

2 2.1

Preliminaries The reduction using assignment problem for processing times 1 and 2

In this subsection we describe briefly the reduction from a version of the assignment problem for the times 1 and 2 used in [13], and show that no similar kind of reduction is possible for the times p and 2p. In the used version of the assignment (matching) problem, we are given a bipartite graph G = (S, T, E) (with the set of vertices S and T and the set of edges E) and we are asked to find its subgraph (with a maximum number of edges) in which each node in S has the degree 0 or 2 and each node in T has the degree 1. The version of our scheduling problem with processing times 1 and 2 is considered in which one wishes to know whether there exists a schedule with a makespan at most equal to some integer number d (a polynomial-time solution to this problem leads to a polynomial-time solution to the minimization version by using a binary search on the length (makespan) of the optimal solution). The reduction distinguishes two cases, when d is even, i.e., d = 2k, and when d is odd, i.e., d = 2k − 1 for some integer k. First, the case with d being even is considered, and then the case with an odd integer is reduced to the former case (as described a bit later). For each machine, in our scheduling problem k nodes are introduced in the set S (thus, there are mk nodes in S). Intuitively, each of these k nodes corresponds to unit time intervals on the corresponding machine (the total allowable number of time intervals is d = 2k). Each job is represented by a unique node in the set T . The edges in E represent unit processing times; i.e., there is an edge from a node in S representing some machine to an node in T representing some job if and only if the latter job performs in time 1 on the former machine. For the case d = 2k, by the nature of the matching problem, each machine may use none or two jobs for each of the k time units, so the total elapsed time on the machine will not exceed d. The solution of the matching problem provides a solution with a makespan at most d for all jobs which perform in time 1. Then it is easy to extend this schedule to a complete schedule with the makespan at most d using the remaining idle time intervals (with a length which is a multiple of 2) for the remaining jobs performing in time 2, whenever such a schedule exists. The case d = 2k − 1 is reduced to the former case d = 2k: to “fill in” the gap of the length 1, an additional fictitious job is introduced for each machine, which performs in time 2 on all other machines. 5

Now, for the processing times p and 2p, the case d = 2k converts to d = 2kp. Furthermore, the cases d = 2kp − 1, d = 2kp − 2, . . ., d = 2kp − (p − 1) arise. To use a reduction procedure, similar to that for d = 2k − 1, for every d = 2k − i (i = 1, 2, . . . , p − 1) additional fictitious jobs with processing time i need to be introduced. This clearly is not possible (as only jobs with processing times p and 2p are allowed). Moreover, even if such a reduction would be possible, it would be necessary to consider O(p) additional matching problems. This would increase the time complexity of the whole procedure by the factor p. Hence, it would be converted into a pseudo-polynomial procedure.

2.2

Basic notations and definitions

Our scheduling problem R//Cmax is as follows. Given n jobs from J = {1, 2, . . . , n} are to be processed on m machines from M = {M1 , . . . , Mm }. The processing time of job j on machine Mi is pji (alternatively, we may use pjMi ). A (non-preemptive) schedule is a mapping which assigns to each job a machine and a starting time on that machine so that to every machine at any time at most one job is assigned and no job is assigned to more than one machine at any time. The objective is to find an optimal schedule, i.e., a feasible schedule resulting in the minimal possible makespan. Given some job-machine assignment, let us denote by δ(j, M ) ∈ [0, 1] the fraction of job j assigned to machine M . A distribution δ is a feasible and complete job-machine assignment, i.e., it is a function δ : J × M → R+ such that X

δ(j, M ) = 1,

M ∈M

for every job j ∈ J . Observe that δ(j, M )pji is the total processing time of job j on machine M in δ. A machine is called idle at some moment (interval), if it handles no job at that moment (interval). Note that to every feasible schedule a distribution corresponds, whereas a distribution may define many different feasible schedules. A feasible schedule, associated with a given distribution, can be obtained by sequencing the jobs assigned to each machine in the distribution feasibly (to every machine, at any time at most one job is assigned and no job is assigned to more than one machine at any time moment). The load of machine M in a distribution δ (in a schedule S), written loadδ (M ) (loadS (M ), respectively), is the sum of the processing times of jobs assigned to M in δ (in S, respectively). We call a schedule S homogeneous if the load of each machine in S is the same, and tight if no machine is idle from time 0 to its completion time (i.e., the completion time of the latest job, scheduled on this machine) in S. Throughout the paper, we shall deal with tight schedules. Given a distribution δ, we can build a tight schedule S(δ) in a straightforward, simple and efficient way obtaining a feasible non-preemptive schedule for δ. S(δ) can uniquely be given 6

by the corresponding job sequence on each machine. The makespan of S(δ) is the maximal machine load in δ. The latter magnitude, which can be expressed as max

M ∈M

X

δ(j, M )pji ,

j∈J

is also the makespan of δ. As it is easy to see, this is a lower bound on the makespan of the corresponding schedule. The linear program for obtaining an optimal distribution proposed by Potts [14] is as follows: Minimize z, subject to n X

xji pji ≤ z,

i = 1, . . . , m,

j=1 m X

xji = 1,

j = 1, ..., n,

xji ≥ 0,

j = 1, ..., n, i = 1, . . . , m,

i=1

where the variable z stands for the optimal makespan, and xji = δ(j, Mi ). Note that in this linear program 0-1 assignment variables are replaced by real variables from the interval [0,1]. A solution of this linear program is a distribution that may split a job into parts and assign these parts to different machines. As it was shown in [14], this distribution has no more than m − 1 preempted jobs. Hence, the rounding of non-integer assignment variables to 0-1 variables is one possible way for obtaining a feasible (non-preemptive) schedule from the above (preemptive) distribution.

3

Phase 1: Obtaining an optimal solution with processing times p

Phase 1 of our algorithm that solves the special case R/pji ∈ {p, 2p}/Cmax considers all the possible assignments of all jobs performed only in time p, i.e., for any j ∈ J , the valid assignments correspond to the machines M with pjM = p. We denote the corresponding set of jobs by Jp (J \ Jp may, in general, be non-empty). Thus, in a p-feasible schedule/distribution, a job j ∈ Jp can only be assigned to a machine Mi with pji = p. A p-optimal schedule/distribution is a p-feasible schedule/distribution that minimizes the maximum machine load. A p-optimal schedule is found in two passes. In the first pass, the linear program from the previous section is used to build an optimal distribution. Since no job can be assigned to a 7

machine on which it takes time 2p, in that linear program, for every j ∈ Jp we let pji = ∞ whenever pji = 2p. Then obviously, the optimal solution δ of the modified linear program is a p-optimal distribution. The p-optimal distribution δ may contain at most m − 1 split jobs, i.e., those which were distributed on two or more machines in the optimal fractional solution δ. These fractional variables from δ are rounded to obtain a p-optimal schedule in the second pass of Phase 1. In other words, for each split job, all its parts are assembled so that they are gathered together on one particular machine. Our algorithm for rounding a p-optimal distribution to a p-optimal schedule is simple – it rounds every split job j ∈ δ on any of its common machines, ı.e., a machine Mi with δ(j, Mi ) > 0. Algorithm Round Step 0 Determine the set of split jobs J(δ) in δ {consisting of all jobs j ∈ J(δ) with 0 < δ(j, Mi ) < 1, for some Mi }; For each j ∈ J(δ), determine the corresponding common machine set CM (j) Step 1 For each job j ∈ J(δ), round j on any M ∈ CM (j) {that is, set δ(j, M ) = 1 and δ(j, Q) = 0, for any Q ∈ CM (j) \ M }. Let CM (j ∗ ) be a common machine set containing a machine with the maximal load in δ, where j ∗ is the corresponding job from J. We shall refer to CM (j ∗ ) as a maximal common machine set (in general, we may have more than one such set; in particular, if δ is homogeneous, then all common machine sets are maximal). A p-optimal distribution δ has the following useful property. Lemma 1 The load of all machines from any maximal common machine set is the same. Proof. First observe that since the number of jobs in J(δ) is less than m, for every machine Mi in δ, there is at most one job j such that 0 < δ(j, Mi ) < 1, i.e., each machine Mi possesses with at most one split job portion. Hence, the difference in the load of any couple of machines from any maximal common machine set cannot be p. Furthermore, we show that the difference in the load between any couple of machines from a maximal common machine set CM (j) (j ∈ J(δ)), cannot be more than p. By contradiction, suppose loadδ (M ) − loadδ (Q) > p, where M, Q ∈ CM (j). Then, if we round j completely on machine Q, the load of Q in the resultant distribution would be less than that of M in δ. Applying an analogous operation to all maximal common machine sets, we come to a new distribution with the makespan less than that of δ, which contradicts that δ is optimal. Thus, the difference in the load between any couple of machines from a maximal common machine can only be less than p. In fact, the loads can only be equal. Indeed, suppose they are not the same. Then we can easily build a new fractional distribution in which all machine loads in CM (j) and in any other maximal common machine set are equal (by leveling the 8

loads). The makespan of this new fractional distribution is less than that of δ, which is again a contradiction. Theorem 1 Algorithm Round finds a p-optimal schedule S(δ). Proof. Let CM (j) be a maximal common machine set. From Lemma 1, the subschedule of S(δ) formed only by the machines from CM (j) is homogeneous. Then obviously, any corresponding integral subschedule (in which no job from the former subschedule is split) cannot have a makespan less than L + p, where L = loadδ (M ) − δ(j, M )

(M ∈ CM (j)).

The magnitude L + p cannot be reduced by moving job j to any machine not from CM (j). Indeed, if this would be possible, then δ would not be optimal. Since the above reasoning holds for all maximal common machine sets, S(δ) is a p-optimal schedule.

3.1

Obtaining an optimal p-balanced schedule from S(δ)

Now we need to convert S(δ) to another p-optimal schedule with the following desired property. Let us say that machine M in a p-optimal schedule S admits a p ,→ p movement if there exists a machine Q with loadS (M ) − loadS (Q) ≥ 2p and a job j scheduled on machine M in S, such that pjQ = p (roughly, the loads of the machines M and Q can be balanced). Now, we call a p-optimal schedule S p-balanced if no machine in S admits a p ,→ p movement. At Phase 1, we aim to convert S(δ) into a p-balanced schedule. This can be done in less than m iterations as described below. It immediately follows from the p-optimality of S(δ) that among the machines with the maximal load in S(δ), there is at least one that admits no p ,→ p movement in S. We construct a new problem instance in which all machines with this property and all jobs scheduled on these machines are removed from the original problem instance. Then, we solve the derived problem instance using the same linear program, and apply algorithm Round to the resultant (partial) optimal distribution to construct a partial p-optimal schedule. We repeat the whole procedure until we come to a partial p-optimal schedule with no machine admitting a p ,→ p movement in it. Since at each iteration at least one machine is eliminated, the total number of iterations cannot be more than m − 1. The resultant pbalanced schedule is clearly obtained by unifying the partial schedule of the last iteration with the partial schedule on each of the eliminated machines. For convenience, we shall denote this p-balanced schedule also by S(δ).

9

4

Phase 2: Building an optimal schedule from a poptimal solution

At Phase 2, we iteratively build an optimal solution to problem R/pji ∈ {p, 2p}/Cmax from the p-balanced schedule S(δ) obtained at Phase 1. At each iteration, we move any short job (i.e., one with processing time p) from a most loaded machine M to a least loaded machine Q with loadS (M ) − loadS (Q) ≥ 3p (breaking ties arbitrarily). Because S(δ) is p-balanced, the chosen job is long on machine Q (i.e., it performs in time 2p on that machine). We repeatedly apply this step until the current schedule cannot be improved. The resultant schedule is optimal for the jobs in Jp . In the last step of Phase 2 we include the jobs from J \ Jp into S(δ) appropriately. Below we give the description of the algorithm and then its correctness proof. Algorithm p, 2p-optimal Step 0 S := S(δ) { set initially the current schedule to S(δ) } Step 1 Determine the machines M and Q, respectively, with the maximal and the minimal, respectively, load in S (breaking ties arbitrarily) IF loadS (M ) − loadS (Q) ≥ 3p THEN Determine any job currently scheduled on M (with processing time p) and move it to Q (with processing time 2p); repeat Step 1 ELSE continue with Step 2 Step 2 Iteratively, schedule the next yet unscheduled job from J \ Jp on the machine in S with the minimal load at that time; update the schedule S. Theorem 2 Algorithm p, 2p-optimal finds an optimal schedule in polynomial time. Proof. First we show that the schedule obtained at Step 1 is p, 2p-optimal for the jobs in Jp . Observe that no long job can ever be scheduled on machine M in Step 1. Furthermore, since S(δ) is p-balanced, any (short) job scheduled on machine M has the processing time 2p on any machine R with loadS (M ) − loadS (R) ≥ 3p, in particular on a least loaded machine Q. Hence, any (short) job from machine M can be moved to machine Q. Obviously, the algorithm will arrive at an iteration in which the move of a (short) job from M to Q cannot further reduce the makespan (that is, loadS (M )−loadS (Q) < 3p), as otherwise a corresponding job would have been moved from M to Q. In fact, at that iteration, we have loadS (M ) − loadS (Q) ≤ 2p. 10

Moreover, since the schedule S(δ) delivered at Phase 1 is p-balanced, there may exist no p ,→ p movement of any job from machine M to machine Q. Hence, the schedule obtained at Step 1 is p, 2p-optimal for the jobs in Jp . Now consider Step 2 and schedule S(2) delivered by this step; let S(1) denote the schedule delivered by Step 1. Suppose M and Q are the machines with the maximal and minimal loads, respectively, in S(2). If the latest scheduled job on M has the processing time p, then clearly, loadS(2) (M ) − loadS(2) (Q) ≤ loadS(1) (M ) − loadS(1) (Q), hence S(2) is optimal for the whole set of jobs. Otherwise, the latest scheduled job on M has the processing time 2p. By the definition of the algorithm and the job processing times, the difference between the loads of the machines M and Q cannot be more than p, i.e., it is either p or 0. Then obviously, S(2) is again optimal. Finally, it can be easily seen that the most time consuming part in our algorithm is that of the construction of a p-balanced schedule, that applies no more than m − 1 times the linear program from Section 2. Hence, the resultant optimal schedule is obtained in polynomial time.

5

A modified approximation algorithm for times p and q

Algorithm p, 2p-optimal can straightforwardly be applied to the problem with two arbitrary processing times p and q, p < q (short and long jobs being redefined correspondingly), with the following slight modification. The inequality loadS (M ) − loadS (Q) ≥ 3p in Step 1 is replaced by loadS (M ) − loadS (Q) ≥ q. Suppose this condition holds and a job (with processing time p) is moved from machine M to machine Q. If the inequality loadS (M ) − loadS (Q) < p + q also holds, then the load of machine M remains more than that of Q after the above rearrangement. Otherwise, suppose q ≤ loadS (M ) − loadS (Q) ≤ p + q. Then after the swap, the load of Q will become more than that of M , but the difference in loads will not exceed p. Hence, it is apparent that after each movement in Step 1, either the load of machine M remains more than that of Q, or the difference in the loads of these machines is no more than q. It follows that the schedule S(1) delivered by Step 1 is either optimal or 11

its makespan is no more than the optimal makespan plus q, i.e., S(1) has an absolute error of q. The same absolute error obviously holds for the schedule S = S(2) delivered by Step 2. We have proved the following result. Theorem 3 The modified algorithm has a worst-case absolute error of q. Let us consider a simple example illustrating the modified algorithm for problem instances with, say, three unrelated machines and jobs with processing times p and q = αp, for some real number α > 1. We consider a typical situation when Phase 1 delivers a p-optimal schedule in which one of the machines, say, machine M3 is overloaded, whereas machines M1 and M2 are under-loaded. Note that the processing times of the jobs scheduled in Phase 1 on machine M3 is q on the machines M1 and M2 . The re-balancing procedure of Phase 2 needs to redistribute the p-length jobs from machine M3 to the machines M1 and M2 (with the resulting processing time q). Let x, y and z with x < y < z be the number of jobs in the p-optimal schedule of Phase 1 on the machines M1 , M2 and M3 , respectively. Suppose we look for a p, q-optimal schedule. Clearly, a p, q-schedule obtained in Phase 2 is optimal if the load of all three machines in it is the same. Let z1 (z2 , respectively) be the number of jobs moved from machine M3 to machine M1 (to machine M2 , respectively) in a p, q-schedule S, whereas z3 = z − z1 − z2 is the number of jobs left on machine M3 . Then schedule S is optimal if xp + z1 αp = yp + z2 αp = (z − z1 − z2 )p. Hence, x + z1 α = y + z2 α = z − z1 − z2 . From these equations, we get z1 = z2 + z − y − y−x α z2 = α+2

y−x , α

and substituting z1 we obtain that

and

z − y − y−x y−x α z1 = + . α+2 α

Thus, our modified approximation algorithm will even build an optimal schedule for any problem instance in which z1 and z2 above are integer numbers. As an example, let x = 8, y = 15, z = 34, p = 4 and α = 1.75, hence q = 7. Then the optimal schedule built by our algorithm has the makespan value 88 with z1 = 8, z2 = 4 and z3 = 22. The schedules constructed in Phase 1 and Phase 2 are illustrated in Fig. 1. In Fig. 1 (a), a p-optimal schedule is depicted, whereas Fig. 1 (b) represents a p, q-optimal schedule constructed by our algorithm for this problem instance. Figure 1

6

Concluding remarks

In this paper, we considered the problem of scheduling a set of jobs on unrelated parallel machines to minimize the makespan, where only two processing times p and q are possible. 12

Such a problem arises in many situations, where some small company or a department of a larger company produces two types of products, each job consists of a single operation and only two processing times are possible. For the only remaining open case of q = 2p, we settled the complexity status by presenting a polynomial-time algorithm for this case. This algorithm can be easily modified to an approximation algorithm with an absolute worst-case error of q for the case q 6= 2p. Thus, this modified algorithm delivers approximate solutions with an objective function value very close to the optimal one for arbitrary processing times p and q, particularly for a large number of jobs. To illustrate, if e.g. the optimal function value is 2000 and the two processing times are p = 3 and q = 5, this means that the maximal absolute error is not larger than 5, which corresponds to a maximal relative error of only 0.25 %. Note that the presented exact and approximation algorithms can also be used as an approximation algorithm for a set of jobs with a few possible processing times when the processing times are grouped around the two processing times p and q (or p and 2p in the special case). So assume e.g. that the possible processing times are p1 = 9, p2 = 10, p3 = 19, p4 = 20 and p5 = 22. For getting an approximate solution, one can use the (exact) algorithm with p∗ = 10 and q ∗ = 2p∗ = 20. Related to the considerations in this paper, for future work, it is a challenging question whether a polynomial-time algorithm with a better approximation exists for the case of two processing times p and q or whether good approximation algorithms exist for the more general case of a fixed but larger set of product types and processing times.

Acknowledgment The first author was supported by Deutscher Akademischer Austauschdienst (DAAD) and by CONACyT grant 160162. The authors are also grateful to Elena Vakhania for her kind participation in the construction of the examples given in Section 5.

References [1] E. Davis and J. M. Jaffe. Algorithms for scheduling tasks on unrelated processors. J. ACM 28, 721 - 736, 1981. [2] M.I. Dessouky, B.J. Lageweg, J.K. Lenstra and S.L. van de Velde, Scheduling identical jobs on uniform parallel machines, Stat. Neerlandica, 44, 115–123, 1990. [3] T. Ebenlendr, M. Kr´al and J. Sgall. Graph Balancing: A Special Case of Scheduling Unrelated Parallel Machines. Proceedings of the nineteenth annual ACM-SIAM symposium on Discrete algorithms, 483–490, 2008. [4] D. K. Friesen. Tighter bound for the MULTIFIT processor scheduling algorithm SIAM J. Comput., 13, 170-181, 1984

13

[5] D. K. Friesen and M. A. Langston. Bounds for MULTIFIT scheduling on uniform processors SIAM J. Comput., 12, 60–70, 1983 [6] L. Fanjul-Peyro and R. Ruiz. Size-reduction heuristics for the unrelated parallel machines scheduling problem. Comp. Oper. Res., 38, 301 – 309, 2011. [7] L. Fanjul-Peyro and R. Ruiz. Iterated greedy local search methods for unrelated parallel machine scheduling. Eur. J. Oper. Res., 207, 55 – 69, 2010. [8] L. Fanjul-Peyro and R. Ruiz. Scheduling unrelated parallel machines with optional machines and jobs selection. Comp. Oper. Res., 39, 1745 – 1753, 2012. [9] R.L. Graham, E.L. Lawler, J.K. Lenstra and A.H.G. Rinnooy Kan. Optimization and approximation in deterministic sequencing and scheduling: A survey. Ann. Discr. Math., 5: 287 – 328, 1979. [10] D. S. Hochbaum and D. B. Shmoys. A polynomial approximation scheme for scheduling on uniform processors: using the dual approximation approach”, SIAM J. Comput., 17, 539-551, 1988 [11] O.H. Ibarra and C.E. Kim. Heuristic algorithms for scheduling independent tasks on non-identical processors. J. ACM 24: 280 – 289, 1977. [12] S.A. Kravchenko and F. Werner. Parallel machine problems with equal processing times: A survey. J. of Sched., 14, 435 – 444, 2011. [13] J.K. Lenstra, D.B. Shmoys and E. Tardos. Approximation algorithms for scheduling unrelated parallel machines. Math. Progr., 46, 259 – 271, 1990. [14] C.N. Potts. Analysis of a linear programming heuristic for scheduling unrelated parallel machines. Discr. Appl. Math., 10, 155 – 164, 1985. [15] E. Shchepin and N. Vakhania. An optimal rounding gives a better approximation for scheduling unrelated machines. Oper. Res. Lett., 33, 127 – 133, 2005. [16] M. Yue. On the exact upper bound for the multifit processor scheduling algorithm. Ann. Oper. Res., 24, 233–259, 1990.

14