View
217
Download
0
Category
Tags:
Preview:
Citation preview
InstructorNeelima Gupta
ngupta@cs.du.ac.in
Table of Contents
Factor 2 algorithm for Bin PackingFactor 2 algorithm for Minimum Makespan Scheduling
Reference: Vazirani.
Bin Packing Problem: DefinitionGiven n items of sizes x1 , … xn between 0 and 1, excluding 0, but including 1. Find a packing in unit-sized bins that minimizes the number of bins used.
Greedy Approach: factor 2Consider items in any arbitrary order.At any iteration I, we have a set of partially
filled bins B1 …. Bk
To insert the next element xi , we check if it can be put in any of the already used bin. If not then we open another bin Bk=1
Analysis : 2 factor approximationProve 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} xi
Since bins are of unit length, sum of item sizes is a lower bound on OPT. i.e Sum_{i,n} xi <= OPT
Thus m – 1 < 2 OPT i.e m <= 2OPT
Minimum Makespan SchedulingGiven n jobs with processing times p1 ……. Pn
and an integer m , find an assignment of the jobs to m identical machines so that the completion time, called the makespan is minimized.
Greedy Approach: factor 2Consider jobs in any arbitrary order.Schedule the next job on the machine with
the minimum makespan so far.
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5
1
J5
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5
1
J6
7
J5
Thanks to: Isha Jaiswal (12 ) (MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5
1
J6
7
J5
Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5
1
J6
7
J5
Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
M1
M2
M3
t=0
MachinesJobs Processing time
J1 2J2 3J3 8J4 5J5 1J6 7
2
J1
J2
3
J3
8
J4
5 1
J6
7
J5
Thanks to: Isha Jaiswal (12 )(MCS ‘ 12)
Analysis : 2 factor approximationAverage mount of time for which a machine runs
is (sum_{i} pi ) /m
Clearly OPT >= (sum_{i} pi ) /m
Proof: Suppose ti denotes the completion time of the ith machine in OPT. Then
(sum_{i} pi ) /m is nothing but (sum_{i} ti ) /m
Thus, OPT = max{ti } >= (sum_{i} ti ) /m = (sum_{i} pi ) /m
Also, OPT >= max{pi}
Contd..Consider the machine M whose makespan is
maximum in our solution. Let pl be the processing time of the last job jl scheduled on M. Let sl be the start time of jl on M.
Then, makespan of our solution = sl + pl
Let j1 ….jr be the jobs scheduled just before jl.
Then sl = min{Ti} <= (sum_{i = j1 ….jr Ti} )/m
= (sum_{i = j1 ….jr pi} )/m
<= (sum_{i} pi ) /m
Thus sl + pl <= (sum_{i} pi ) /m + max{pi}
<= 2 OPT.
Consolidated by: Sumedha Upadhyaya( 42), Prachi Nagpal(41) (MCS '09)
Recommended