Algorithm Design and Analysis

Similar documents
CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Approximation Algorithms

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS

Theorem 2.9: nearest addition algorithm

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

Approximation Algorithms

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

Lecture 8: The Traveling Salesman Problem

Approximation Algorithms

Introduction to Approximation Algorithms

Approximation Algorithms

Lecture 1. 2 Motivation: Fast. Reliable. Cheap. Choose two.

Approximation Algorithms

11.1 Facility Location

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

Notes for Lecture 24

Lecture 7. s.t. e = (u,v) E x u + x v 1 (2) v V x v 0 (3)

Approximation Algorithms

val(y, I) α (9.0.2) α (9.0.3)

Approximation Algorithms

Algorithms for Euclidean TSP

Approximation Algorithms

A List Heuristic for Vertex Cover

1 The Traveling Salesperson Problem (TSP)

CSE 417 Branch & Bound (pt 4) Branch & Bound

Greedy algorithms Or Do the right thing

Prove, where is known to be NP-complete. The following problems are NP-Complete:

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

15-854: Approximations Algorithms Lecturer: Anupam Gupta Topic: Direct Rounding of LP Relaxations Date: 10/31/2005 Scribe: Varun Gupta

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

1 Better Approximation of the Traveling Salesman

Approximation Basics

Improved Approximations for Graph-TSP in Regular Graphs

A constant-factor approximation algorithm for the asymmetric travelling salesman problem

Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011

Approximation Algorithms

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Approximation Algorithms: The Primal-Dual Method. My T. Thai

CMPSCI611: Approximating SET-COVER Lecture 21

Slides on Approximation algorithms, part 2: Basic approximation algorithms

Greedy Approximations

Traveling Salesperson Problem (TSP)

1 Variations of the Traveling Salesman Problem

35 Approximation Algorithms

1 The Traveling Salesman Problem

Graphs and Algorithms 2015

CSE 548: Analysis of Algorithms. Lecture 13 ( Approximation Algorithms )

Partha Sarathi Mandal

CS521 \ Notes for the Final Exam

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

Assignment 5: Solutions

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

Copyright 2000, Kevin Wayne 1

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Chapter 16. Greedy Algorithms

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

An O(log n/ log log n)-approximation Algorithm for the Asymmetric Traveling Salesman Problem

Steiner Trees and Forests

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

4.1 Interval Scheduling

Polynomial time approximation algorithms

Combinatorial Optimization

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, Approximation Algorithms

Chapter 6. Dynamic Programming

Module 6 NP-Complete Problems and Heuristics

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Vertex Cover Approximations

Fall CS598CC: Approximation Algorithms. Chandra Chekuri

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

1 The Traveling Salesman Problem

6 ROUTING PROBLEMS VEHICLE ROUTING PROBLEMS. Vehicle Routing Problem, VRP:

Dynamic programming. Trivial problems are solved first More complex solutions are composed from the simpler solutions already computed

Design and Analysis of Algorithms

Institute of Operating Systems and Computer Networks Algorithms Group. Network Algorithms. Tutorial 4: Matching and other stuff

The Subtour LP for the Traveling Salesman Problem

Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching

Coping with NP-Completeness

1 Unweighted Set Cover

and 6.855J Lagrangian Relaxation I never missed the opportunity to remove obstacles in the way of unity. Mohandas Gandhi

6 Randomized rounding of semidefinite programs

6. Lecture notes on matroid intersection

Chapter 9 Graph Algorithms

Online Algorithms. Lecture 11

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Exact Algorithms for NP-hard problems

Basic Approximation algorithms

Module 6 NP-Complete Problems and Heuristics

In this lecture, we ll look at applications of duality to three problems:

CS 6783 (Applied Algorithms) Lecture 5

Transcription:

Algorithm Design and Analysis LECTURE 29 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/7/2016

Approximation algorithm? Suppose a minimization problem is NP hard 12/7/2016 Cannot find a polynomial-time algorithm that finds optimal solution on every instance What if I can guarantee that my algorithm s solution is within 5% of optimal? That is, Minimization problems: OPT output 1.05 OPT Maximization problems: Good enough? Depends on context OPT 1.05 output OPT If data is already noisy or we don t know exact cost function, then approximation might be fine.

NP-Completeness as a Design Guide Q. Suppose I need to solve an NP-complete problem. What should I do? A. You are unlikely to find poly-time algorithm that works on all inputs. Must sacrifice one of three desired features. Solve problem in polynomial time ( e.g., fast exponential algorithms) Solve arbitrary instances of the problem Solve problem to optimality ( approximation algorithms) -approximation algorithm. Guaranteed to run in poly-time. Guaranteed to solve arbitrary instance of the problem Guaranteed to find solution within ratio of true optimum. Challenge. Need to prove a solution's value is close to optimum, without even knowing what optimum value is!

