Greedy Approximations

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

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Approximation Algorithms

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

1 Variations of the Traveling Salesman Problem

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

CSC 373: Algorithm Design and Analysis Lecture 3

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

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

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

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

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

Coping with NP-Completeness

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

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

Approximability Results for the p-center Problem

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

1 The Traveling Salesperson Problem (TSP)

1 Better Approximation of the Traveling Salesman

Approximation Algorithms

The k-center problem Approximation Algorithms 2009 Petros Potikas

Lecture 7: Asymmetric K-Center

Theorem 2.9: nearest addition algorithm

Steiner Trees and Forests

Algorithm Design and Analysis

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Greedy algorithms Or Do the right thing

Introduction to Graph Theory

Approximation Algorithms

11. APPROXIMATION ALGORITHMS

Approximation Algorithms

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

/ Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang

Shortest path problems

1 Unweighted Set Cover

CS 598CSC: Approximation Algorithms Lecture date: March 2, 2011 Instructor: Chandra Chekuri

Lecture 8: The Traveling Salesman Problem

College of Computer & Information Science Fall 2007 Northeastern University 14 September 2007

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 14: Combinatorial Problems as Linear Programs I. Instructor: Shaddin Dughmi

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

CSE 202: Design and Analysis of Algorithms Lecture 4

Vertex Cover Approximations

Lecture 20 : Trees DRAFT

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15

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

Advanced Methods in Algorithms HW 5

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu

Solutions for the Exam 6 January 2014

The complement of PATH is in NL

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

11.1 Facility Location

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Solutions to Assignment# 4

Approximation Algorithms

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

EMBEDDING INTO l n. 1 Notation and Lemmas

Part II. Graph Theory. Year

Overview. 1 Preliminaries. 2 k-center Clustering. 3 The Greedy Clustering Algorithm. 4 The Greedy permutation. 5 k-median clustering

{ 1} Definitions. 10. Extremal graph theory. Problem definition Paths and cycles Complete subgraphs

11. APPROXIMATION ALGORITHMS

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

Polynomial-Time Approximation Algorithms

The Ordered Covering Problem

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

HW Graph Theory SOLUTIONS (hbovik)

Coverage Approximation Algorithms

Single Source Shortest Path

8 Matroid Intersection

DFS & STRONGLY CONNECTED COMPONENTS

1. Lecture notes on bipartite matching

Lecture 8: PATHS, CYCLES AND CONNECTEDNESS

Introduction to Algorithms

Graph theory - solutions to problem set 1

Homework 4 Solutions

1 Matchings in Graphs

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

Shortest Path Problem

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

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

Lecture 11: Analysis of Algorithms (CS ) 1

Chapter 8 DOMINATING SETS

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 03/02/17

11. APPROXIMATION ALGORITHMS

1 Linear programming relaxation

Chapter 8 DOMINATING SETS

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456

Notes for Lecture 24

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

Assignment 5: Solutions

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Introduction to Approximation Algorithms

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15

HW Graph Theory SOLUTIONS (hbovik) - Q

Lecture 6: Graph Properties

Fall CS598CC: Approximation Algorithms. Chandra Chekuri

Design and Analysis of Algorithms

6 Randomized rounding of semidefinite programs

Transcription:

CS 787: Advanced Algorithms Instructor: Dieter van Melkebeek Greedy Approximations Approximation algorithms give a solution to a problem in polynomial time, at most a given factor away from the correct solution. This lecture covers Greedy Approximation Algorithms, in the context of the Vertex Cover, Metric k-center, and Set Cover problems. 1 Vertex Cover A vertex cover of a graph is a set of vertices that covers the edges of the graph. That is, every edge has at least one endpoint in the covering set, or, equivalently, for every vertex, it is either in the set or adjacent to some vertex which is in the set. Given: Graph G = (V, E) Goal: Find a vertex cover of minimum size. 1.1 Approximation algorithm We first give the definition of matching. Definition 1 (Matching). Given a graph G = (V, E), a subset of the edges M E is a matching if no two edges of M share an endpoint. A matching of maximum number of edges is called a maximum matching. A maximal matching is one that cannot be extended by adding another edge. (A maximum matching is maximal but the reverse is not always true). We observe the following two facts: 1. OP T V C M, for any matching M in G. This is so because any vertex cover has to pick at least one endpoint of each edge in the matching, otherwise this edge would be uncovered. 2. For any maximal matching M, S = (u,v) M{u, v} is a VC. Assume it is not a VC. That means there is some edge e = (u, v) E left uncovered by the vertices in S. Then neither u or v is an endpoint of any edge in M and thus M could legally be extended by adding edge e. Thus M is not maximal and we have a contradiction, so S must be a VC. This also directly implies that OP T V C S. So we have OP T V C S = 2 M 2OP T V C. Theorem 1. Vertex Cover problem can be approximated to within factor of 2. Proof. We can use a greedy algorithm to construct a maximal matching M, then by the above two facts, we have S 2OP T V C, where S is the set of vertices matched in M. 1

