MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta

Slides:



Advertisements
Similar presentations
COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.
Advertisements

Inapproximability of Hypergraph Vertex-Cover. A k-uniform hypergraph H= : V – a set of vertices E - a collection of k-element subsets of V Example: k=3.
Lecture 23. Subset Sum is NPC
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
NP-Completeness: Reductions
An NP-completeness Example. The graph CLIQUE problem Undirected Graph G = (V, E) –a clique is a complete subgraph of G Subset V’ of vertices that are.
Lecture 21 NP-complete problems
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
CS21 Decidability and Tractability
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness.
1 Perfect Matchings in Bipartite Graphs An undirected graph G=(U  V,E) is bipartite if U  V=  and E  U  V. A 1-1 and onto function f:U  V is a perfect.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Fall 2006Costas Busch - RPI1 More NP-complete Problems.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Clique Cover Cook’s Theorem 3SAT and Independent Set
February 25, 2015CS21 Lecture 211 CS21 Decidability and Tractability Lecture 21 February 25, 2015.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
NP-Completeness: 3D Matching
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
1 3-COLOURING: Input: Graph G Question: Does there exist a way to 3-colour the vertices of G so that adjacent vertices are different colours? 1.What could.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
May 9, New Topic The complexity of counting.
Approximation Schemes Open Shop Problem. O||C max and Om||C max {J 1,..., J n } is set of jobs. {M 1,..., M m } is set of machines. J i : {O i1,..., O.
The Theory of Complexity for Nonpreemptive Scheduling 1.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Unit 9: Coping with NP-Completeness
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Instructor Neelima Gupta Table of Contents Class NP Class NPC Approximation Algorithms.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
1 Suppose I construct a TM M f which: 1. Preserves its input u. 2. Simulates a machine M b on input ε. 3. If M b hangs on input ε, force an infinite loop.
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
28.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 32.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
NP Hard Problems Instructor Neelima Gupta Presentation Edited by Sapna Grover.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
MCS 312: NP Completeness and Approximation Algorithms Instructor Neelima Gupta
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
COMPLEXITY THEORY IN PRACTICE
More NP-complete Problems
Perfect Matchings in Bipartite Graphs
More NP-complete Problems
NP-Completeness Proofs
1. for (i=0; i < n; i+=2) if (A[i] > A[i+1]) swap(A[i], A[i+1])
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Trevor Brown DC 2338, Office hour M3-4pm
Instructor: Aaron Roth
Instructor: Aaron Roth
Lecture 23 NP-Hard Problems
Presentation transcript:

MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta

Table of Contents 3D Matching Exact Cover

3-D Matching Problem Problem Definition Given Disjoint sets X, Y, Z, each of size n A set T XxYxZ of ordered triples To Find If there exists a set of n triples in T so that each element of X Y Z is contained in exactly one of these triples.

3-D Matching Problem Claim 3-D Matching is NP Complete Proof Part I 3-D Matching belongs to NP Given An instance of 3-D Matching A certificate containing a collection of triples T’ T It can clearly be verified in polynomial time that each element in X Y Z belongs to exactly one of the triples in T’.

3-D Matching Problem Part II 3-D Matching is NP-hard We prove the above by showing that 3-SAT ≤ p 3-D Matching We adopt the following approach  We first design gadgets that encode the independent choices involved in the truth assignment to each variable  We then add gadgets to encode constraints imposed by clauses. Given: A 3-SAT instance with n variables and k clauses

3-D Matching Problem Basic gadget associated with variable x i  Core of the gadget as A i = {a i1,a i2,….,a i,2k }  Tips of the gadget B i = {b i1,b i2,….,b i,2k }  A triple t ij = (a ij,a i,j+1,b ij ) for all j = 1, 2k, where addition is modulo 2k.  A triple t ij is even if j is even, and odd otherwise. Analogous for tip b ij.

Red nodes are the core elements Blue nodes are tips

Enhancing the variable gadget to model the clauses and the constraints on possible assignments imposed by them For clause C j, clause gadget is defined as follows:  Two core elements P j = {p j, p j ’}.  For each of the three terms in C j do the following If term = x i, define a triple (p j, p j ’,b i,2j ). If term = x i ’, define a triple (p j, p j ’,b i,2j-1 ).

3-D Matching Problem We understand this enhancement through an example. Consider the following clause C 1 = x 1 ’ v x 2 v x 3 ’ Interpretation: The matching should select the even tips of the first gadget, or odd tips of the second gadget, or even tips the third gadget. We first create gadgets for the three variables

3-D Matching Problem x1x1 x2x2 x3x3

We now model the assignment constraints with a clause gadget defined as follows: A set of 2 core elements P 1 = {p 1, p 1 ’} contained in the following 3 triples: (p 1, p 1 ’,b 1,1 ) (p 1, p 1 ’,b 2,2 ) (p 1, p 1 ’,b 3,1 )

3-D Matching Problem C 1

3-D Matching Problem How do we encode the idea that x i can either be set to 0 or 1 ? Either use all the even triples in gadget i, or all odd ones ! Selecting all even triples corresponds to setting x i = 0. In this case the odd tips would remain free for use. Selecting all odd triples corresponds to x i = 1. In this case, the even tips would remain free for use.

Enhancing the variable gadget to model the clauses and the constraints on possible assignments imposed by them For clause C j, clause gadget is defined as follows:  Two core elements P j = {p j, p j ’}.  For each of the three terms in C j do the following If term = x i, define a triple (p j, p j ’,b i,2j ). If term = x i ’, define a triple (p j, p j ’,b i,2j-1 ). Reserving the (2j) th and (2j-1) th tips of each variable gadget for clause gadget j ensures that the clause gadgets never compete for free tips. Since only the 3 triples defined corresponding to the 3 terms of C j cover P j, one of these must be used. This enforces the clause constraint.

Cleanup Gadgets We introduce (n-1)k cleanup gadgets !  The r th cleanup gadget consists of 2 core elements Q r = {q r, q r ’}  Create a triple (q r, q r ’,b) for every tip b in variable gadgets.

3-D Matching Problem Define X,Y and Z as follows: X consists of 1.all a ij with j even ….total number nk 2.The set of all p j ….. total number k 3.The set of all q i ….. total number (n – 1) k Y consists of 1.all a ij with j odd ….total number nk 2.The set of all p j ’ ….. total number k 3.The set of all q i ’ ….. total number (n – 1) k Z consists of 1.Set of all tips b ij …. ….. total number 2 n k Can you see that X, Y and Z are of same size….what’s the size? Each triple consists of one element from each of X,Y, and Z.

3-D Matching Problem Y consists of 1.all a ij with j odd 2.The set of all p j ’ 3.The set of all q i ’ Z consists of 1.Set of all tips b ij Can you see that X, Y and Z are of same size Each triple consists of one element from each of X,Y, and Z.

3-D Matching Problem We understand the above reduction with the help of an example ! Consider an instance of 3-SAT having 4 variables : x 1,x 2 x 3, x 4 3 clauses C 1 : (x 1 v x 2 v x 3 ’) C 2 : (x 2 ’ v x 3 v x 4 ) C 3 : (x 1 ’ v x 2 v x 4 ’)

Variable gadget for x 1 has the following components  Core A 1 = {a 11,a 12,….,a 1,6 }  Tips B 1 = {b 11,b 12,….,b 1,6 }  A triple t 1j = (a 1j,a 1,j+1,b 1j ) for all j, where addition is modulo 6. Tip 1 Tip 2 Tip 3 Tip 4 Tip 5 Tip 6

3-D Matching Problem Gadgets for the remaining variables can similarly be drawn. We now bring the clause gadgets into picture

C 1 : (x 1 v x 2 v x 3 ’) x1x1 x2x2 x3x3 p1’p1’ p1p1

C 2 : (x 2 ’ v x 3 v x 4 ) x2x2 x3x3 x4x4 p2’p2’ p2p2

C 3 : (x 1 ’ v x 2 v x 4 ’) x1x1 x2x2 x4x4 p3’p3’ p3p3

3-D Matching Problem Part I Consider the following satisfying assignment for the given 3-SAT instance x 1 = 1 x 2 = 0 x 3 = 1 x 4 = 0 We now try to find a matching.

We select the odd triples of gadget for x 1 since x 1 = 1. This leaves the even tips free for use Tip 1 Tip 2 Tip 3 Tip 4 Tip 5 Tip 6

We select the even triples of gadget for x 2 since x 2 = 0. This leaves the odd tips free for use Tip 1 Tip 2 Tip 3 Tip 4 Tip 5 Tip 6

We select the odd triples of gadget for x 3 since x 3 = 1. This leaves the even tips free for use Tip 1 Tip 2 Tip 3 Tip 4 Tip 5 Tip 6

We select the even triples of gadget for x 4 since x 4 = 0. This leaves the odd tips free for use Tip 1 Tip 2 Tip 3 Tip 4 Tip 5 Tip 6

C 1 : (x 1 v x 2 v x 3 ’) x1x1 x2x2 x3x3 p1’p1’ p1p1

C 2 : (x 2 ’ v x 3 v x 4 ) x2x2 x3x3 x4x4 p2’p2’ p2p2

C 3 : (x 1 ’ v x 2 v x 4 ’) x1x1 x2x2 x4x4 p3’p3’ p3p3

3-D Matching Problem Claim: 3-SAT is satisfiable if and only if there exists a perfect 3-D Matching Part I Given A satisfying assignment for the 3-SAT instance To Prove There exists a perfect 3-D Matching

Recap Define X,Y and Z as follows: X consists of 1.all a ij with j even ….total number nk 2.The set of all p j ….. total number k 3.The set of all q i ….. total number (n – 1) k Y consists of 1.all a ij with j odd ….total number nk 2.The set of all p j ’ ….. total number k 3.The set of all q i ’ ….. total number (n – 1) k Z consists of 1.Set of all tips b ij …. ….. total number 2 n k Can you see that X, Y and Z are of same size….what’s the size? Each triple consists of one element from each of X,Y, and Z.

3-D Matching Problem Proof  Make the corresponding choices of odd/even for each variable gadget based on the given assignment.  This leaves at least one free tip for each clause gadget.  Using the cleanup gadgets, we cover all the core elements in the variable, clause and cleanup gadgets, and all the tips too !

3-D Matching Problem Part II Given A perfect 3-D Matching in the instance constructed. Can we claim that this matching cannot possibly cover some even and some odd triples in any variable gadget, i.e., either all even or all odd triples are chosen ?

3-D Matching Problem Yes ! Any two consecutive triples share one of the core elements ! Therefore, any perfect matching cannot pick consecutive triples! If even triples have been chosen, set x i = 0 If odd triples have been chosen, set x i = 1

3-D Matching Problem Have the clauses been satisfied too ? Yes ! Since the core elements of every clause gadget have been covered, the following holds true for all clauses: At least one of the three variable gadgets corresponding to a term in any clause C j must have made the correct even/odd decision.

Big Thanks to Sonika Arora