MCS 312: NP Completeness and Approximation algorthms - PowerPoint PPT Presentation

About This Presentation
Title:

MCS 312: NP Completeness and Approximation algorthms

Description:

Instructor Neelima Gupta ngupta_at_cs.du.ac.in Table of Contents Factor 2 algorithm for Bin Packing Factor 2 algorithm for Minimum Makespan Scheduling Reference: Vazirani. – PowerPoint PPT presentation

Number of Views:80
Avg rating:3.0/5.0
Slides: 21
Provided by: Neel152
Category:

less

Transcript and Presenter's Notes

Title: MCS 312: NP Completeness and Approximation algorthms


1
MCS 312 NP Completeness and Approximation
algorthms
  • Instructor
  • Neelima Gupta
  • ngupta_at_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 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.

4
Greedy Approach factor 2
  • Consider 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 Bk1

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 lt 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 lt
    OPT
  • Thus m 1 lt 2 OPT i.e m lt 2OPT

6
Minimum Makespan Scheduling
  • Given 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.

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
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
M1
M2
M3
t0
9
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
2
M1
J1
M2
M3
t0
10
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
2
M1
J1
3
M2
J2
M3
t0
11
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
2
M1
J1
3
M2
J2
8
M3
J3
t0
12
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
5
2
M1
J1
J4
3
M2
J2
8
M3
J3
t0
13
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
5
2
M1
J1
J4
3
1
M2
J2
J5
8
M3
J3
t0
14
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
5
2
M1
J1
J4
3
1
M2
J2
J5
7
8
M3
J3
J6
t0
15
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
5
2
M1
J1
J4
3
1
M2
J2
J5
7
8
M3
J3
J6
t0
MAKESPAN OF THE SOLUTION IS 15
16
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
5
2
M1
J1
J4
3
1
M2
J2
J5
7
8
M3
J3
J6
t0
MAKESPAN OF THE SOLUTION IS 15
17
Machines
Jobs Processing time J1
2 J2 3 J3
8 J4 5 J5
1 J6 7
7
2
M1
J1
J6
3
5
1
M2
J2
J4
J5
8
M3
J3
t0
MAKESPAN OF THE SOLUTION IS 15 BUT
OPT IS 9

18
Analysis 2 factor approximation
  • Average mount of time for which a machine runs is
  • (sum_i pi ) /m
  • Clearly OPT gt (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 maxti gt (sum_i ti ) /m
    (sum_i pi ) /m
  • Also, OPT gt maxpi

19
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 minTi lt (sum_i j1 .jr Ti )/m
  • (sum_i j1 .jr pi )/m
  • lt (sum_i
    pi ) /m
  • Thus sl pl lt (sum_i pi ) /m
    maxpi
  • lt 2 OPT.

20
Thank You!
Write a Comment
User Comments (0)
About PowerShow.com