This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Algorithms Non-Lecture K: Approximation Algorithms Le mieux est lennemi du bien. [The best is the enemy of the good.] Voltaire, La Bgueule (1772) Who shall forbid a wise skepticism, seeing that there is no practical question on which any thing more than an approximate solution can be had? Ralph Waldo Emerson, Representative Men (1850) Now, distrust of corporations threatens our still-tentative economic recovery; it turns out greed is bad, after all. Paul Krugman, Greed is Bad, The New York Times , June 4, 2002. K Approximation Algorithms K.1 Load Balancing On the future smash hit reality-TV game show Grunt Work , scheduled to air Thursday nights at 3am (2am Central) on ESPN , the contestants are given a series of utterly pointless tasks to perform. Each task has a predetermined time limit; for example, Sharpen this pencil for 17 seconds, or Pour pigs blood on your head and sing The Star-Spangled Banner for two minutes, or Listen to this 75-minute algorithms lecture. The directors of the show want you to assign each task to one of the contestants, so that the last task is completed as early as possible. When your predecessor correctly informed the directors that their problem is NP-hard, he was immediately fired. Time is money! they screamed at him. We dont need perfection. Wake up, dude, this is television ! Less facetiously, suppose we have a set of n jobs, which we want to assign to m machines. We are given an array T [ 1 .. n ] of non-negative numbers, where T [ j ] is the running time of job j . We can describe an assignment by an array A [ 1 .. n ] , where A [ j ] = i means that job j is assigned to machine i . The makespan of an assignment is the maximum time that any machine is busy: makespan ( A ) = max i X A [ j ]= i T [ j ] The load balancing problem is to compute the assignment with the smallest possible makespan. Its not hard to prove that the load balancing problem is NP-hard by reduction from P ARTITION: The array T [ 1 .. n ] can be evenly partitioned if and only if there is an assignment to two machines with makespan exactly i T [ i ] / 2. A slightly more complicated reduction from 3P ARTITION implies that the load balancing problem is strongly NP-hard. If we really need the optimal solution, there is a dynamic programming algorithm that runs in time O ( nM m ) , where M is the minimum makespan, but thats just horrible. There is a fairly natural and efficient greedy heuristic for load balancing: consider the jobs one at a time, and assign each job to the machine with the earliest finishing time. G REEDY L OAD B ALANCE ( T [ 1.. n ] , m ) : for i 1 to m Total [ i ] for j 1 to n min 1 for i 2 to n if Total [ i ] < Total [ min ] min i A [ j ] min Total [ min ] Total [ min ]+ T [ j ] return A [ 1.. m ] 1 Algorithms Non-Lecture K: Approximation Algorithms Theorem 1. The makespan of the assignment computed by G REEDYLOADBALANCE is at most twice the...
View Full Document
This note was uploaded on 12/15/2009 for the course 942 cs taught by Professor A during the Spring '09 term at University of Illinois at Urbana–Champaign.
- Spring '09