Advanced Algorithms – COMS31900 Approximation algorithms part two more constant factor approximations Benjamin Sach
Advanced Algorithms – COMS31900
Approximation algorithms part two
more constant factor approximations
Benjamin Sach
Approximation Algorithms Recap
An algorithmA is an α-approximation algorithm for problem P if,
◦A runs in polynomial time
◦A always outputs a solution with value s
Here P is an optimisation problem with optimal solution of value Opt
• If P is a maximisation problem, Optα 6 s 6 Opt
within an α factor of Opt
• If P is a minimisation problem, Opt 6 s 6 α ·Opt
We have seen
a 3/2-approximation algorithm for Bin Packing(and a faster 2-approximation)
Scheduling Jobs on Parallel Machines
1
2
3
4
5
m identical
machines
n jobs
time taken
Goal: minimise the (wall-clock) time
taken to process all jobs
Scheduling Jobs on Parallel Machines
1
2
3
4
5
m identical
machines
n jobs
time taken
Goal: minimise the (wall-clock) time
taken to process all jobs
(it’s NP-hard)
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• Job j takes tj time units
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• We say that j ∈ J(i) iff job j is assigned to machine i
• Job j takes tj time units
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• We say that j ∈ J(i) iff job j is assigned to machine i
• The load of machine i is Li =∑j∈J(i) tj
• Job j takes tj time units
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• We say that j ∈ J(i) iff job j is assigned to machine i
• The load of machine i is Li =∑j∈J(i) tj
• Job j takes tj time units
L2
L3
L1
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• We say that j ∈ J(i) iff job j is assigned to machine i
• The load of machine i is Li =∑j∈J(i) tj
• Job j takes tj time units
• So the wall-clock time is maxi Li (which we want to minimise)
L2
L3
L1
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Goal: minimise the (wall-clock) time
taken to process all jobs
wall-clock time (also called makespan)
• We say that j ∈ J(i) iff job j is assigned to machine i
• The load of machine i is Li =∑j∈J(i) tj
• Job j takes tj time units
• So the wall-clock time is maxi Li (which we want to minimise)
L2
L3
L1L1
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
How long does it take to compute this schedule?
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
How long does it take to compute this schedule?
m machines
n jobs
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
How long does it take to compute this schedule?
O(nm) time naively,O(n logm) time using a priority queue
m machines
n jobs
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
How long does it take to compute this schedule?
O(nm) time naively,O(n logm) time using a priority queue
(it’s also an online solution)
m machines
n jobs
Scheduling Jobs on Parallel Machines
1
2
3
4
5
Algorithm: Put job j on the machine i with smallest (current) load
How long does it take to compute this schedule?
O(nm) time naively,O(n logm) time using a priority queue
How good is it?
(it’s also an online solution)
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
◦ Some machine must process the largest job
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
Fact Opt >
∑j tjm
◦ Some machine must process the largest job
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
Fact Opt >
∑j tjm
◦ Some machine must process the largest job
◦ There is a total of∑j tj time units of work to be done
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
Fact Opt >
∑j tjm
◦ Some machine must process the largest job
◦ There is a total of∑j tj time units of work to be done
◦ Some machine i must have load Li at least
∑j tjm
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
• Before we prove this, we prove two useful facts,
Fact Opt > maxj tj
Fact Opt >
∑j tjm
◦ Some machine must process the largest job
◦ There is a total of∑j tj time units of work to be done
◦ Some machine i must have load Li at least
∑j tjm
(them machines can’t all have below average load)
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Job j takes tjtime units
Li is the load of
machine i
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
Proof Consider the machine i with largest load Tg = Li
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
Proof Consider the machine i with largest load Tg = Li
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
So. . .
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
Fact Opt >
∑j tjm
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
also tj 6 Opt (by the first fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
also tj 6 Opt (by the first fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
Fact Opt > maxj tj
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
also tj 6 Opt (by the first fact)
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
The greedy approximation
Theorem The greedy algorithm given is a 2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tg = Li
• When job j was assigned, machine i had the smallest load, Li − tj
Li − tj 6 Lk for all 1 6 k 6 m,
So. . .
• If we then sum over all k,
m(Li − tj) 6m∑k=1
Lk
so (Li − tj) 6∑m
k=1 Lk
m 6 Opt (by the second fact)
also tj 6 Opt (by the first fact)
Therefore, Tg = Li = (Li − tj) + tj 6 Opt + Opt = 2Opt
Let Opt denote the time taken by the optimal scheduling of jobs
Let Tg denote the time taken by the greedy schedule
Li is the load of
machine i
Job j takes tjtime units
1
2
3
4
5
Li = Tg
m machines
n jobs
job j
Longest Processing Time (LPT)
1
2
3
4
5
Step 1: Sort the jobs into non-increasing order (job 1 is now largest)
Longest Processing Time (LPT)
1
2
3
4
5
Step 1: Sort the jobs into non-increasing order (job 1 is now largest)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
greedy
solution
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
greedy
solution
How long does it take to compute this schedule?
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
greedy
solution
How long does it take to compute this schedule?
O(n logn) time (to sort the jobs)
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
greedy
solution
How long does it take to compute this schedule?
O(n logn) time (to sort the jobs)
How good is it?
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let Tl denote the time taken by the LPT scheduleLi is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
• Let Tl denote the time taken by the LPT scheduleLi is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
• Let Tl denote the time taken by the LPT scheduleLi is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
• Let Tl denote the time taken by the LPT scheduleLi is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
• Let Tl denote the time taken by the LPT scheduleLi is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
• Let Tl denote the time taken by the LPT schedule
Proof
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
◦ Note that t1 > t2 > t3 > . . . tm > t(m+1)
• Let Tl denote the time taken by the LPT schedule
Proof
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
◦ Note that t1 > t2 > t3 > . . . tm > t(m+1)
◦ One of them machines must be assigned
• Let Tl denote the time taken by the LPT schedule
Proof
(at least) two of thesem+ 1 jobs under any schedule
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
◦ Note that t1 > t2 > t3 > . . . tm > t(m+1)
◦ One of them machines must be assigned
• Let Tl denote the time taken by the LPT schedule
Proof
(at least) two of thesem+ 1 jobs under any schedule
◦ So we have that any schedule takes at least 2t(m+1) time
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Before we prove this, we prove another useful fact and a Lemma
Fact If there are at mostm jobs (n 6 m) then LPT is optimal
Lemma If n > m then Opt > 2t(m+1) (after sorting)
LPT gives each job its own machine so maxi Li 6 maxj tj 6 Opt
◦ Note that t1 > t2 > t3 > . . . tm > t(m+1)
◦ One of them machines must be assigned
• Let Tl denote the time taken by the LPT schedule
Proof
(at least) two of thesem+ 1 jobs under any schedule
◦ So we have that any schedule takes at least 2t(m+1) time
Li is the load of
machine i
m machines
n jobs
in particular Opt > 2t(m+1)
Job j takes tjtime units
If there are at mostm jobs then
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
Proof Consider the machine i with largest load Tl = Li
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
because LPT is optimal in this case
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
Fact Opt > maxj tj
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
it doesn’t assign a second job to any machine untilevery machine has at least one job
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
tj 6 tm+1 6 Opt/2 (by the Lemma)
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
tj 6 tm+1 6 Opt/2 (by the Lemma)
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
Lemma If n > m then Opt > 2t(m+1) (after sorting)
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
tj 6 tm+1 6 Opt/2 (by the Lemma)
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
The LPT approximation
Theorem The LPT algorithm is a 3/2-approximation algorithm
• Let j denote the last job machine i completes
Proof Consider the machine i with largest load Tl = Li
• Using the same argument as before, we have that,
(Li − tj) 6 Opt
Therefore, Tl = Li = (Li − tj) + tj 6 Opt + Opt/2 = (3/2) ·Opt
• If n 6 m then we are done so assume n > m
• Further if (Li − tj) = 0 then Tl = Li = tj 6 Opt
so assume that (Li − tj) > 0
• Therefore machine i was assigned at least two jobs
By the algorithm description, we have that j > m+ 1
tj 6 tm+1 6 Opt/2 (by the Lemma)
Li is the load of
machine i
m machines
n jobs
Job j takes tjtime units
job j
12345
Scheduling conclusions
Theorem The LPT algorithm is a 3/2-approximation algorithm
which runs inO(n logn) time
Theorem The greedy algorithm is a 2-approximation algorithm
which runs inO(n logm) time and it’s online
In fact, LPT is a 4/3-approximation algorithm (using better analysis)
m machines
n jobs
k-centers
n points (sites) in 2D space
Goal Minimise the largest distance from any site to the closest center
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
(i.e. ‘normal’ euclidean distance)
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
(i.e. ‘normal’ euclidean distance)
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
(i.e. ‘normal’ euclidean distance)
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
r
r
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
Select k sites to be
centers
r
k-centers
n points (sites) in 2D space
The distance between points si, sj is√
(xi − xj)2 + (yi − yj)2
Goal Minimise the largest distance from any site to the closest center
Goal Minimise the largest distance from any site to the closest center
(in general it’s NP-hard)
Select k sites to be
centers
r
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
A Greedy approximation
r
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
This takesO(nk) time
A Greedy approximation
Start by picking any point to be a center
Repeatedly pick the site which is furthest from any existing center
This takesO(nk) time
A Greedy approximation
but is it any good?
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sites
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sitespurposes only
Disclaimer: for illustrative
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sitespurposes only
Disclaimer: for illustrative
Greedy centers
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sitespurposes only
Disclaimer: for illustrative
Greedy centers
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sitespurposes only
Disclaimer: for illustrative
Greedy centers
Distance at most 2Opt
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 1: No si, si′ ∈ Cg are closest to the same sj ∈ COpt
Optimal centers
Opt
Sitespurposes only
Disclaimer: for illustrative
Greedy centers
Distance at most 2Opt
so rg 6 2Opt
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
si
si′
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
the furthest from any existing Greedy center
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
the furthest from any existing Greedy center
However, si is at most 2Opt away from si′
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
the furthest from any existing Greedy center
However, si is at most 2Opt away from si′
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
the furthest from any existing Greedy center
However, si is at most 2Opt away from si′
So even before adding si as a center, all sites
were 6 2Opt away from a Greedy center
The Greedy approximation
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
Let Cg (resp. COpt) denote the set of centers selected by Greedy (resp. Optimal)
Proof
Let rg (resp. Opt) denote largest site-center distance using Greedy (resp. Optimal)
Case 2: Some si, si′ ∈ Cg are closest to the same sj ∈ COpt
Assume wlog. that Greedy made si a center after si′
si
si′
si was added as a center because it was
the furthest from any existing Greedy center
However, si is at most 2Opt away from si′
So even before adding si as a center, all sites
were 6 2Opt away from a Greedy center
Therefore, rg 6 2Opt
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
d(si, sj) = L1 or L∞ for example
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
d(si, sj) = L1 or L∞ for example
d(x, y) = d(y, x), d(x, y) > 0
• Distance function d is a metric iff
(d(x, y) = 0 iff x = y) and d(x, z) 6 d(x, y) + d(y, z)
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
d(si, sj) = L1 or L∞ for example
• For a general (metric) d, the problem is not α-approximable with α < 2
d(x, y) = d(y, x), d(x, y) > 0
• Distance function d is a metric iff
(d(x, y) = 0 iff x = y) and d(x, z) 6 d(x, y) + d(y, z)
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
d(si, sj) = L1 or L∞ for example
• For a general (metric) d, the problem is not α-approximable with α < 2
d(x, y) = d(y, x), d(x, y) > 0
• For d = L2 , the problem is not α-approximable with α <√3 ≈ 1.73
• Distance function d is a metric iff
(d(x, y) = 0 iff x = y) and d(x, z) 6 d(x, y) + d(y, z)
k-center Conclusions
Theorem The Greedy algorithm for k-center is a 2-approximation algorithm
which runs inO(nk) time
• The approximation works for any (metric) distance function,
d(si, sj) = L1 or L∞ for example
• For a general (metric) d, the problem is not α-approximable with α < 2
d(x, y) = d(y, x), d(x, y) > 0
• For d = L2 , the problem is not α-approximable with α <√3 ≈ 1.73
• For d = L1 or d = L∞ , the problem is not α-approximable with α < 2
• Distance function d is a metric iff
(d(x, y) = 0 iff x = y) and d(x, z) 6 d(x, y) + d(y, z)