advanced algorithms coms31900 approximation algorithms
play

Advanced Algorithms COMS31900 Approximation algorithms part two - PowerPoint PPT Presentation

Advanced Algorithms COMS31900 Approximation algorithms part two more constant factor approximations Rapha el Clifford Slides by Benjamin Sach Approximation Algorithms Recap An algorithm A is an -approximation algorithm for problem P


  1. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule Theorem The greedy algorithm given is a 2 -approximation algorithm • Before we prove this, we prove two useful facts, Fact Opt � max j t j Job j takes t j ◦ Some machine must process the largest job time units � j t j Fact Opt � m m machines n jobs ◦ There is a total of � j t j time units of work to be done � j t j ◦ Some machine i must have load L i at least m (the m machines can’t all have below average load)

  2. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule Theorem The greedy algorithm given is a 2 -approximation algorithm Job j takes t j time units m machines n jobs

  3. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule Theorem The greedy algorithm given is a 2 -approximation algorithm Proof Consider the machine i with largest load T g = L i Job j takes t j time units m machines n jobs

  4. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 5 Job j takes t j time units m machines n jobs

  5. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 Job j takes t j time units m machines n jobs

  6. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 Job j takes t j time units m machines n jobs

  7. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j Job j takes t j time units m machines n jobs

  8. L i is the load of The greedy approximation machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j Job j takes t j time units m machines n jobs

  9. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j Job j takes t j time units m machines n jobs

  10. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j time units m machines n jobs

  11. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m machines n jobs

  12. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units • If we then sum over all k , m machines n jobs

  13. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs

  14. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m

  15. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m � j t j Fact Opt � m

  16. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m

  17. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m also t j � Opt (by the first fact)

  18. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m also t j � Opt (by the first fact) Fact Opt � max j t j

  19. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m also t j � Opt (by the first fact)

  20. L i is the load of The greedy approximation job j machine i Let Opt denote the time taken by the optimal scheduling of jobs Let T g denote the time taken by the greedy schedule L i = T g 1 Theorem The greedy algorithm given is a 2 -approximation algorithm 2 3 Proof Consider the machine i with largest load T g = L i 4 • Let j denote the last job machine i completes 5 • When job j was assigned, machine i had the smallest load, L i − t j So. . . Job j takes t j L i − t j � L k for all 1 � k � m , time units m • If we then sum over all k , � m ( L i − t j ) � L k m machines k =1 n jobs � m k =1 L k so ( L i − t j ) � � Opt (by the second fact) m also t j � Opt (by the first fact) Therefore, T g = L i = ( L i − t j ) + t j � Opt + Opt = 2Opt

  21. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest)

  22. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest)

  23. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  24. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  25. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  26. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  27. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  28. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  29. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  30. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  31. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  32. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  33. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  34. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  35. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  36. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  37. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  38. Longest Processing Time (LPT) 1 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  39. Longest Processing Time (LPT) 1 greedy solution 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load

  40. Longest Processing Time (LPT) 1 greedy solution 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load How long does it take to compute this schedule?

  41. Longest Processing Time (LPT) 1 greedy solution 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load How long does it take to compute this schedule? O ( n log n ) time (to sort the jobs)

  42. Longest Processing Time (LPT) 1 greedy solution 2 3 4 5 Step 1: Sort the jobs into non-increasing order (job 1 is now largest) Step 2: Put job j on the machine i with smallest (current) load How long does it take to compute this schedule? O ( n log n ) time (to sort the jobs) How good is it?

  43. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm m machines n jobs Job j takes t j time units

  44. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines n jobs Job j takes t j time units

  45. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs Job j takes t j time units

  46. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j time units

  47. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units

  48. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units Proof

  49. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units Proof ◦ Note that t 1 � t 2 � t 3 � . . . t m � t ( m +1)

  50. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units Proof ◦ Note that t 1 � t 2 � t 3 � . . . t m � t ( m +1) ◦ One of the m machines must be assigned (at least) two of these m + 1 jobs under any schedule

  51. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units Proof ◦ Note that t 1 � t 2 � t 3 � . . . t m � t ( m +1) ◦ One of the m machines must be assigned (at least) two of these m + 1 jobs under any schedule ◦ So we have that any schedule takes at least 2 t ( m +1) time

  52. The LPT approximation • Let T l denote the time taken by the LPT schedule L i is the load of machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm • Before we prove this, we prove another useful fact and a Lemma m machines Fact If there are at most m jobs ( n � m ) then LPT is optimal n jobs If there are at most m jobs then LPT gives each job its own machine so max i L i � max j t j � Opt Job j takes t j Lemma If n > m then Opt � 2 t ( m +1) (after sorting) time units Proof ◦ Note that t 1 � t 2 � t 3 � . . . t m � t ( m +1) ◦ One of the m machines must be assigned (at least) two of these m + 1 jobs under any schedule ◦ So we have that any schedule takes at least 2 t ( m +1) time in particular Opt � 2 t ( m +1)

  53. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm m machines n jobs Job j takes t j time units

  54. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm Proof Consider the machine i with largest load T l = L i m machines n jobs Job j takes t j time units

  55. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm Proof Consider the machine i with largest load T l = L i • Let j denote the last job machine i completes m machines n jobs Job j takes t j time units

  56. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm 1 Proof Consider the machine i with largest load T l = L i 2 • Let j denote the last job machine i completes 3 4 5 job j m machines n jobs Job j takes t j time units

  57. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm 1 Proof Consider the machine i with largest load T l = L i 2 • Let j denote the last job machine i completes 3 4 • Using the same argument as before, we have that, 5 job j m machines n jobs Job j takes t j time units

  58. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm 1 Proof Consider the machine i with largest load T l = L i 2 • Let j denote the last job machine i completes 3 4 • Using the same argument as before, we have that, 5 ( L i − t j ) � Opt job j m machines n jobs Job j takes t j time units

  59. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm 1 Proof Consider the machine i with largest load T l = L i 2 • Let j denote the last job machine i completes 3 4 • Using the same argument as before, we have that, 5 ( L i − t j ) � Opt job j • If n � m then we are done so assume n > m m machines n jobs Job j takes t j time units

  60. L i is the load of The LPT approximation machine i Theorem The LPT algorithm is a 3 / 2 -approximation algorithm 1 Proof Consider the machine i with largest load T l = L i 2 • Let j denote the last job machine i completes 3 4 • Using the same argument as before, we have that, 5 ( L i − t j ) � Opt job j • If n � m then we are done so assume n > m m machines because LPT is optimal in this case n jobs Job j takes t j time units

Recommend


More recommend