This preview shows pages 1–2. 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 Lecture 30: Approximation Algorithms [ Fa10 ] 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. 30 Approximation Algorithms ? 30.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 i with the earliest finishing time Total [ i ] . G REEDY L OAD B ALANCE ( T [ 1.. n ] , m ) : for i 1 to m Total [ i ] for j 1 to n mini argmin i Total [ i ] A [ j ] mini Total [ mini ] Total [ mini ]+ T [ j ] return A [ 1.. m ] Copyright 2011 Jeff Erickson. Released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License ( http://creativecommons.org/licenses/by-nc-sa/3.0/http://creativecommons....
View Full Document
- Spring '11