{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

21k-approx - Algorithms Non-Lecture K Approximation...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Algorithms Non-Lecture K: Approximation Algorithms Le mieux est l’ennemi du bien. [The best is the enemy of the good.] — Voltaire, La Bégueule (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 pig’s 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 don’t 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. It’s 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 that’s 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 ] 0 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
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Algorithms Non-Lecture K: Approximation Algorithms Theorem 1. The makespan of the assignment computed by G REEDY L OAD B ALANCE is at most twice the makespan of the optimal assignment.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern