The Nonsense Prerequisites [2.5]

Similar documents
UNIVERSITY OF TORONTO Department of Computer Science April 2014 Final Exam CSC373H1S Robert Robere Duration - 3 hours No Aids Allowed.

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

Approximation Algorithms

12.1 Formulation of General Perfect Matching

CMPSCI 311: Introduction to Algorithms Practice Final Exam

6. Lecture notes on matroid intersection

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

11.1 Facility Location

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

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

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

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

Lecture 22 Tuesday, April 10

1. Lecture notes on bipartite matching February 4th,

1 Unweighted Set Cover

Steiner Trees and Forests

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

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

NP and computational intractability. Kleinberg and Tardos, chapter 8

Notes for Lecture 24

5. Lecture notes on matroid intersection

1 Definition of Reduction

CSC Linear Programming and Combinatorial Optimization Lecture 12: Semidefinite Programming(SDP) Relaxation

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Solution for Homework set 3

W4231: Analysis of Algorithms

Lecture 7: Asymmetric K-Center

8 Matroid Intersection

Approximation Algorithms

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Notes for Recitation 8

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

The Resolution Algorithm

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

ACO Comprehensive Exam October 12 and 13, Computability, Complexity and Algorithms

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.

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

9.1 Cook-Levin Theorem

Theorem 2.9: nearest addition algorithm

COMP260 Spring 2014 Notes: February 4th

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

11. APPROXIMATION ALGORITHMS

MATH20902: Discrete Maths, Solutions to Problem Set 1. These solutions, as well as the corresponding problems, are available at

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

2 The Fractional Chromatic Gap

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting

CS264: Homework #4. Due by midnight on Wednesday, October 22, 2014

NP-Complete Reductions 2

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

Questions Total Points Score

Approximation Algorithms

Lecture 4: Petersen Graph 2/2; also, Friendship is Magic!

CS261: Problem Set #2

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

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

11. APPROXIMATION ALGORITHMS

EXERCISES SHORTEST PATHS: APPLICATIONS, OPTIMIZATION, VARIATIONS, AND SOLVING THE CONSTRAINED SHORTEST PATH PROBLEM. 1 Applications and Modelling

Treewidth and graph minors

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

CSC 373: Algorithm Design and Analysis Lecture 3

ISA 562: Information Security, Theory and Practice. Lecture 1

Lecture 4: Primal Dual Matching Algorithm and Non-Bipartite Matching. 1 Primal/Dual Algorithm for weighted matchings in Bipartite Graphs

Mathematical and Algorithmic Foundations Linear Programming and Matchings

1 Linear programming relaxation

Lecture 21: Other Reductions Steven Skiena

10. EXTENDING TRACTABILITY

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

1 The Traveling Salesperson Problem (TSP)

6 Randomized rounding of semidefinite programs

11. APPROXIMATION ALGORITHMS

Chordal Graphs: Theory and Algorithms

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

Chapter 6 DOMINATING SETS

or else take their intersection. Now define

Fast algorithms for max independent set

On a n Ed g e Crossing P roblem

Lecture 7: Counting classes

NP-complete Reductions

An NP-complete Problem for the Abelian Sandpile Model

Ma/CS 6b Class 26: Art Galleries and Politicians

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

9.5 Equivalence Relations

9 Directed graphs & Partial Orders

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

Chapter 9 Graph Algorithms

Exercises: Disjoint Sets/ Union-find [updated Feb. 3]

CUT VERTICES IN ZERO-DIVISOR GRAPHS OF FINITE COMMUTATIVE RINGS

Introduction to Graph Theory

Scribe: Virginia Williams, Sam Kim (2016), Mary Wootters (2017) Date: May 22, 2017

Assignment # 4 Selected Solutions

by conservation of flow, hence the cancelation. Similarly, we have

Dynamic-Programming algorithms for shortest path problems: Bellman-Ford (for singlesource) and Floyd-Warshall (for all-pairs).

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Hardness of Subgraph and Supergraph Problems in c-tournaments

Greedy algorithms is another useful way for solving optimization problems.

4 Greedy Approximation for Set Cover

CS103 Spring 2018 Mathematical Vocabulary

1. What do you get as the integer and noninteger parts if you factor this as we did with our cutting planes:

1. Lecture notes on bipartite matching

MATH10001 Mathematical Workshop. Graphs, Trees and Algorithms Part 2. Trees. From Trees to Prüfer Codes

Transcription:

