Solution Smith Rule
Solution Smith Rule
Solution Smith Rule
To find its solution, let us generate all possible permutations of jobs and compute the completion times for the resulting schedules.
10
11 12 13 14 15 16 17
18 19 20 21
22 23
In the example above, the jobs in the optimal schedule are arranged in increasing (non-decreasing) order of their processing times. The rule that sorts the jobs in this order is known as SPT (shortest processing time), i.e., the next job to be scheduled will be the job with the smallest processing time. In general, take n jobs in order (1, 2, , n) and compute their completion times: C1 C2 Cn-1 Cn 1Cj = = p1 p1 p1 p1 np1 + p2 p2 + + p2 + + pn-1 pn-1 + Pn Pn
1
= = = + + +
(n-1)p2 + + 2pn-1 +
Thus, job 1 contributes np1, job 2 contributes (n-1)p2, and so on. If we want to minimize 1Cj, we want p1 to be the smallest, p2 the second smallest, etc. 25 7
7 7 7 j we need to sort the jobs in SPT order. As any 37
7 974 7 48 98 6 8 58 9 9 7 9 9 7 other sorting, this requires O(nlog n) time.
Find an optimal sequence ____________________________________________ and the optimal value of the objective function ____________________________
If all processing times are equal (pj=1) then the problem can be solved by ______________________ __________________________________________________________________________________
For problem 1| |1wjCj intuitively we want to combine the rule above with SPT. It seems logical to sort the jobs in non-decreasing order of the ratios pj /wj. We call this rule WSPT (weighted SPT) rule or Smith's rule due to W.E. Smith who introduced it in 1956. We can prove Theorem 1. For 1|| wjCj, the WSPT rule is optimal.
Proof (adjacent pairwise interchange argument) Suppose a schedule S, which is not WSPT, is optimal. In this schedule there must be at least two adjacent jobs i and k such that pi /wi > pk /wk. We assume that i precedes k and i starts at time t.
k
t+pi
Swapping jobs i and k leads to a schedule S. We compare the value of the objective function F = wjCj for schedules S and S:
F (S ) = F (S ' = )
j i ,k
w C
j j j i ,k
+ wi C i + wk C k =
' + wi C i' + wk C k =
w C
F ( S ' F ( S ) = wi p k wk pi < 0. )
This contradicts the optimality of schedule S and completes the proof of the theorem.
t+pi +pk
j i ,k
w C
j j j i , k
+ wi (t + pi ) + wk (t + pi + p k ) + wk (t + p k ) + wi (t + pi + p k )
w C