1.2 Can the approximation guarantee be improved? We need to answer the following questions. Q1: Is OP T V C 2 M tight? Yes. Let K 2n+1 be a complete graph of 2n + 1 vertices. Then every maximal matching M has n edges and the vertex cover problem for K 2n+1 also has optimal solution with OP T = 2n. So this is a factor 2 approximation with tight bound. For other graphs, we might be able to improve the factor, for example, bipartite graphs have a factor 1 approximation. Q2: Is the analysis of the algorithm tight, i.e., S 2OP T V C? Yes. For example, a complete bipartite graph on n + n vertices has OP T V C = n, while the maximal matchings have M = n so S = 2 M = 2n. Q3: Is the theorem tight? We do not know! But by assuming reasonable complexity theoretic hypothesis, the answer is yes. 2 (Metric) k-center Given the locations of customers, the problem is to decide on the locations of at most k warehouses such that the maximum travel time over all the customers is minimized. We can define the problem formally as follows: Given: Complete (di)graph G = (V, E) Weights on the edges, d : E [0, ) k N Goal: Find set C V with C k s.t. the following objective is minimized: max (min (d(v, c))) v V c C C is our set of warehouses in this example, and customers are located at each vertex v V. Note that min c C (d(v, c)) is the distance of customer v to the nearest warehouse. Then max v V (...) effectively finds the distance traveled by the customer that must travel the longest to reach any warehouse. This customer is presumably the unhappiest. The overall goal is to then minimize the maximum unhappiness. Note that the problem in that original version, called k-center problem, is an NP-complete problem. Moreover, k-center cannot even be approximated (i.e. it cannot be solved efficiently to within any constant factor of the optimal objective). So, we consider the problem with the restriction that d is a metric on V. Definition 2 (Metric). A function d : X X R is a metric on the set X iff ( x, y, z X), 2

d(x, x) = 0 d(x, y) = d(y, x) d(x, z) d(x, y) + d(y, z) 2.1 Factor 2 approximation algorithm We begin with a useful claim. Claim 1. Within any set of k + 1 vertices, there is some pair, u, v, s.t. d(u, v) 2OP T. Proof. Since there are k +1 vertices, and only k centers (in the optimal solution to metric k-center), the pigeonhole principle tells us that at least two points must be associated with the same center. Let the vertices be u and v and the shared center be c. Because c is a center, and d is a metric, we have the following: d(u, v) d(u, c) + d(c, v) 2OP T This is also depicted in Figure 1. Two vertices which share a center are not farther than 2OP T because of the triangle inequality inherent in a metric function. OPT 2 OPT OPT Figure 1: Graphical example for the proof 3

Now we can present the algorithm. The metric version of k-center problem can be approximated by greedily selecting the customer who is furthest from any warehouse at each step, and putting the next warehouse at their location. Algorithm 1: Metric k-center Greedy Algorithm (1) if k V (2) return V (3) Pick c 1 arbitrarily (4) for i=2 to k (5) c i argmax v V (min j=1,..,i 1 (d(v, c j ))) (6) return C Claim 2. The algorithm gives a factor 2 approximation. Proof. Take any vertex v that is not selected by the end of this algorithm s execution. Consider this v along with the k selected vertices in C and also let c v argmin c C (d(v, c)). By Claim 1, we know that some pair of vertices in this group must have distance between them 2OP T. Case 1: v is one of the pair. Because d(v, c v ) d(v, c)( c C), we know that d(v, c v ) 2OP T. Case 2: v is not one of the pair. Then the pair is c i and c j, (i < j) (those vertices selected on iterations i and j in the algorithm). Because on iteration j, c j was selected in favor of v, we have the following: d(v, c v ) min c c1,..,c j 1 (d(v, c)) min c c1,..,c j 1 (d(c j, c)) d(c j, c i ) 2OP T The selection of v was arbitrary, so we know that any vertex not in C will have minimum distance to some c C that is at most a factor of 2 from the optimal unhappiest-customer s best distance. 2.2 Tightness example Now, let s look over the tight example below that shows us the extreme case resulting in the factor of 2 exactly. Example: Consider the metric k-center problem for the graph seen in the Figure 2 for k = 1. Suppose that all the spokes are assigned d = 1 whereas all the other edges are assigned d = 2. (The figure does not have all these edges but only some of them to prevent a crowding of lines). In this case, observe that OP T = 1 (just pick the center vertex). The algorithm is likely to pick one of the other vertices, however, and hence ALG = 2OP T. 4