CSC 373 - Algorithm Design, Analysis, and Complexity Summer 2014 Assignment 4: Due Friday August 9, Noon - Solutions Please follow the instructions provided on the course website to submit your assignment. You may submit the assignments in pairs. Also, if you use any sources (textbooks, online notes, friends) please cite them for your own safety. You can use those data-structures and algorithms discussed in CSC263 (e.g. merge-sort, heaps, etc.) and in the lectures by stating their name. You do not need to provide any explanation or pseudo-code for their implementation. You can also use their running time without proving them: for example, if you are using the merge-sort in your algorithm you can simply state that merge-sorts running time is O(n log n). Every time you are asked to design an efficient algorithm, you should provide both a short high level explanation of how your algorithms works in plain English, and the pseudo-code of your algorithm similar to what we ve seen in class. State the running time of your algorithm with a brief argument supporting your claim. You must prove that your algorithm finds an optimal solution! The Mute Prison [2.5] An international prison manager, trying to keep swearing off his institution, wants to place inmates into cells so that no two inmates speak the same language. Given a table T of n inmates and m languages where T [i, j] = 1 if inmate i speaks language j and 0 otherwise; the manager wants to know whether there exists a subset S of the inmates where S k and no two inmates in S speak the same language. Let s call this problem The Mute Prison problem. 1. Show that The Mute Prison problem is NP-complete. The problem is in NP since we can exhibit a set of k inmates, and in polynomial time check whether any two of them speak the same language. To show that the problem is NP-hard, we give a reduction from INDEPENDENT SET. Given an instance of INDEPENDENT SET G(V, E), k, we construct an inmate for every v V, and a language for every edge e E. We then build an array that says that inmate v speaks language e if edge e is incident to vertex v. The Mute Prison problem asks whether this array has a subset S of size at least k such that no two prisoners in S speak the same language. We claim that this holds if and only if G has an independent set of size at least k. If such a subset S exists where S k, then the corresponding set of nodes in G has the property that no two are incident to the same edge - so it is an independent set of size at least k. Conversely, if there is an independent set of size at least k in G, then the corresponding set of inmates has the property that no two speak the same language. The Nonsense Prerequisites [2.5] University of Chaos computer system crashed. While recovering it, you noticed that the prerequisite data was corrupted. Some prerequisites were added and shouldn t have been. For instance, the original prerequisite 1

2 path to get to CSC373 was to take 165 236 263 373. After the crash, the prerequisite 373 236 was added, thus creating a cycle from 236 263 373 236. At University of Chaos, we don t really care that much if prerequisites make sense, but rather just want to avoid having cycles. Your job is to break these cycles. In the example above, you could do so by removing one the following prerequisites: 236 263, 263 373 or 373 236. More formally, we define The Nonsense Prerequisites problem as follows: Suppose you are given a list n courses, you can construct a directed graph G(V, E) where every vertex is a course, and the edge (i, j) directed i j means course i is a prerequisite for course j. You are also given a positive integer k, and you want to return 1 if and only if there exists a subset E E of edges whose removal makes G acyclic and E k. 1. Show that The Nonsense Prerequisites problem is in NP and give a reduction from VERTEX COVER to show that it is NP-hard. This problem is known as the Feedback Arc Set Problem (FAS), formally defined as follows: Input: A directed graph G(V, E) and a positive integer k. Problem: Return 1 if and only there exists a subset E E of edges such that E k and the removal of E makes G acyclic. Recall topological sort takes linear time in the size of the graph, i.e. O( V + E ) time. Given a subset of edges, we can thus check in linear time if the size of the subset E is at most k, and if the G(V, E\E ) is acyclic. Therefore FAS is in NP. To show that FAS is NP-hard, we give a reduction from VERTEX COVER. Let G(V, E), k be an instance of VERTEX COVER, which we transform to an instance of FAS G (V, E ), k in linear time as follows: For every vertex v V, we add two corresponding vertices v in, v out V that we connect by a directed edge (v in v out ), and for every edge (u, v) E, we add the directed edges (u out v in ) and (v out u in ) to E. Finally we set k = k; and claim that G has a vertex cover of size at most k iff G has a FAS of size at most k. Proof. ( = ) Suppose G has a vertex cover S where S k. For every v S, consider removing the edge (v in, v out ) in G. The resulting graph is acyclic. If a cycle in G enters a vertex in v in, it can only leave through the edge (v in, v out ) given our construction. Similarly, a cycle can only enter v out through the edge (v in, v out ). Thus if a cycle in G uses the edge (u out, v in ), it must use the edge (u in, u out ) and the edge (v in, v out ). At least one of the these two edges would have been removed since at least one of u or v must be in the vertex cover to cover the edge (u, v) E. Therefore if G has a vertex cover of size at most k then G has a feedback arc set of size at most k = k as well. ( = ) Conversely, suppose G has a FAS S of size at most k. Without loss of generality, we assume that the only edges removed are of the form (u in, u out ) because if some other edge (u out, v in ) is removed, then all cycles in which this edge participated would have included the edge (v in, v out ) too and we could remove this edge instead. We drop the arrow notations for the rest of the proof and assume (u, v) V to be the edge directed from u to v

