Lecture 31: Greedy Reductions
We can take a greedy approach, minimum makespan. Given jobs for machines with times t1, t2, … , tn, the total time from start to finish of the slowest machine is as small as possible. Example, three machines with jobs 2, 2, 2, 3, 4, 6:
M1: 2, 2, 2
M2: 3, 4
M3: 6
We can write this as a decision problem. Given the number of machines and a list of job times, and a bound k, is there a way to assign jobs so that Makespan <= k? Makespan is NP-complete, by reduction from Subset Sum! Given a target W and w1, w2, … , wn, split into sets W and S – W where S = sum(wi). Take |W – (S – W)| = |2W – S| = W0, a new constant in the list which forces the best solution where both subsets have the same sum = max(W, S – W).
Given a Subset Sum problem, create W0 = |S – 2W| and let the w’s be the times of jobs. Ask if Makespan works on 2 machines of size <= (S + W0) / 2.
Claim: “There is a solution to Subset Sum if and only if there is a solution to Makespan.”
Assume a Subset Sum solution. Split the w’s into subsets that sum to W and S – W. W0 was chosen so we can make them equal, so there exists a Makespan = (S + W0) / 2, and some machine has a subset of jobs summing to W.
Greedy Strategy: Assign each job to least busy machine, incrementally. How good is this? Call the best Makespan possible T*. The sum(ti) = total time to be spread over m machines. Some machine must have more than sum(ti) / m, so T* >= sum(ti) / m. Consider Mi, the machine with worst time; it’s load is T = Ti. In general, Tj = load on Mj. Our makespan answer is T1 by the greedy algorithm.
Let tj be the last time assigned to Mi. At that moment, Mi’s load is Ti – tj. That must be the smallest load, because we chose it for the last job. So Ti – tj <= Tk for all k.
For each machine: M(Ti – tj) <= sum(Tk) = sum(tj). So Ti – Tj < = sum(tj) / m &;t= T*. Ti <= T* + tj so T = Ti <= T* + tj and T* >= worst tk >= tj, so T <= T* + T* -> T <= 2 T*.
The greedy algorithm is always within twice the optimal value. If we presort and do the largest jobs first, we can show that T/T* <= 3/2 and T/T* <= 4/3.
Credit to Kevin Canini for the notes!
| This entry was posted on Wednesday, April 13th, 2005 at 11:07 pm and is tagged with subset sum problem, w1 w2, greedy algorithm, t amp, greedy approach, wn, decision problem, target, worst time, 2w, last job, subsets, best solution, lt, t2, last time, m2, tk, np, jobs. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback. |
Leave a Reply