Title: Minimizing%20Total%20Completion%20Time
1Minimizing Total Completion Time
- Each job specified by
- procesing time (length pj)
- release time rj
-
- Goal compute a schedule (preemptive or not) that
maximizes the total completion time
- Cj completion time of j in a given schedule
- In Grahams notation
- Non preemptive version 1rj,pj?Cj
- Preemptive version 1rj,pj,pmtn?Cj
2Preemptive Scheduling Example
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)
4Proof 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 !!!
5So 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 rj0 to rj1
- and apply the argument recursively to the new
instance
Thus we convert Q into SRPT without increasing
?Cj So ?Cj(SRPT) ?Cj(Q)
6Non-Preemptive Scheduling Example
7Algorithm SPT at each step, when no job is
running, execute the job with shortest processing
time
Question Is SPTs 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?
8Question Is SPT competitive?
?Cj np
?Cj n(n1) (n1p) 2n(n1)p
So for p 2n(n1) ratio SPT/Q n2n(n1) /
4n(n1) n/2 ??
9Theorem No online algorithm has competitive
ratio lt 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-1n)(2pn) pn?(np)
So for p n2 ratio A/Q 2 - O(1/n) ? 2
10Intuition To be competitive, an algorithm needs
to wait even if jobs are available
- Algorithm SSPT
- When job j arrives, reset its release time to
rj rjpj - 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)
- SSPTs schedule for I SRPT schedule for I
So ?Cj(SPT on I) ?Cj(SRPT on I)
optimum(I) 2 optimum(I)
11Let T schedule of SSPT on I Define I by
changing release times to rj min Sj(T) ,
2rjpj
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 rj
- ?Cj(Z) 2?Cj(Q) because
- Cj(Z) Sj(Z)pj
- 2 Sj(Q)pjpj
- 2Sj(Q)pj 2Cj(Q)
12Recall T schedule of SSPT on I I
obtained by changing rj to rj minSj(T),2rjpj
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 rh.
Its enough to show it for tSh(T) or t 2rhph
(since T runs k)
- T runs h after k so Sh(T) Ck(T) ? we are OK
for t Sh(T)
- At t2rhph we need ph Ck(T)-(2rhph)
- This is equivalent to 2(rhph) Sk(T)pk
True, because 2(rhph) 2Sk(T)
Sk(T)rk Sk(T)pk