3 We claim that the set of vertices v V for which the corresponding edge (v in, v out ) is removed in E forms a vertex cover for G. Suppose not, and suppose there is some edge (u, v) E not covered. Then in G the cycle (u in, u out ), (u out, v out ), (v in, v out ), (v out, u in ) is unbroken by the removal of the edges contradicting the assumption. Thus (G, k) must have a vertex cover of size at most k = k. Since FAS is in NP and is NP-hard, it follows that it is NP-complete. T-rex Christmas [2.5] Suppose there is a group of n short armed people sitting around a table, wanting to exchange their Christmas presents. If person i has a present for person j, person i can send their wrapped package either clockwise or counter clockwise around the table. Suppose the people are numbered from 0 to n 1 clockwise around the table. Because these people s arms are short, passing presents around the table is quite tiring, and you, kind supervisor, want to minimize the number of passes on the table. The number of passes P i between (i, i + 1[n]) is the total number of presents that have to go between person i and person i + 1 modulo n. The total number of passes of the table is max P i. 0 i n 1 The T-rex Christmas Problem: You are given the cycle from 0 to n 1 people and a list L of pairs (i, j), person i has a present for person j. Your goal is to decide which way to send the presents around the table so as to minimize the number of passes on the table. 1. Give a {0, 1}-integer programming formulation of the T-rex Christmas Problem. 2. Give an LP relaxation and rounding scheme of your integer program above. Prove that the rounded solution is also a solution to the integer program, and show that the rounding scheme attains a 2- approximation. This problem is known as the SONNET ring loading problem and it arises in communication networks quite often. In this setting, the network consists of n nodes numbered 0 to n 1 clockwise around the cycle, and the pair (i, j) denotes the call originated at node i and destined to node j. The call can be routed clockwise or counterclockwise around the ring. We first give a {0, 1}-integer programing formulation to the problem: For the k th pair (i, j), we create two 0-1 variables x k 0, x k 1 that correspond to the two possibilities of how to send the gift (or route the call): 0 for clockwise and 1 for counterclockwise. Clearly, we must have x k 0 +x k 1 = 1. Notice that for any link (i, i + 1[n]), one of the two routings of the k th pair (i, j) will use this link. We capture this, by introducing a variable α(k, i) where α(k, i) = 0 if the clockwise routing uses this link and α(k, i) = 1 if the counterclockwise routing uses this link. T-rex humans [n] means modulo n

4 Our formulation is thus the following: minimize P s.t. x k 0 + x k 1 = 1 k L P i [0, 1,..., n 1] k L x k α(k,i) x k 0 {0, 1} k L x k 1 {0, 1} k L P 0 We relax the integer program to a linear program by changing the integrality constraints to 0 x k 0 1, 0 x k 1 1. Notice that the constraint 1 can be dropped since it is already covered by the first constraint in the LP (x k 0 + x k 1 = 1). Let P with values x 1 0,..., x m 0, x 1 1,..., x m 1, where m is the total number of presents, be the optimal solution to the relaxed LP. We will construct an integral solution ˆx 1 0,..., ˆx m 0, ˆx 1 1,..., ˆx m 1 by performing a rounding scheme as follows: For every k th pair in L, if x k 0 1/2 we round ˆx k 0 = 1, ˆx k 1 = 0. Otherwise we set ˆx k 0 = 0, ˆx k 1 = 1. We claim that this rounding gives us a 1 2-approximation. Let OP T denote the optimal IP solution. Notice that for any i 1, 2..., n 1 we have: k L ˆx k α(k,i) 2 k L 2 P 2OP T x k α(k,i) Vertex Cover again... [2.5] Consider this variation of Vertex Cover: Suppose you have a graph G(V, E) with costs on both the vertices and edges: C v : V R + and C e : E R +. Your goal is to construct a vertex cover S so as to minimize the total cost of S, where the cost of S is computed as follows: For every vertex w S you pay C v (w); and for every edge f not covered by an element in S, you pay C e (f). In other words, you are allowed to leave some edges uncovered, but you pay for them. More formally, given G(V, E, C v, C e ), you want a set S V such that the cost below is minimized: cost(s) = w S C v (w) + (u,z) E u,z / S C e ((u, z)) 1. Give a {0, 1}-integer programming formulation of the problem above. 2. Give an LP relaxation and rounding scheme of your integer program above. Prove that the rounded solution is also a solution to the integer program, and show that the rounding scheme attains a 3- approximation. We introduce two new variables x i for every i V, and y ij for every (i, j) E, where x i = 1 iff vertex i is

5 in the vertex cover and y ij = 1 iff edge (i, j) is not covered. minimize x i C v (i) + i V (i,j) E y ij C e (i, j) s.t. x i + x j + y ij 1 (i, j) E x i {0, 1} i V y ij {0, 1} (i, j) E The rounding scheme for this LP is to set each x i to 1 if x 1 3 and every ỹ ij to 1 if yij 1 3, and 0 otherwise for both variables. This rounding gives us a 1 3 approximation; the rest of the argument is similar to the -approximation we did in class. 1 2 Notice that setting the rounding at the 1 2 threshold does not cover the case where for a given edge (i, j), the LP gives us x i = x j = y ij = 1 3. This edge is covered in the optimal LP but wouldn t be cover in our IP, have we used the 1 2 rounding.