definition of scheduling on a single machine. · 0 2 6 7 j1 j3 j2 !" = 15 preemptive( can be...

3
CS6320 : Intro to Intractability, Approximation and Heuristic Algorithms Spring 2016 Lecture 23 : April. 18 Instructor: Prof. Ajay Gupta Scribe: Yu Guo This lecture is continuing to talk about the approximation algorithms. And we talked about the scheduling on a single machine. . Definition of scheduling on a single machine. non – preemptive Given some jobs: Jobs 1 2 i n Processing time P 1 P 2 P i P n Release time R 1 R 2 R i R n Then, construct a schedule on a single machine -at most one job can be scheduled at any time. -no job can be scheduled before its release time. -each job is processed non-preemptively (once a job starts, it completes). Instance of scheduling on a single machine. Jobs 1 2 3 Pi’s 2 1 4 Ri’s 0 4 3 Minimize avg. completion time. Let Ci = completion time of job i, minimize ( /). It is same as minimize . 0 2 4 5 9 J1 J2 J3 C1 =2, C2 =5, C3 = 9. = 16 Jobs 1 2 3 Pi’s 2 1 4 Ri’s 0 4 1

Upload: others

Post on 29-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Definition of scheduling on a single machine. · 0 2 6 7 J1 J3 J2 !" = 15 Preemptive( can be interrupted) 0 1 5 6 7 J1 J3 J1 J2 We will use preemptive scheduling to solve non-preemptive

CS6320 : Intro to Intractability, Approximation and Heuristic Algorithms Spring 2016

Lecture 23 : April. 18 Instructor: Prof. Ajay Gupta Scribe: Yu Guo This lecture is continuing to talk about the approximation algorithms. And we talked about the scheduling on a single machine. . Definition of scheduling on a single machine. non – preemptive Given some jobs: Jobs 1 2 … i … n Processing time P1 P2 … Pi … Pn Release time R1 R2 … Ri … Rn Then, construct a schedule on a single machine ∍ -at most one job can be scheduled at any time. -no job can be scheduled before its release time. -each job is processed non-preemptively (once a job starts, it completes). Instance of scheduling on a single machine. Jobs 1 2 3 Pi’s 2 1 4 Ri’s 0 4 3 Minimize avg. completion time. Let Ci = completion time of job i, minimize (𝐶𝑖/𝑛). It is same as minimize 𝐶𝑖. 0 2 4 5 9 J1 J2 J3 C1 =2, C2 =5, C3 = 9. 𝐶𝑖 = 16 Jobs 1 2 3 Pi’s 2 1 4 Ri’s 0 4 1

Page 2: Definition of scheduling on a single machine. · 0 2 6 7 J1 J3 J2 !" = 15 Preemptive( can be interrupted) 0 1 5 6 7 J1 J3 J1 J2 We will use preemptive scheduling to solve non-preemptive

0 2 6 7 J1 J3 J2 𝐶𝑖 = 15

Preemptive( can be interrupted) 0 1 5 6 7 J1 J3 J1 J2 We will use preemptive scheduling to solve non-preemptive scheduling problem. Poly – time, SRPT: shortest remaining processing time first (can solve preemptive scheduling problem optimally in poly-time)

• Start at time 0, and schedules the job with the smallest amount of remaining processing time as long as it is not completed and it pasts its release time.

• Schedule it until it is completed or some other job is released. 0 1 2 4 5 7 J1 J3 J2 J3 (J3 released) C1 =2, C2 =5, C3 = 7. 𝐶𝑖 = 14 Approximation Algorithm.

𝐶!! = 𝐶𝑜𝑚𝑝𝑙𝑒𝑡𝑖𝑜𝑛 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑗𝑜𝑏! 𝑖𝑛 𝑎𝑛 𝑜𝑝𝑡𝑖𝑚𝑎𝑙 𝑝𝑟𝑒𝑒𝑚𝑝𝑡𝑖𝑣𝑒 𝑠𝑐ℎ𝑒𝑑𝑢𝑙𝑒. OPT = Sum of Completion time non – preemptive schedule.

- Find an optimal preemptive schedule using SRPT. - Order the jobs non-preemptively in the same order that they complete in preemptive

schedule.

Page 3: Definition of scheduling on a single machine. · 0 2 6 7 J1 J3 J2 !" = 15 Preemptive( can be interrupted) 0 1 5 6 7 J1 J3 J1 J2 We will use preemptive scheduling to solve non-preemptive

Observation: 𝐶!! ≤ OPT

Let jobs be scheduled: 𝐶!!! ≤ 𝐶!!

! ≤ … ≤ 𝐶!"! .

- Job i1 is scheduled from Ri1 to Ri1 + Pi1 - Schedule job i2 from max (Ri1 + Pi1 , Ri2) to max (Ri1 + Pi1 , Ri2) + Pi2.

𝐶!! = 𝐶𝑜𝑚𝑝𝑙𝑒𝑡𝑖𝑜𝑛 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑗𝑜𝑏 𝑗 𝑖𝑛 𝑡ℎ𝑒 𝑛𝑜𝑛

−𝑝𝑟𝑒𝑒𝑚𝑝𝑡𝑖𝑣𝑒 𝑠𝑐ℎ𝑒𝑑𝑢𝑙𝑒 𝑓𝑟𝑜𝑚 𝑜𝑢𝑟 𝑎𝑙𝑔𝑜𝑟𝑖𝑡ℎ𝑚. Claim: 𝐶!!≤ 2𝐶!

! ∀ 1 ≤ j ≤ n. Observe some bounds: 𝐶!

! ≥ max! ! !! ! 𝑅! -> (A). 𝐶!

! ≥ 𝑃!!!!! - > (B)

𝐶!! ≥ 𝐶!! ≥ max! ! !! ! 𝑅!

Idle can be occurred only if next job to be processed is not release yet. 0 X Y=max!! !! ! 𝑅! 𝐶!! Idle can not occur here I Length of I ≤ 𝑃!

!!!!

𝐶!! = Y + length of I ≤ max! ! !! ! 𝑅! + 𝑃!

!!!!

≤ 𝐶!! + 𝐶!

! from(A)&(B) = 2𝐶!

! 𝐶!! ≤ 2𝐶!

! ≤ OPT. So, 𝑓 ≤ 2𝑓∗.