Some Approximation Algorithms Knapsack For any δ: there is a (1+δ)-approximation in time O(n/δ) by rounding weights to multiples of δw Metric Traveling Salesman Inorder traversal of MST is a 2-approx Best known: 1+ 5 2 -approximation Unweighted Vertex Cover size of any maximal matching M is 2-approximation (Sandwich: M opt-vc 2 M ) 12/7/2016

12/7/2016 Metric TSP Input: undirected G, non-negative edge lengths w Goal: path p that visits all vertices of minimum length Metric TSP: Repeat visits are ok. Why metric? Can always use shortest path to go from u to v So may as well assume all edges are present and w u, v = d u, v (where d = distance in original G) Algorithm: Look at MST. Find MST T Pick a root, order children of each vertex arbitrarily Output: vertices along inorder traversal of T Theorem: Algorithm produces a 2-approximation to TSP

Metric TSP: Beyond the MST [Christofides 1976]: look at set of odd-degree vertices S Add min-weight matching (Edmonds) on S This adds OPT/2 to total weight since optimal tour of S can be written as union of two disjoint matchings [T. Momke and O. Svensson 11] (1.46 )-approximation for special case of unweighted graphs (distances correspond to shortest paths in a graph with all edge lengths 1) 12/7/2016

12/7/2016 Load Balancing

Load Balancing Input. m identical machines; n jobs, job j has processing time t j. Job j must run contiguously on one machine. A machine can process at most one job at a time. Def. Let J(i) be the subset of jobs assigned to machine i. The load of machine i is L i = j J(i) t j. Def. The makespan is the maximum load on any machine L = max i L i. Load balancing. Assign each job to a machine to minimize makespan. Hardness. Load Balancing is NP-complete even for 2 machines. Exercise. Prove this statement. Hint: to prove NP-hardness, reduce from Number Partitioning. Today: approximation algorithms for Load Balalncing.

Load Balancing: List Scheduling List-scheduling algorithm. Consider n jobs in some fixed order. Assign job j to machine whose load is smallest so far. List-Scheduling(m, n, t 1,t 2,,t n ) { for i = 1 to m { L i 0 load on machine i J(i) jobs assigned to machine i } } for j = 1 to n { i = argmin k L k J(i) J(i) {j} L i L i + t j } return J machine i has smallest load assign job j to machine i update load of machine i Implementation. O(n log n) using a priority queue.

Load Balancing: List Scheduling Analysis Theorem. [Graham, 1966] Greedy algorithm is a 2-approximation. First worst-case analysis of an approximation algorithm. Need to compare resulting solution with optimal makespan L*. Lemma 1. The optimal makespan L* max j t j. Pf. Some machine must process the most time-consuming job. Lemma 2. The optimal makespan Pf. The total processing time is j t j. L * m 1 j t j. One of m machines must do at least a 1/m fraction of total work.

Load Balancing: List Scheduling Analysis Theorem. Greedy algorithm is a 2-approximation. Pf. Consider load L i of bottleneck machine i. Let j be last job scheduled on machine i. When job j assigned to machine i, i had smallest load. Its load before assignment is L i - t j L i - t j L k for all 1 k m. blue jobs scheduled before j machine i j 0 L i - t j L = L i

Load Balancing: List Scheduling Analysis Theorem. Greedy algorithm is a 2-approximation. Pf. Consider load L i of bottleneck machine i. Let j be last job scheduled on machine i. When job j assigned to machine i, i had smallest load. Its load before assignment is L i - t j L i - t j L k for all 1 k m. Sum inequalities over all k and divide by m: Now L i (L i t j ) t j 2L *. L* Lemma 1 L i t j m 1 k L k 1 m k t k L * L* Lemma 2

Load Balancing: List Scheduling Analysis Q. Is our analysis tight? A. Essentially yes. Ex: m machines, m(m-1) jobs length 1 jobs, one job of length m machine 2 idle machine 3 idle machine 4 idle m = 10 machine 5 idle machine 6 idle machine 7 idle machine 8 idle machine 9 idle machine 10 idle list scheduling makespan = 19

Load Balancing: List Scheduling Analysis Q. Is our analysis tight? A. Essentially yes. Ex: m machines, m(m-1) jobs length 1 jobs, one job of length m m = 10 optimal makespan = 10

