Advanced Single Machine Models (Deterministic)
Algorithm 4.1.4 Minimizing Total Earliness and Tardiness with Tight Due Date)
Step 1.
Initializeτ1=dandτ2= pj−d.
Initializek= 1.
Step 2.
Ifτ1> τ2, assign jobkto the first unfilled position in the sequence and decreaseτ1 by pk.
Ifτ1< τ2, assign jobkto the last unfilled position in the sequence and decreaseτ2 by pk.
Step 3.
Ifk < n, increase kby 1 and go to Step 2.
Ifk=n, STOP. ||
Example 4.1.5 (Minimizing Total Earliness and Tardiness with Tight Due Date)
Consider the following example with 6 jobs andd= 180.
jobs 1 2 3 4 5 6
pj 106 100 96 22 20 2
Applying the heuristic yields the following results.
τ1 τ2 Assignment Sequence 180 166 Job 1 Placed First 1,*,*,*,*,*
74 166 Job 2 Placed Last 1,*,*,*,*,2 74 66 Job 3 Placed First 1,3,*,*,*,2 -22 66 Job 4 Placed Last 1,3,*,*,4,2 -22 44 Job 5 Placed Last 1,3,*,5,4,2 -22 12 Job 6 Placed Last 1,3,6,5,4,2
||
Cost function
d Time
Fig. 4.1Cost functions with common due date and different shapes
Cost function
d2
d1 d3 Time
Fig. 4.2Cost functions with different due dates and similar shapes
Consider now the objective
wEj+
wTj and assume again that all the due dates are the same, i.e.,dj =d, for allj. All jobs have exactly the same cost function, but the earliness penaltyw and the tardiness penaltyware not the same. All previous properties and algorithms can be generalized relatively easily to take the difference betweenw andwinto account (see Exercises 4.13 and 4.14).
Consider the even more general objective
wjEj +
wjTj, with dj = d for all j. So all jobs have the same due date, but the shapes of their cost functions are different, see Figure 4.1. The LPT-SPT sequence of Lemma 4.1.1 is in this case not necessarily optimal. The first part of the sequence must now be ordered in increasing order of wj/pj, i.e., according to Weighted Longest Processing Time first (WLPT) rule, and the last part of the sequence must be ordered according to the Weighted Shortest Processing Time first (WSPT) rule.
Consider the model with the objective function
wEj+
wTj and with each job having a different due date (see Figure 4.2). It is clear that this prob- lem is NP-hard, since it is a more general model than the one considered in Section 3.4. This problemhas an additional level of complexity. Because of the different due dates, it may not necessarily be optimal to process the jobs one after another without interruption; it may be necessary to have idle times between the processing of consecutive jobs. This problemhas therefore two as- pects: one aspect concerns the search for an optimal order in which to sequence the jobs and the other aspect concerns the computation of the optimal starting
74 4 Advanced Single Machine Models (Deterministic) times and completion times of the jobs. These two optimization problems are clearly not independent. Determining the optimal schedule is therefore a very hard problem. Approaches for dealing with this problem are typically based on dynamic programming or branch-and-bound. However, given a predetermined and fixed sequence, the timing of the processing of the jobs (and therefore also the idle times) can be determined via a relatively simple polynomial time al- gorithm. This polynomial time algorithm is also applicable in a more general setting that is described next.
The most general setting has as objective
wjEj+
wjTj, where the jobs have different due dates and different weights. This problemis clearly strongly NP-hard, since it is harder than the total weighted tardiness problemconsidered in Section 3.6. But, given a predetermined ordering of the jobs, the timings of the processings and the idle times can be computed in polynomial time. Some preliminary results are necessary to describe the algorithm that inserts the idle times in a given sequence. Assume that the job sequence 1, . . . , nis fixed.
Lemma 4.1.6. Ifdj+1−dj≤pj+1, then there is no idle time between jobs j andj+ 1.
Proof. The proof is by contradiction. Consider three cases: Jobjis early (Cj <
dj), job j is completed exactly at its due date (Cj = dj), and job j is late (Cj > dj).
Case 1: If jobj is completed early and there is an idle time between jobsj andj+ 1, then the objective can be reduced by postponing the processing of jobjand reducing the idle time. The schedule with the idle time can therefore not be optimal.
Case 2:If jobj is completed at its due date and there is an idle time, then jobj+ 1 is completed late. Processing jobj+ 1 earlier and eliminating the idle time, reduces the total objective. So the original schedule cannot be optimal.
Case 3:If jobj is completed late and there is an idle time, then jobj+ 1 is also completed late. Processing jobj+ 1 earlier reduces the objective.
Subsequenceu, . . . , vis called a job cluster if for each pair of adjacent jobsj andj+ 1 the inequality
dj+1−dj≤pj+1
holds and if forj =u−1 andj =v the inequality does not hold. A cluster of jobs must therefore be processed without interruptions.
Lemma 4.1.7. In each cluster in a schedule the early jobs precede the tardy jobs. Moreover, if jobsj andj+ 1belong to the same cluster and are both early, thenEj≥Ej+1. If jobsj andj+ 1 are both late then Tj≤Tj+1. Proof. Assume jobs j and j+ 1 belong to the same cluster. Lett denote the optimal start time of jobj. Subtractingt+pj fromboth sides of
dj+1−dj≤pj+1
and rearranging yields
dj+1−t−pj−pj+1≤dj−t−pj. This last inequality can be rewritten as
dj−Cj≥dj+1−Cj+1,
which implies the lemma.
The given job sequence 1, . . . , ncan be decomposed into a set ofmclusters σ1, σ2, . . . , σmwith each cluster representing a subsequence. The algorithmthat inserts the idle times starts out with the given sequence 1, . . . , n without idle times. That is, the completion time of thekth job in the sequence is
Ck= k j=1
pj.
Since the completion times in the original schedule are the earliest possible completion times, the algorithm has to determine how much to increase (or shift) the completion time of each job. In fact, it is sufficient to compute the optimal shift for each cluster since all its jobs are shifted by the same amount.
Consider a clusterσr that consists of jobsk, k+ 1, . . . , ,. Let
∆j = j l=k
wl− l=j+1
wl, j=k, . . . , ,.
These numbers can be computed recursively by setting
∆k−1=− l=k
wl, and
∆j =∆j−1+wj+wj, j=k, . . . , ,.
Define a block as a sequence of clusters that are processed without inter- ruption. Consider blockσs, σs+1, . . . , σm. Such a block may have one or more clusters preceding it, but no clusters following it. Letjrbe the last job in cluster σr that is early, i.e., the job with the smallest earliness. Let
E(r) =Ejr =djr−Cjr. Clearly
E(r) = m in
k≤j≤jr
(dj−Cj).
76 4 Advanced Single Machine Models (Deterministic) Let
∆(r) =∆jr = m ax
k≤j≤jr∆j.
If none of the jobs in clusterσris early, thenE(r) =∞and∆(r) =− l=kwl. Ifdjr−Cjr ≥1 for the last early job in every cluster σr, r=s, s+ 1, . . . , m, then a shift of the entire block by one time unit to the right decreases the total cost by
m r=s
∆(r).
The idea behind the algorithmis to find the first block of clusters that cannot be shifted. If such a block is found, then this block stays in place and the procedure is repeated for the set of remaining clusters. If no such block is found, then all remaining clusters are shifted by an amount that is equal to the smallestE(r); in one of the shifted clusters the last early job becomes an on-time job. All the completion times are updated and all the non-early jobs are removed from the list of each cluster. The procedure is then repeated. The algorithmterminates once a block involving the last cluster cannot be shifted.
The algorithm can be summarized as follows.
Algorithm 4.1.8 (Optimizing the Timings Given a Sequence)