Scheduling jobs with release times preemptively on a single machine to minimize the number of late jobs

Scheduling jobs with release times preemptively on a single machine to minimize the number of late jobs

Operations Research Letters 37 (2009) 405–410 Contents lists available at ScienceDirect Operations Research Letters journal homepage: www.elsevier.c...

910KB Sizes 2 Downloads 37 Views

Operations Research Letters 37 (2009) 405–410

Contents lists available at ScienceDirect

Operations Research Letters journal homepage: www.elsevier.com/locate/orl

Scheduling jobs with release times preemptively on a single machine to minimize the number of late jobs Nodari Vakhania ∗ Science Faculty, State University of Morelos, Mexico Inst. of Computational Math., Georgian Academy of Sciences, Georgia

article

info

Article history: Received 6 January 2009 Accepted 6 September 2009 Available online 17 September 2009

abstract We give a direct combinatorial O(n3 log n) algorithm for minimizing the number of late jobs on a single machine when jobs have release times and preemptions are allowed. Our algorithm improves the earlier O(n5 ) and O(n4 ) dynamic programming algorithms for this problem. © 2009 Elsevier B.V. All rights reserved.

Keywords: Algorithm Scheduling Release time Late job Time complexity

1. Introduction We are asked to assign or schedule n jobs J = {1, 2, . . . , n} on a single machine. Each job j ∈ J has the processing time pj (time that it needs on the machine), the release time rj (time moment when it becomes available) and due-date dj (its desired completion time). These are integer numbers. A job might be preempted, i.e., split into portions each portion being assigned at a different time interval to the machine. A (feasible) schedule assigns each job j to the machine at the specified time moment(s) no less than rj with the total duration of pj so that no two jobs are assigned to the machine at any time moment (i.e., job execution intervals cannot overlap in time). A job is late (on time, respectively) if it is completed after (at or before, respectively) its due-date. In our model it is important to complete as many jobs as possible by their due-dates which is our objective, i.e., we aim to minimize the number of late jobs. Without loss of generality, we assume that job release times and due-dates are consecutive, that is, rj + pj ≤ dj , for each j (every job may potentially be completed by its due-date). P Our problem abbreviated 1/rj ; pmtn/ Uj (here Uj is a 0-1 function taking value 1 iff job j is late) is known to be polynomial (though its non-preemptive version is strongly NP-hard). The first polynomial dynamic programming algorithm with the time complexity of O(n5 ) was developed by Lawler [1]. The result was

improved by Baptiste [2] who has suggested another dynamic programming algorithm with the time complexity O(n4 ) (Baptiste also overviews some other related results.). Here we further improve the time complexity proposing a direct combinatorial O(n3 log n) algorithm. The optimal schedule is generated iteratively. At each iteration we deal with a partial ED-schedule generated by the Earliest Due date heuristic (ED-heuristic). We determine which of the currently omitted jobs are to be included at the expense of the omission of some currently scheduled jobs. The number of iterations is bounded by O(n), whereas our decision at each iteration has the cost O(n2 log n). In Section 2 we describe general concepts used in the algorithm including ED-heuristic, our first extension of this heuristic, and the so-called pending gaps. Pending gaps represent the space that potentially might be liberated on the machine by omitting some currently scheduled job. In Section 3 we introduce our basic job substitution tool. Section 4 is dedicated to the final algorithm and the proof of its correctness. We define a general job substitution mechanism and show that it can be reduced to a chain of simpler substitution tools from Section 2. Then we describe our second extension of ED-heuristic which is optimal if certain condition during its execution holds. Finally, we remove this restriction specifying how the case when the condition does not hold can be dealt with. In this way we obtain the third and the final version of our algorithm. 2. Some basics



Corresponding address: Facultad de Ciencias, Universidad Autonoma del Estado de Morelos, Av. Universidad 1001, Cuernavaca 62210, Mor. Mexico. E-mail address: [email protected]. 0167-6377/$ – see front matter © 2009 Elsevier B.V. All rights reserved. doi:10.1016/j.orl.2009.09.003

The late jobs (if any) can arbitrarily be appended to a schedule that contains maximal possible number of on-time scheduled jobs.

406

N. Vakhania / Operations Research Letters 37 (2009) 405–410

