Download presentation
Presentation is loading. Please wait.
Published byBarrie Walton Modified over 9 years ago
1
Instructor Neelima Gupta ngupta@cs.du.ac.in
2
Table of Contents Factor 2 algorithm for Bin Packing Factor 2 algorithm for Minimum Makespan Scheduling Reference: Vazirani.
3
Bin Packing Problem: Definition Given n items of sizes x 1, … x n between 0 and 1, excluding 0, but including 1. Find a packing in unit-sized bins that minimizes the number of bins used.
4
Greedy Approach: factor 2 Consider items in any arbitrary order. At any iteration I, we have a set of partially filled bins B 1 …. B k To insert the next element x i, we check if it can be put in any of the already used bin. If not then we open another bin B k=1
5
Analysis : 2 factor approximation Prove by induction that if at any iteration we have m bins then at least m-1 of them are at least half full. Thus (m-1)/2 < Sum_{i,n} x i Since bins are of unit length, sum of item sizes is a lower bound on OPT. i.e Sum_{i,n} x i <= OPT Thus m – 1 < 2 OPT i.e m <= 2OPT
6
Minimum Makespan Scheduling Given n jobs with processing times p 1 ……. P n and an integer m, find an assignment of the jobs to m identical machines so that the completion time, called the makespan is minimized.
7
Greedy Approach: factor 2 Consider jobs in any arbitrary order. Schedule the next job on the machine with the minimum makespan so far.
8
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
9
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
10
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
11
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
12
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
13
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 1 J5 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
14
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 1 J6 7 J5 Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
15
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 1 J6 7 J5 Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
16
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 1 J6 7 J5 Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
17
M1 M2 M3 t=0 Machine s Jobs Processing time J1 2 J2 3 J3 8 J4 5 J5 1 J6 7 2 J1 J2 3 J3 8 J4 5 1 J6 7 J5 Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
18
Analysis : 2 factor approximation Average mount of time for which a machine runs is (sum_{i} p i ) /m Clearly OPT >= (sum_{i} p i ) /m Proof: Suppose t i denotes the completion time of the ith machine in OPT. Then (sum_{i} p i ) /m is nothing but (sum_{i} t i ) /m Thus, OPT = max{t i } >= (sum_{i} t i ) /m = (sum_{i} p i ) /m Also, OPT >= max{p i }
19
Contd.. Consider the machine M whose makespan is maximum in our solution. Let p l be the processing time of the last job j l scheduled on M. Let s l be the start time of j l on M. Then, makespan of our solution = s l + p l Let j 1 ….j r be the jobs scheduled just before j l. Then s l = min{T i } <= (sum_{i = j 1 ….j r T i } )/m = (sum_{i = j 1 ….j r p i } )/m <= (sum_{i} p i ) /m Thus s l + p l <= (sum_{i} p i ) /m + max{p i } <= 2 OPT.
20
Consolidated by: Sumedha Upadhyaya( 42), Prachi Nagpal(41) (MCS '09)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.