Load Balancing: LPT Rule Longest processing time (LPT). Sort n jobs in descending order of processing time, and then run list scheduling algorithm. LPT-List-Scheduling(m, n, t 1,t 2,,t n ) { Sort jobs so that t 1 t 2 t n for i = 1 to m { L i 0 J(i) } load on machine i jobs assigned to machine i } for j = 1 to n { i = argmin k L k J(i) J(i) {j} L i L i + t j } return J machine i has smallest load assign job j to machine i update load of machine i

Load Balancing: LPT Rule Observation. If at most m jobs, then list-scheduling is optimal. Pf. Each job put on its own machine. Lemma 3. If there are more than m jobs, L* 2 t m+1. Pf. Consider first m+1 jobs t 1,, t m+1. Since the t i 's are in descending order, each takes at least t m+1 time. There are m+1 jobs and m machines, so by pigeonhole principle, at least one machine gets two jobs. Theorem. LPT rule is a 3/2 approximation algorithm. Pf. Same basic approach as for list scheduling. L i (L i t j ) L* t j 1 2 L* 3 2 L *. Lemma 3 ( by observation, can assume number of jobs > m )

Load Balancing: LPT Rule Q. Is our 3/2 analysis tight? A. No. Theorem. [Graham, 1969] LPT rule is a 4/3-approximation. Pf. More sophisticated analysis of same algorithm. Q. Is Graham's 4/3 analysis tight? A. Essentially yes. Ex: m machines, n = 2m+1 jobs, 2 jobs of length m+1, m+2,, 2m-1 and one job of length m. Exercise: Understand why.

Load Balancing: State of the Art Polynomial Time Approximation Scheme (PTAS). (1 + )-approximation algorithm for any constant > 0. [Hochbaum-Shmoys 1987] Consequence. PTAS produces arbitrarily high quality solution, but trades off accuracy for time.

12/7/2016 Weighted Vertex Cover

Weighted Vertex Cover Weighted vertex cover. Given a graph G with vertex weights, find a vertex cover of minimum weight. 2 4 2 4 2 9 2 9 weight = 2 + 2 + 4 weight = 2+9=11

Linear Programming and Approximation 12/7/2016

LP and Appoximation Major technique in approximation algorithms 1. Design a linear program whose integer solutions correspond to the problem you are solving 2. Solve the (fractional) linear program 3. Construct an integral solution from the fractional solution 12/7/2016

Weighted Vertex Cover: IP Formulation Weighted vertex cover. Given an undirected graph G = (V, E) with vertex weights w i 0, find a minimum weight subset of nodes S such that every edge is incident to at least one vertex in S. Integer programming formulation. Model inclusion of each vertex i using a 0/1 variable x i. x i 0 if vertex i is not in vertex cover 1 if vertex i is in vertex cover Vertex covers in 1-1 correspondence with 0/1 assignments: S = {i V : x i = 1} Objective function: minimize i w i x i. Constraints for each edge (i,j): must take either i or j: x i + x j 1.

Weighted Vertex Cover: IP Formulation Weighted vertex cover. Integer programming formulation. (ILP) min w i x i i V s. t. x i x j 1 (i, j) E x i {0,1} i V Observation. If x* is optimal solution to (ILP), then S = {i V : x* i = 1} is a min weight vertex cover.

Weighted Vertex Cover: LP Relaxation Weighted vertex cover. Linear programming formulation. (LP) min w i x i i V s. t. x i x j 1 (i, j) E x i 0 i V Observation. Optimal value of (LP) is optimal value of (ILP). Pf. LP has fewer constraints. Note. LP is not equivalent to vertex cover. ½ ½ Q. How can solving LP help us find a small vertex cover? A. Solve LP and round fractional values. ½

Weighted Vertex Cover Theorem. If x* is optimal solution to (LP), then S = {i V : x* i ½} is a vertex cover whose weight is at most twice the min possible weight. Pf. [S is a vertex cover] Consider an edge (i, j) E. Since x* i + x* j 1, either x* i ½ or x* j ½ (i, j) covered. Pf. [S has desired cost] Let S* be optimal vertex cover. Then w i i S* * w i x i 1 w 2 i i S i S LP is a relaxation x* i ½

Weighted Vertex Cover Theorem. 2-approximation algorithm for weighted vertex cover. Theorem. [Dinur-Safra 2001] If P NP, then no -approximation for < 1.3607, even with unit weights. 10 5-21 Theorem [Khot, Regev 2008]: If the unique games conjecture is true, then no -approximation for < 2, even with unit weights. Open research problem. Close the gap.

Approximation algorithms summary For many NP-complete problems, we can find good approximate solutions in polynomial time Often, we can prove an upper bound on the approximation factor In practice, the techniques of approximation algorithms lead to very useful solutions For particular instances, the appoximation ratio is much better than proven worst-case guarantees