In this way we easily obtain an optimal schedule from the former schedule. From now on we shall concentrate our efforts on finding such a schedule which we shall also call optimal. In general, there will be no late job in any schedule we shall be dealing with. We denote by |S | the number of jobs (completed on time) in a schedule S, and by kS k the completion time of the latest completed job (the makespan) in S. We will use S for both, a schedule and the corresponding set of jobs. We apply (preemptive) ED-heuristic for scheduling the jobs: iteratively, among all released jobs by the current scheduling time t, ED-heuristic schedules a job with the smallest due-date ties being broken by selecting a shortest job (further ties are broken arbitrarily). If during the execution of the current job j another job i with di < dj , or with di = dj but with a smaller early completion time is released (i.e., job i if immediately scheduled will be completed earlier than job j), j is interrupted and i is scheduled. We call such a job selected by ED-heuristic at the current scheduling time t the incoming job of time t and denote it by i(t ). Initially, t = min{rj |j ∈ J }. If no incoming job occurs while the currently scheduled job is running then (the current portion of) the latter job completes without any (further) interruption. In general, a scheduling time t is either the release time of the next incoming job or/and the completion time of the latest scheduled job so far. In the latter case either an earlier released job becomes the new incoming job or the next portion of an earlier interrupted job resumes or the new incoming job is released just at the moment when the latest scheduled job completes. Observe that t is the release time of the next incoming job whenever it is preceded by a gap (an idle time interval on the machine). We denote by t + (t − , respectively) the next (the previous, respectively) to t scheduling time, and by S t the schedule constructed to time t. In general, we write t  t 0 if t is a scheduling time occurred after scheduling time t 0 in our algorithm. As we will see later t + < t is possible, in general, we may have t < t 0 for t  t 0 : this may happen as some already scheduled job can be removed from S t and a shorter job scheduled instead. At any scheduling time t the set of the already scheduled jobs can be divided into the ones which are completed by time t and the ones which were interrupted and are not completed by time t. We denote the latter set of jobs by Ut , and denote by u+ the residue of u ∈ Ut ; that is, the part of u yet unprocessed by time t. Note that a new uncompleted job arises only when the incoming job interrupts it. For the auxiliary checking purposes we ‘‘complete virtually’’ jobs in Ut after time t creating respectively the virtual part in S t that starts after time t. We stress here that the virtual part has only an auxiliary purpose: given that S t is feasible all its jobs being completed on time, we wish to know if all the jobs from S t together with job i can also fit on time on the machine. We shall refer to the part of S t before time t as its real part (the partial schedule generated so far). From now on, when referring to an EDschedule S we will mean its both real and virtual parts; however, the makespan kS k will concern only the real part of S. Below we describe how we schedule residues without any interruption in the virtual part. Recall that if i(t ) is more urgent than the currently running job j then i(t ) interrupts j, and j+ is non-empty. In general, we schedule the residues of jobs in Ut applying a dislodged ED-heuristic. Since all jobs up to time t are scheduled by ED-heuristic, each i(t ) has a due-date, no greater than that of any job from Ut . This implies that up to time t, the jobs from Ut are scheduled by the non-increasing order of their due-dates. Each newly included job in Ut has a due-date no greater than that of all earlier included ones. Hence, ED-heuristic will schedule residues of jobs from Ut in the order, reverse to the order in which the completed parts before time t were scheduled. We conserve this order for scheduling residues after time t, but we schedule them as late as possible, without