Figure 2: Tightness example for the k-center problem 2.3 Better approximation? Question: Can we come up with a better factor than 2? Answer: No. (Unless P = NP) Theorem 2. For any ɛ > 0, metric k-center problem is not approximable within a factor of (2 ɛ) unless P = NP. Proof. We will translate an instance of vertex cover (VC) into an instance of the k-center problem. Remember the VC problem is to determine for a given graph G = (V, E) whether there is a set of vertices with size at most k such that all vertices are either in the set or adjacent to a vertex in the set by an edge in G. Given instance (G = (V, E), k) of VC, we construct an instance (G, d ) of metric k-center problem (G, d ) as follows: 1. G G 2. Remove isolated vertices (those with no edges) from G 3. Make G a complete graph by adding all missing edges 4. Define metric d for each edge e d (e) = { 1 if e E 2 if e / E This is a polynomial time construction. Further, this construction would allow us to distinguish yes and no cases for VC in polynomial time by running a factor (2 ɛ) approximation algorithm for metric k-center on (G, d ). This is because if G has a vertex cover of size at most k, then OP T (G ) = 1, otherwise OP T (G ) = 2. Suppose algorithm A is a factor (2 ɛ) approximation algorithm for the metric k-center problem. OP T (G ) = 1 V al(a(g )) (2 ɛ) OP T (G ) = 2 V al(a(g )) 2 These are easily distinguishable cases, so if such an algorithm A exists, P = NP. 5

3 Set Cover In the Set Cover problem, we have a bunch of items which we want to cover, and several sets, each covering some number of items, and each with a cost to take up the set. The goal is to cover all items, taking up the the minimum cost selection of sets to do so. Given: Universe U = [m] S 1, S 2,.., S n U w 1, w 2,.., w n [0, ) Goal: Find set I [n] s.t. S i = U, and i I w i is minimized i I Note that the requirement of positive weights is not a limitation. If we do have negative weights, to minimize the total weight we should choose all the subsets with negative weights. Then, we remove the elements in those subsets from the universe. Finally, it becomes a Set Cover problem with non-negative weights. In fact, Set Cover can be seen as a generalization of Vertex Cover. To reduce Vertex Cover to Set Cover, let U be the set of edges, S i be the set of edges that connect node i to another node, and w i = 1. This is a restricted version of Set Cover. The subsets are unweighted; i.e., all weigh the same. Also, f max uj U {i : u j S i } = 2, because an edge has exactly 2 endpoints. For this restricted version of Set Cover, we can directly apply the greedy algorithm for Vertex Cover, which gives a factor of 2 approximation. In general, if we relax f to be any number, the greedy technique of Vertex Cover will give us a factor f approximation. However, if there is any element that is in every subset, then f = m and we gain nothing from the approximation. 3.1 Factor (1 + ln m) approximation algorithm A greedy algorithm for Set Cover is presented below. The idea is to keep adding subsets that have minimum marginal cost per new element covered until all elements in U are covered. Algorithm 2: Set Cover Greedy Algorithm (1) C (2) I (3) while C U (4) Pick i [n] s.t. S i C > 0 and (5) I I {i} (6) C C S i (7) return I w i S i C is minimized 6

Theorem 3. The greedy algorithm for Set Cover is an approximation algorithm with factor H m, where H m = m j=1 1 j. Proof. Let u 1, u 2,..., u m be the order in which elements of U are added to C (This ordering is important for the following proof). We define P rice(u j ) to be the marginal cost per element at the time u j is added, i.e. P rice(u j ) = w i S i C Note that Cost(I) = i I w i = m j=1 P rice(u j). at the time u j is added. Claim 3. At the time u j is covered, P rice(u j ) OP T, where OP T denotes the cost of an optimal C solution. To see this, note that there is an optimal cover, I OP T. If we knew I OP T, then we could select all at once those i in I OP T that are not yet in I for extra cost no greater than OP T. Selecting these optimal sets would yield an average P rice for the elements in C of no more than OP T. Because C the minimum value in a group must be no more than the average value in the group, there must be some set in this optimal selection which alone would cover one or more elements at P rice no more than OP T. Since the P rice for a set cannot decrease over time, and our algorithm selects the set C with minimum P rice, we know that this bound is achieved. Claim 4. At the time u j is covered, C m j + 1. Let u j be the first of the elements covered in the iteration in which it is covered. This means that the number covered so far is C = (j 1), and we also have j j, so By Claim 3 and Claim 4, we have C = U C = m (j 1) = m j + 1 m j + 1 m Cost(Solution) = P rice(u j ) j=1 m OP T m j + 1 j=1 m = 1 OP T j j=1 = (H m )OP T (H m : mth harmonic number) (1 + ln m)op T Note that ( m 1 1 x dx) ( m j=1 1 j ) (1 + m 1 1 x dx). Thus, ln n H n 1 + ln n. 7

3.2 Tightness example Is the analysis of the algorithm tight? The answer is yes. The following is an example. Example: Let S 1 = {u 1 }, S 2 = {u 2 },..., S m = {u m }, S m+1 = {u 1, u 2,..., u m }, w i = 1 m i+1 (for i = 1..m), and w m+1 = 1 + ɛ. The optimal solution is to choose S m+1 alone, which gives OP T = 1 + ɛ. On the other hand, the approximation algorithm will choose S 1, S 2,..., S m and the cost is H m. 8