1 / 12

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. Minimizing Total Completion Time. C j = completion time of j in a given schedule In Graham’s notation:

Télécharger la présentation

Minimizing Total Completion Time

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Each job specified by procesing time (length pj) release time rj Goal: compute a schedule (preemptive or not) that maximizes the total completion time all integer Minimizing Total Completion Time Cj = completion time of j in a given schedule In Graham’s notation: • Non preemptive version: 1|rj,pj|∑Cj • Preemptive version: 1|rj,pj,pmtn|∑Cj 1

  2. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 Schedule A ∑Cj = 4+7+8+9+11+12 = 51 Schedule B ∑Cj = 1+2+3+5+6+9+12 = 38 Preemptive Scheduling Example: 2

  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 Example: Schedule B on previous slide is SRPT Theorem: Algorithm SRPT computes an optimal solution (that is, SRPT is 1-competitive) 3

  4. unit a+b in T unit a+b in T i i j j j i j i i i j i i j j rj rj ri ri at rj: b units of j and a≤b units of i unit ≥ a in T i i i i i i i i j j j j j j j unit a in T 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 ri ≤ rj. Let T = set of time slots occupied by i and j starting at rj Reschedule i and j within T using SRPT: So ∑Cj cannot increase !!! 4

  5. phase So we know: that one SPRT-reschedule does not increase ∑Cj start with any schedule Q repeat: apply SRPT-reschedule to all pairs i,j until Q does not change let k = minimum length job with rk = 0 • SRPT will schedule one unit of k at time 0 • 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 pk = pk-1 • change all release times rj=0 to rj=1 • and apply the argument recursively to the new instance Thus we convert Q into SRPT without increasing ∑Cj So ∑Cj(SRPT) ≤ ∑Cj(Q) 5

  6. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 Schedule A ∑Cj = 4+7+8+9+11+12 = 51 Schedule B Schedule C ∑Cj = 4+5+6+7+9+11 = 42 ∑Cj = 2+3+5+6+10+13 = 39 Non-Preemptive Scheduling Example: 6

  7. Algorithm SPT: at each step, when no job is running, execute the job with shortest processing time Question: Is SPT’s schedule optimal? No: Schedule B on previous slide is SPT 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? 7

  8. r1=0 p1=p n jobs with ri=1 and pi=1 SPT: 0 1 Q: Question: Is SPT competitive? ∑Cj ≥ np ∑Cj ≤ n(n+1) + (n+1+p) ≤ 2n(n+1)+p So for p = 2n(n+1) ratio SPT/Q ≥ n·2n(n+1) / 4n(n+1) = n/2  8

  9. r1=0 p1=p In A: Consider Q: Theorem: No online algorithm has competitive ratio < 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 ∑Cj(A) ≥ n(2p-1) = 2pn+(n) ∑Cj(Q) ≤ n(p-1+n)+(2p+n) = pn+(n+p) So for p = n2 ratio A/Q ≥ 2 - O(1/n)  2 9

  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 = rj+pj • 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 ∑Cj(SPT on I) = ∑Cj(SRPT on I”) = optimum(I”) ≤ 2 · optimum(I) 10

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

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

More Related