making them late, as follows. The earliest arisen uncompleted job is scheduled so that it is completed exactly at its due date. Each newly arisen uncompleted job u has a due-date, no greater than that of all earlier arisen uncompleted jobs with already ‘‘scheduled’’ residues. Let τ > t be the starting time of the latest scheduled residue so far. If du ≥ τ then we add u+ so that it completes at time τ ; otherwise, we add u+ so that it completes at time du . As S t was feasible, no overlapping between the residues may occur and each residue will start no earlier than at time t. However, some residue may start before time t + pi (i = i(t )). It may happen of course that among all (yet uncompleted) jobs released by time t, job u ∈ Ut has the smallest due-date. Then u is the lastly arisen uncompleted job and u+ is the earliest started residue in S t . We schedule job u at time t and update the virtual + part for S t by removing the already scheduled part of u+ . Note that + since u was the earliest scheduled residue, no new gap in between the remained residues will occur. If u is no more interrupted and hence completely scheduled, we let Ut + := Ut \ {u}. Otherwise, u is interrupted once again, u+ is updated respectively t + being the release time of the next incoming job. Suppose job j completes at time t and Ut = ∅. Then we will say that the next incoming job (released no earlier than at time t) starts a new block. Each S t is naturally divided into the blocks: at scheduling time t + a new block is initiated if [t , t + ) is a gap (we assume to have a zero-length gap at time t between two blocks if the next incoming job is released right at time t). By scheduling time t, we denote the current block by Bt . If Bt is not newly initiated then either i(t ) interrupts the currently running job or a job from Ut is resumed or an earlier released job that did not become an incoming job now becomes i(t ). Let S = S t . We denote by S (−k), k ∈ S (S (+l), l 6∈ S, respectively) the ED-schedule generated for the job set S \ {k} (S ∪ {l}, respectively) the virtual part being generated by the dislodged ED-heuristic as above. We may generalize these notations straightforwardly substituting k and l by job sets. We will say that the incoming job i can be perfectly scheduled at time t if S t (+i) is a feasible schedule in which all jobs are completed on time. We may observe that i can be perfectly scheduled only if the latest arisen residue (the first one from the virtual part) starts at or after time t + pi in S t (+i) (as otherwise the overlapping will occur). Let us call a job set feasible if there exists a feasible schedule in which all the jobs from this set are scheduled on time. The following observation is easily verified: Observation 1. If i(t ) cannot be perfectly scheduled then the job set S ∪ {i} is not feasible. It follows that if i = i(t ) cannot be perfectly scheduled then either i is late in S t (+i) or/and it overlaps with the virtual part. Iteratively at each scheduling time t we start job i(t ) at time t if it can be perfectly scheduled. The real part of the resultant schedule + S t = S t (+i) now extends up to time t + . It is less straightforward the case when i cannot be perfectly scheduled. We introduce some extra definitions first. We will say that the incoming job i is disregarded (omitted, respectively) if it is discarded at time t and is never again considered for the inclusion (discarded at time t but can later again be considered for the inclusion, respectively). An omitted job at time t is placed into our current reserve list Lt . We say that S t cannot be enlarged if there exists no feasible set with |S t | + 1 jobs from S t ∪ Lt ∪ {i(t )}. This means that i(t ) cannot be scheduled on time even by removing any subset of already scheduled jobs from S t and including at least the same amount of jobs from Lt instead. σ , a subset of jobs in S t , is said to give an admissible choice at time t if the job set S t \ σ ∪ {i} is feasible. When σ is a singleelement set, a job giving an admissible choice will be referred to

N. Vakhania / Operations Research Letters 37 (2009) 405–410

