Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ecole Polytechnique, Nov 7, 2007 1 Minimizing Total Completion Time Each job specified by  procesing time (length p j )  release time r j Goal: compute.

Similar presentations


Presentation on theme: "Ecole Polytechnique, Nov 7, 2007 1 Minimizing Total Completion Time Each job specified by  procesing time (length p j )  release time r j Goal: compute."— Presentation transcript:

1 Ecole Polytechnique, Nov 7, 2007 1 Minimizing Total Completion Time Each job specified by  procesing time (length p j )  release time r j Goal: compute a schedule (preemptive or not) that maximizes the total completion time all integer C j = completion time of j in a given schedule In Graham’s notation:  Non preemptive version: 1|r j,p j |∑C j  Preemptive version: 1|r j,p j,pmtn|∑C j

2 Ecole Polytechnique, Nov 7, 2007 2 Preemptive Scheduling Example: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 Schedule A ∑C j = 4+7+8+9+11+12 = 51 Schedule B ∑C j = 1+2+3+5+6+9+12 = 38

3 Ecole Polytechnique, Nov 7, 2007 3 Online version: jobs are revealed at their release time algorithm must execute a job without knowing future jobs Note: different from list scheduling! (Decision time = processing time) Algorithm SRPT: At each step schedule the job with the shortest remaining processing time Theorem: Algorithm SRPT computes an optimal solution (that is, SRPT is 1-competitive) Example: Schedule B on previous slide is SRPT

4 Ecole Polytechnique, Nov 7, 2007 4 Proof: Exchange agument. Convert any schedule S into one satisfying the SRPT rule. Take any jobs i and j in S. W.l.o.g. assume r i ≤ r j. Let T = set of time slots occupied by i and j starting at r j ijijjjjiiiiiijj rjrj riri at r j : b units of j and a≤b units of i unit a+b in T ijijjjjiiiiiijj rjrj riri Reschedule i and j within T using SRPT: unit ≥ a in T unit a+b in T unit a in T So ∑C j cannot increase !!!

5 Ecole Polytechnique, Nov 7, 2007 5 So we know: that one SPRT-reschedule does not increase ∑C j let k = minimum length job with r k = 0 SRPT will schedule one unit of k at time 0 start with any schedule Q repeat: apply SRPT-reschedule to all pairs i,j until Q does not change phase after phase 1, one unit of k will be scheduled at time 0 in Q and will remain there So Q and SRPT are the same at time unit 0 after phase 1 We can modify the instance: change p k = p k -1 change all release times r j =0 to r j =1 and apply the argument recursively to the new instance Thus we convert Q into SRPT without increasing ∑C j So ∑C j (SRPT) ≤ ∑C j (Q)

6 Ecole Polytechnique, Nov 7, 2007 6 Non-Preemptive Scheduling Example: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 Schedule A ∑C j = 4+7+8+9+11+12 = 51 Schedule C ∑C j = 2+3+5+6+10+13 = 39 Schedule B ∑C j = 4+5+6+7+9+11 = 42

7 Ecole Polytechnique, Nov 7, 2007 7 Algorithm SPT: at each step, when no job is running, execute the job with shortest processing time Question: Is SPT’s schedule optimal? Intuition: If a big job is pending, an optimal schedule sometimes needs to wait to execute more small jobs that are about to arrive Question: Is SPT competitive? No: Schedule B on previous slide is SPT

8 Ecole Polytechnique, Nov 7, 2007 8 Question: Is SPT competitive? r 1 =0 p 1 =p n jobs with r i =1 and p i =1 ∑C j ≥ np ∑C j ≤ n(n+1) + (n+1+p) ≤ 2n(n+1)+p SPT: 0 Q: 1 So for p = 2n(n+1) ratio SPT/Q ≥ n·2n(n+1) / 4n(n+1) = n/2 

9 Ecole Polytechnique, Nov 7, 2007 9 Theorem: No online algorithm has competitive ratio < 2 r 1 =0 p 1 =p ∑C j (A) ≥ n(2p-1) = 2pn+  (n) So for p = n 2 ratio A/Q ≥ 2 - O(1/n)  2 Proof: A = online algorithm. At time 0 release job 1: If A schedules 1 at time t ≥ p-2 then ratio ≥ (2p-2)/p = 2-2/p  2 Else, release n jobs at time p-1 of length 1 Consider Q: ∑C j (Q) ≤ n(p-1+n)+(2p+n) = pn+  (n+p) In A:

10 Ecole Polytechnique, Nov 7, 2007 10 Intuition: To be competitive, an algorithm needs to wait even if jobs are available Algorithm SSPT: When job j arrives, reset its release time to r’ j = r j +p j Apply SPT with respect to these new release times Theorem: SSPT is 2-competitive. Proof idea: I = input instance. Define an SSPT-induced instance I” such that: optimum(I”) ≤ 2 · optimum(I) SSPT’s schedule for I = SRPT schedule for I” So ∑C j (SPT on I) = ∑C j (SRPT on I”) = optimum(I”) ≤ 2 · optimum(I)

11 Ecole Polytechnique, Nov 7, 2007 11 Claim 1: optimum(I”) ≤ 2 · optimum(I) Proof: Q = optimal schedule for I. Consider schedule Z for I” where S j (Z) = 2S j (Q)+p j Then Z is feasible for I” because jobs in Z do not overlap and S j (Z) = 2S j (Q)+p j ≥ 2r j + p j ≥ r” j ∑C j (Z) = 2∑C j (Q) because C j (Z) = S j (Z)+p j = 2 S j (Q)+p j +p j = 2[S j (Q)+p j ] = 2Cj(Q) Let T = schedule of SSPT on I Define I” by changing release times to r” j = min { S j (T), 2r j +p j }

12 Ecole Polytechnique, Nov 7, 2007 12 Claim 2: T is also an SRPT schedule for I” Proof: Suppose T executes k and h is pending Recall: T = schedule of SSPT on I I” obtained by changing r j to r” j = min{S j (T),2r j +p j } We need (SRPT of k) ≤ p h at any time t ≥ r” h. It’s enough to show it for t=S h (T) or t= 2r h +p h (since T runs k) T runs h after k so S h (T) ≥ C k (T)  we are OK for t = S h (T) At t=2r h +p h we need p h ≥ C k (T)-(2r h +p h ) This is equivalent to 2(r h +p h ) ≥ S k (T)+p k Case 1: h pending at S k (T). Since T chose k, we have p h ≥ p k and k only gets shorter so T obeys the SRPT rule for k and h h k Case 2: h was released after S k (T). h r’ h = r h +p h kh h kh 2r h +p h True, because 2(r h +p h ) ≥ 2S k (T) ≥ S k (T)+r’ k ≥ S k (T)+p k


Download ppt "Ecole Polytechnique, Nov 7, 2007 1 Minimizing Total Completion Time Each job specified by  procesing time (length p j )  release time r j Goal: compute."

Similar presentations


Ads by Google