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
3
Embed
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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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.
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.