as an admissible job. We shall refer to the earliest scheduling time t on which k ∈ S t gives an admissible choice as the check-in time of k, denoted by τ (k). EED-Algorithm_1. Our fist extension of ED-heuristic, EEDAlgorithm_1 for short, is as follows. At each scheduling time t, include i(t ) from time t till the next scheduling time if i(t ) can be perfectly scheduled; otherwise, omit i(t ). There may occur no late job in the resultant schedule, and this schedule is clearly optimal if each incoming job is perfectly scheduled. Due to Observation 1, EED-Algorithm_1 remains optimal if a single incoming job (that could not have been perfectly scheduled) was omitted. In what follows, we develop a procedure to treat a general case when two or more incoming jobs that cannot be perfectly scheduled occur. Pending gaps and filling jobs. If the incoming job i(t ) cannot be perfectly scheduled then either i(t ) itself or some already scheduled job from S t is to be omitted (Observation 1). It is easy to see that an appropriate candidate for the omission is to be an admissible job j ∈ S t . We shall refer to the set of all time intervals occupied by j in S t as the (potential) liberated space by j denoted by Ij . If we omit job j then the intervals from Ij will be used by other jobs of S t and/or the incoming job(s). In S t (−j), some intervals from Ij or their parts may remain idle, and because of a possible left-shift of some jobs from S t , there may also occur gaps after the intervals from Ij . We call either of these idle intervals which may potentially be arisen (in case j is omitted) (potential) pending gaps of j at time t and denote the corresponding set by pgt (j). Recall that if i = i(t ) cannot be perfectly scheduled then either (1) i is late or (2) i is not late but it overlaps with the virtual part of S or (3) i is late and it also overlaps with the virtual part of S. Assume i is late (cases (1) and (3)). As job release times and due-dates are consecutive, i must have been released before time t, hence it is delayed by some already scheduled job(s). There is at least one j ∈ S t at least as urgent as i and completed by time t (in particular, the latest scheduled job in S t has this property). The left-shift by j ∈ S t in favor of job i is the difference kS t k + pi − kS t (−j + i)k, and kS t k−kS t (−j)k ≤ pj is the left-shift just by job j (in these formulas only the corresponding real parts are considered). Let us further examine jobs in S t that might be beneficially moved in favor of job i, i.e., admissible jobs. From the block definition, no job from some block preceding Bt may have such property (as no job from Bt might be left-shifted if a job from a preceding block is (re)moved). Even not every job in Bt has this property. If for a j ∈ Bt , dj ≥ di then due to ED-heuristic, neither job i nor any more urgent job could have been released during the execution of j. Hence, none of these jobs might be leftshifted if j is (re)moved (intuitively, such js are harmless jobs to be left in peace whenever there will be enough space to schedule their residues). Moreover, no job scheduled in Bt before the latest scheduled portion of such j can have the desired property. So among all j ∈ Bt with dj ≥ di let the portion of job k be the latest scheduled one. Let us call any admissible job scheduled in Bt after that portion of job k a category I job (if there is no such k then all admissible jobs in Bt are category I jobs). The left-shift yielded by each category I job j in favor of i is at least min{pi , pj } if j is started no earlier than at time ri . Job i cannot be immediately scheduled within the liberated space by j if j is completed by time ri . In this case, the jobs which were scheduled after j might be successively left-shifted (by ED-rule, all these jobs will be less urgent than j). Since a category I job is more urgent than i, it can have no residue at time t. As above noted, if we omit the real part of any job from Bt scheduled before all category I jobs, then neither job i nor any category I job can be left-shifted. Hence, there may exist an admissible job from Bt which is not a category I job only if i overlaps with the virtual part of S t in S t (+i), and then we face case (2) above. We call this intersection the conflict interval and will refer to the corresponding admissible jobs in Bt (scheduled before all category I jobs) as the category II jobs.

407

So there may occur a left-shift in S t (−j + i(t )) only if j is a category I job; if there remains a space unused by the left-shifted jobs, some residue(s) may also be scheduled within that space. If there still remains an unused space, the pending gaps after the intervals from Ij will arise. A pending gap of j might either be from the real part of S t (a real pending gap of j) or it might also be from its virtual part (a virtual pending gap of j). A virtual pending gap of j will arise only if ED-heuristic has ‘‘moved’’ a residue to the real part in S t (−j). The set pgt (j) will be altered if some of its interval(s) can potentially be occupied by the next incoming job i = i(t ) that can be perfectly scheduled (and hence is included). In S t (−j + i), job i would be left-shifted (compered to its location in S t (+i)) and the remained idle time intervals (released by i and/or possibly some other successively left-shifted jobs) will become new pending gap(s) of j. Observe that the total length of the pending gaps of j will not be altered. Suppose now i(t ) cannot be perfectly scheduled and hence is omitted, whereas j gives an admissible choice at time t. We call any such an omitted job a (potential) filling job of j, and refer to jobs with a common filling job as correlated. We denote by Ft (j) the set of filling jobs of j by time t. We shall refer to j as a pending job at time t if Ft (j) 6= ∅. A filling job of j may potentially be included into a later generated ED-schedule at the expense of the omission of job j. Meanwhile, such a job does not affect the current pgt (j). Note that in all above definitions j is an admissible job that remains scheduled (we just consider a possibility of its omission). 3. Swaps and substitutions Suppose that ι = i(τ ) cannot be perfectly scheduled and is omitted by EED-Algorithm_1, and that neither the incoming job i = i(t ) can be perfectly scheduled at time t  τ . Clearly, S t cannot be enlarged if there is no k ∈ S t with the feasible S t \ {k} ∪ {ι, i}. Otherwise, ι and i must be filling jobs of k, and k must have been given an admissible choice at times τ and t. So it is apparent that EED-Algorithm_1 is optimal unless there occurs a scheduling time t as indicated. We shall incorporate a corresponding substitution into EED-Algorithm_1 (so far, each k remained scheduled). Let D ⊆ Ft (k). The (normal) swap k ←- D accomplishes the substitution of job k with jobs from D (using the gaps from pgt (k)): it omits k and schedules jobs in D ∪ S \ {k} by ED-heuristic, also + + updating the current reserve list: S t := S t (−k + D), Lt := Lt \ D ∪ {k}. The swap k ←- D (the set D) is feasible if S t (−k + D) is feasible. We shall only deal with feasible swaps. Observe that any feasible swap yields the same or higher number of on-time scheduled jobs. k ←- D is ascending whenever |D| ≥ 2. We will complete EED-Algorithm_1 accomplishing an ascending feasible swap as soon as such a possibility occurs; i.e., as soon as a feasible D ⊆ Ft (k) with |D| = 2 can be formed, for some pending job k. Since job release times and due-dates are consecutive, if the next i = i(t ) cannot be perfectly scheduled then it must be a filling job of at least one k ∈ Bt giving an admissible choice. If for all such ks i is the only filling job then it can clearly be omitted at time t (moved to the reserve list Lt ). Suppose t is the first time point in which |Ft (k)| = 2 and k ←- Ft (k) is a feasible swap k being the latest scheduled job having this property. We carry out the swap k ←- Ft (k) at time t + . Since for each pending job j and t 0 ≺ t we had |Ft 0 (j)| = 1 and job i gets scheduled at time t, |Ft + (j)| can be at most 1. Suppose for some pending jobs j ∈ S t |Ft (j)| becomes 2 but for none of the js Ft (j) is feasible (no ascending swap can be carried out), but there is k ∈ S t with the property that job i is completely ‘‘absorbed’’ within the space that might be released by k, that is, kS t (−k + i)k < kS t k. Then k is called an absorbent job at time t.

408

N. Vakhania / Operations Research Letters 37 (2009) 405–410

Among all absorbent jobs at time t we also break ties selecting the latest scheduled one, say k, and we carry out the swap k ←- i. We have seen in Section 2 that the set of pending gaps of a + pending job j ∈ S t can be altered when the new incoming job is scheduled. It can also be altered if the substitution of job k with jobs from D is carried out at time t, as new gaps after that substitution may arise (the space released by k may exceed the space used by jobs in D). We shall update pgt + (j) in either of these cases by actually generating a partial ED-schedule for the corresponding left-shifted jobs. For the technical convenience, we also include the above newly arisen gaps into pgt + (j) (so, pgt + (j) will contain every available interval for scheduling the filling jobs of j in case it is omitted). Since there are less than n pending jobs, the total cost of the update of pending gaps of all pending jobs at time t is O(n2 log n). If none of the above types of substitutions can be carried out at time t then i(t ) is omitted the set of filling jobs of each corresponding pending job being completed by job i. So, there will arise pending jobs k with |Ft (k)| > 1 and such that no two jobs in Ft (k) form a feasible group. Assume |Ft (k)| just becomes 2 (being non-feasible). Then Ft (k) = {i(τ ), i(t )}, where τ is the check-in time of k. By EDheuristic, if among jobs scheduled in S t after time τ there is one which is more urgent than i(τ ) then it must have been released after time τ , and also must be shorter than i(τ ) (as otherwise it could not have been scheduled on time). At each successive scheduling time t 0 , the current Ft 0 − (k) is to be complemented by i(t 0 ) if it cannot be perfectly scheduled being a filling job of k. In general, this job may or may not form a feasible set with a job from Ft 0 − (k): let us call Ft (k) a conflict set at time t if for every l, m ∈ Ft (k) the set S t \ {k} ∪ {l, m} is not feasible (we will also say that these jobs conflict). We have too many conflict jobs to be scheduled. We may discard some of them using the following dominance relation. Let l and j be conflicting jobs in Ft (k) with rl ≤ rj , and let cj be the completion time of j in S t (−k + j). Then j dominates l, written j dom l, if cj ≤ cl . It is easily verified that this is a transitive relation and that the following lemma holds:

4. Schedule alterations

Lemma 1. If j dom l then l can be discarded. In particular, if any of the future incoming jobs will conflict with j then it will also conflict with l.

Lemma 3. A non-descending schedule alteration that is not of the form 1 1 or 1 2 is not atomic. Furthermore, any sequence of ascending schedule alterations can be decomposed into an equivalent sequence of atomic schedule alterations of the form 1 1 and 1 2.

Thus we wait until the earliest time moment t such that i = i(t ) forms a feasible set with one of the jobs from Ft (k). We can of course verify this condition for each j ∈ Ft (k) by forming the corresponding ED-schedule S t (−k + j + i). But this can be done more efficiently using the pending gaps of k. For j ∈ Ft (k), consider the gaps in pgt (k) after time moment rj . Since j is more urgent than i it will occupy all these gaps in S t (−k + j + i) unless their total length is more than pj ; in the latter case j will completely be scheduled within the gaps in pgt (k). Otherwise, let πj be the portion of j that did not fit within the gaps in pgt (k). Further, let θi (j) be the total gap length in pgt (k) between time moments ri and rj if ri < rj , otherwise let θi (j) be 0. Then the portion of job i of the length min{θi (j), pi } will be scheduled within the gaps in pgt (k) before job j in S t (−k + j + i); let πi (j) be the rest of job i. It follows that job i will form a feasible set with j ∈ Ft (k) with the minimal πj +πi (j) if there exists such a job in Ft (k). We can easily check this condition for each j in a constant time. Hence the cost of the verification/forming a feasible dependent set for a particular pending job k is O(n). We first verify the condition for the latest scheduled pending job, in case of failure we try the next latest scheduled pending job, and so on. Hence the total cost of the verification/forming a feasible dependent set at time t is O(n2 ). If no feasible set could have been formed then the set of filling jobs of each corresponding pending job is completed by job i which yields the total cost of O(n).

We have introduced feasible swaps in Section 3. Now we define a similar but a more general notion to represent any job rearrangement (substitution), useful, in particular, for the soundness proof of the algorithm. A schedule alteration (an alteration for short) At (o ι), o, ι ∈ N + , yields a job rearrangement that omits some o jobs scheduled in S t and includes ι jobs from Lt so that in the resultant schedule no job is late (we may omit some parameters in At (o ι) when this will cause no confusion). Technically, this schedule is obtained by the application of ED-heuristic to the altered job set. Observe that feasible swap k ←- D is a schedule alteration of the form A(1 |D|). Given some initial scheduling time t, let us denote by {A} a sequence of schedule alterations the first of which is to be applied at time t (to the job set S t ), the second alteration is to be applied + at time t + (to the job set S t ), and so on, each next alteration from {A} is to be applied at the currently derived scheduling time to the current job set. A schedule alteration At (o ι) is non-descending (ascending, respectively) if ι ≥ o (ι > o, respectively). The growth of a nondescending schedule alteration is grow th[A(o ι)] = ι − o. We define similarly the overall growth, grow th[{A}] for the sequence {A} summing up all terms ι − o for each alteration in {A}. We call a sequences of schedule alterations {A} and {A0 } equivalent if they result in the same job rearrangement; i.e., the resultant sets of omitted and included jobs and hence the resultant schedules are the same (in particular, grow th[{A}] = grow th[{A0 }]). The Lemma 2 straightforwardly follows: Lemma 2. With each sequence of schedule alterations a unique equivalent schedule alteration is associated. Furthermore, a sequence of ascending schedule alterations yielding an optimal schedule can be incorporated into EED-Algorithm_1. We call a non-descending alteration atomic if there exists no equivalent sequence of 2 or more non-descending schedule alterations. Clearly, alterations of the form 1 1 and 1 2 are atomic. No other type of an atomic schedule alteration exists:

Proof. We illustrate the proof idea for an alteration of the form 2 3. Let k1 and k2 be the jobs to be omitted, and l1 , l2 and l3 be the jobs to be included. We have to include one more job than we omit. Then, as it is easily seen, one of the swaps kι ←- lκ must be feasible, 1 ≤ ι ≤ 2, 1 ≤ κ ≤ 3. Hence, we have one schedule alteration of the form 1 1. Without loss of generality, suppose it corresponds to the swap k1 ←- l1 . Then clearly, the swap k2 ←- {l2 , l3 } must be another feasible swap. Hence, the initial alteration of the form 2 3 was decomposed into two atomic alterations of the form 1 1 and 1 2. We can apply a similar construction to any nondescending schedule alteration.  Our next extension of ED-heuristic, EED-Algorithm_2, incorporates non-descending schedule alterations of the form (1 2) and (1 1) (an absorbent schedule alteration) into EED-Algorithm_1: At each scheduling time t, schedule i(t ) if it can be perfectly scheduled. Otherwise, if there exists a pending job k such that i = i(t ) forms a feasible set Dt (k) = {i, j}, for some j ∈ Ft (k) then carry out the swap k ←- Dt (k) (breaking ties by selecting the latest scheduled k and j yielding the minimal kS t (−k + Dt (k))k) (we call (k, Dt (k)) the substitution pair of time t and k the substitution job). Else, if there exists an absorbent job, substitute the latest scheduled absorbent job with i(t ), i.e., carry out the swap k ←- i(t ). Else (none of the above can be done), omit i(t ). Based on the above two lemmas, we can say that there exists an optimal ED-rule based

N. Vakhania / Operations Research Letters 37 (2009) 405–410

algorithm with atomic schedule alterations. We will soon come to such an algorithm completing EED-Algorithm_2. Lemmas 2 and 3 motivate, in the straightforward way, the following definition. An (atomic) alteration (swap) At omitting job k remains sound (by time τ , τ  t) if there exists no ascending schedule alteration including job k (at the scheduling times up to time τ ). Whether At is sound at time τ depends on the release times of the incoming jobs between times t and τ (for example, At clearly remains sound if all above incoming jobs are released after time kS t (−k + Dt (k))k). Lemma 4. EED-Algorithm_2 is optimal if every accomplished (atomic) alteration remains sound (by the latest occurred scheduling time). Proof. The proof is more or less straightforward. We give a sketch. By Lemma 2 it will suffice to show that there may exist no ascending schedule alteration. By Lemma 3, any such alteration can be decomposed into a sequence of atomic schedule alterations. Let us now see what kind of atomic schedule alterations including any omitted job may exist. First recall that every omitted job is either an omitted incoming job or a substitution job. The latter case needs no special treatment here as every schedule alteration remains sound (so there may exist no ascending schedule alteration including any omitted substitution job). In the former case, we know that any omitted incoming job j is a filling job of at least one currently scheduled job. Since j was not included, there existed no corresponding absorbent alteration. A non-absorbent alteration of the form 1 1 may only make late some currently scheduled job(s) and cannot be of any benefit. Now, an alteration of the form 1 2 including job j is either not feasible or will force the omission of some alternative filling job j0 which has been included by EED-Algorithm_2. The former case is obvious, whereas recall that in the latter case ties should have been broken by selecting j0 yielding the minimal makespan and hence the minimal right-shift for the later scheduled jobs. Similarly as above, by including job j and omitting j0 we may only make some currently scheduled job late and this cannot give us any benefit. Thus there are no atomic alterations including any omitted jobs that may result in an ascending schedule alteration, which proves the lemma.  Due to the above lemma, we will complete our algorithm by specifying how to deal with schedule alterations that do not remain sound. We will say that k ∈ Lt can be freely returned at time t if S t ∪ {k} is feasible. Lemma 5. If the swap k ←- Dt (k) does not remain sound by time t 0  t then job k can be freely returned at time t 0 . Proof. The proof is quite simple and straightforward. We give some details. We need to verify whether there arises an ascending schedule alteration re-including job k at time t 0 . Such an alteration 0 cannot exist if all jobs from D = Dt (k) remain in S t and no job correlated with k was omitted from time t to time t 0 . Suppose first no such correlated job was omitted while some job(s) from D have been omitted by time t 0 . Such a job j could have been omitted only if it was selected as a substitution job; some filling jobs of j should have been included instead. If after the re-inclusion of k one of these jobs become late then the corresponding swap cannot be ascending and hence k ←- Dt (k) remains sound. Otherwise, k can be freely returned. Now, if some job l correlated with k was omitted then some job(s) from D could have been potentially rescheduled within the pending gaps of l. Similarly as above, if after the reinclusion of k a job scheduled within the pending gaps of l become late then the swap k ←- Dt (k) remains sound. Otherwise, k can be freely returned.  Below we give a formal description of our final algorithm which complements the EED-Algorithm_2 by verifying if any of the

409

omitted substitution jobs can be freely returned (by our conven+ tion, S t := S t (+i) yields scheduling of job i = i(t ) from time t up to the next scheduling time t + )): EED-Algorithm_3 + + initial settings: t + := min{rj |j ∈ J }; S t := ∅; Lt := ∅; BEGIN PROCEDURE MAIN IF there exists i(t + ) THEN t := t + ; PROCESS(i(t)) ELSE STOP END PROCEDURE MAIN BEGIN PROCEDURE PROCESS(i) + IF i can be perfectly scheduled THEN S t := S t (+i) ELSE IF there exists an admissible k with feasible Dt (k) {Dt (k) = {i, l}, for some l ∈ Ft (k)} + THEN S t := S t (−k + Dt (k)); {break ties by selecting the latest scheduled k (the substitution job of time t)} FOR each substitution job j that can be freely returned + + {include that job} S t := S t (+j) ELSE {there is no feasible set with two jobs} IF there is an absorbent job + THEN select the latest scheduled one k; S t := S t (−k + i) + ELSE {omit i} Lt := Lt ∪ {i} END PROCEDURE PROCESS(i). Theorem 1. EED-Algorithm_3 finds an optimal schedule in time O(n3 log n). Proof. The soundness part immediately follows from Lemmas 4 and 5. As to the time complexity, first we note that the total number of scheduling times is O(n). Indeed, at any scheduling time an incoming job is either a new (yet unconsidered) job or it is a job from the current virtual part. The total number of scheduling times corresponding to the first case equals to the number of the new incoming jobs, i.e., it is n. In the second case, a job from the current virtual part may become an incoming job for the second, third or more times. But such a job, if not completely scheduled, might be interrupted only by a new arrived incoming job. Then the total number of times on which all jobs from the virtual part may become an incoming job is O(n). Hence, the total number of scheduling times is O(n). If all incoming jobs can be perfectly scheduled then EEDAlgorithm_3 behaves as ED-heuristic with the time complexity O(n log n). Suppose the incoming job i = i(t ) cannot be perfectly scheduled. We first verify whether a substitution might be accomplished at time t. For that, we check whether there are pending jobs in S t for which i(t ) becomes a filling job. We try such pending jobs in the decreasing order of their ordinal numbers in S t starting with the latest scheduled job in S t . As we saw at the end of Section 3, the cost of the verification/forming of a feasible set at time t is O(n2 ). We include each substitution job j that can be freely returned with the total cost bounded by O(n2 log n). If for none of the pending jobs there could have been formed a feasible set, we verify whether there exists an absorbent job in S t and carry our the corresponding substitution processing the jobs in the same order as above. The cost of this is O(n). We omit i(t ) if none of the above can be done. In addition to the above operations, we recalculate the set of pending gaps of each pending job by generating the corresponding ED-schedule, that takes time O(n log n) for each job. Hence, the total cost at each scheduling time t is O(n2 log n), and since the total number of scheduling times is O(n), the overall cost is O(n3 log n).  Acknowledgements This work was partially supported by CONACyT grant 48433. The author is also grateful to Christoph Durr for the hospitality and

410

N. Vakhania / Operations Research Letters 37 (2009) 405–410

useful discussions, and to one of the anonymous referees for the very careful reports which have helped essentially to improve the presentation. This work, in a preliminary form, has appeared in the proceedings of the 4th Multidisciplinary International Scheduling Conference MISTA 2009.

References [1] E.L. Lawler, A dynamic programming algorithm for preemptive scheduling of a single machine to minimize the number of late jobs, Annals of Operations Research 26 (1990) 125–133. [2] P. Baptiste, An O(n4 ) algorithm for preemptive scheduling of a single machine to minimize the number of late jobs, Operations Research Letters 24 (1999) 175–180.