MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta

Slides:



Advertisements
Similar presentations
Instructor Neelima Gupta Table of Contents Approximation Algorithms.
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
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
Department of Computer Science & Engineering
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
Reduction Techniques Restriction Local Replacement Component Design Examples.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
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.
Analysis of Algorithms CS 477/677
NP-complete examples CSC3130 Tutorial 11 Xiao Linfu Department of Computer Science & Engineering Fall 2009.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Odds and Ends HP ≤ p HC (again) –Turing reductions Strong NP-completeness versus Weak NP-completeness Vertex Cover to Hamiltonian Cycle.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Clique Cover Cook’s Theorem 3SAT and Independent Set
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 31.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
MCS312: NP-completeness and Approximation Algorithms
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
1 The TSP : NP-Completeness Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell.
Lecture 22 More NPC problems
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.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Techniques for Proving NP-Completeness Show that a special case of the problem you are interested in is NP- complete. For example: The problem of finding.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Additional NP-complete problems
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-Complete 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.
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
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
28.
CSC 413/513: Intro to Algorithms
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Introduction to NP Instructor: Neelima Gupta 1.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Instructor Neelima Gupta Table of Contents Introduction to Approximation Algorithms Factor 2 approximation algorithm for TSP Factor.
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.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-complete problems
Richard Anderson Lecture 26 NP-Completeness
More NP-complete Problems
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
More NP-complete Problems
Richard Anderson Lecture 28 NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Hamiltonian Circuit (HC) problem
Presentation transcript:

MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta

Table of Contents Hamiltonian Cycle

Hamiltonian Cycle Problem A Hamiltonian cycle in a graph is a cycle that visits each vertex exactly once Problem Statement Given A directed graph G = (V,E) To Find If the graph contains a Hamiltonian cycle

Hamiltonian Cycle Problem Hamiltonian Cycle Problem is NP-Complete Hamiltonian Cycle Problem is in NP. Given a directed graph G=(V,E), and a certificate containing an ordered list of vertices on a Hamiltonian Cycle. It can be verified in polynomial time that the list contains each vertex exactly once and that each consecutive pair in the ordering is joined by an edge.

Hamiltonian Cycle Problem Hamiltonian Cycle Problem is NP Hard 3-SAT ≤ p Hamiltonian Cycle We begin with an arbitrary instance of 3- SAT having variables x 1,…….,x n and clauses C 1,…….,C k We model one by one, the 2 n different ways in which variables can assume assignments, and the constraints imposed by clauses.

Hamiltonian Cycle Problem To correspond to the 2 n truth assignments, we describe a graph containing 2 n different Hamiltonian cycles. The graph is constructed as follows: Construct n paths P 1,…….,P n. Each P i consists of nodes v i1,….., v ib, where b = 2k (k being the number of clauses)

………………. P1P1 P2P2 P3P3

Hamiltonian Cycle Problem Draw edges from v ij to v i,j+1 ………………. P1P1 P2P2 P3P3

Hamiltonian Cycle Problem Draw edges from v i,j+1 to v i,j ………………. P1P1 P2P2 P3P3

Hamiltonian Cycle Problem For each i = 1,2,……..,n-1, define edges from v i1 to v i+1,1 and to v i+1,b. Also, define edges from v ib to v i+1,1 and v i+1,b ………………. P1P1 P2P2 P3P3

Add two extra nodes s and t. Define edges from s to v 11 and v 1b, from v n1 and v nb to t, and from t to s s t ………………. P1P1 P2P2 P3P3

Hamiltonian Cycle Problem Observations:  Any Hamiltonian cycle must use the edge (t,s)  Each P i can either be traversed left to right or right to left. This gives rise to 2 n Hamiltonian cycles.  We have therefore modeled the n independent choices of how to set each variable; if P i is traversed left to right, x i =1, else x i =0

Hamiltonian Cycle Problem We now add nodes to model the clauses Consider the clause C = (x 1 ’ν x 2 ν x 3 ’) What is the interpretation of the clause? The path P 1 should be traversed right to left, or P 2 should be traversed left to right, or P 3 right to left.

We add a node that does this ………………. P1P1 P2P2 P3P3 s t C

Hamiltonian Cycle Problem In general We define a node c j for each clause C j. In each path P i, positions 2j-1 and 2j are reserved for variables that participate in clause C j If C j contains x i, add edges (v i,2j-1, c j )and (c j, v i,2j ) If C j contains x i ’, add edges (v i,2j, c j )and (c j, v i,2j-1 ) Gadget constructed !

Hamiltonian Cycle Problem 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 ’)

Hamiltonian Cycle Problem We reduce the given instance as follows: n = 4k = 3b= 2*3 = 6 Construct 4 paths P 1, P 2, P 3, P 4 P 1 consists of nodes v 1,1, v 1,2,…….., v 1,6 P 2 consists of nodes v 2,1, v 2,2,…….., v 2,6 P 3 consists of nodes v 3,1, v 3,2,…….., v 3,6 P 4 consists of nodes v 4,1, v 4,2,…….., v 4,6

P1P P2P P3P P4P4 s t C1C1 5 C2C2 C3C3

Hamiltonian Cycle Problem Claim: 3-SAT instance is satisfiable if and only if G has a Hamiltonian cycle Proof: Part I Given A satisfying assignment for the 3-SAT instance If x i = 1, traverse P i left to right, else right to left. Since each clause C j is satisfied by the assignment, there has to be at least one path P i that moves in the right direction to be able to cover node c j. This P i can be spliced into the tour there via edges incident on v i,2j-1 and v i,2j

Hamiltonian Cycle Problem Let us try to verify this with our example Given A satisfying assignment for 3-SAT, say x 1 = 1 x 2 = 0 x 3 = 1 x 4 = 0 Let us check out a corresponding Hamiltonian cycle

P1P P2P P3P P4P4 s t C1C1 5 C2C2 C3C3

Hamiltonian Cycle Problem Part II Given A Hamiltonian cycle in G. Observe that if the cycle enters a node c j on an edge from v i,2j-1 it must depart on an edge to v i,2j. Why?

Hamiltonian Cycle Problem Because otherwise, the tour will not be able to cover this node while still maintaining the Hamiltonian property Similarly, if the path enters from v i,2j, it has to depart immediately to v i,2j-1.

Hamiltonian Cycle Problem However, in some situations it may so happen that the path enters c j from the first (or last) node of P i and departs at the first (or last) node of P i+1. In either case the following holds true: The nodes immediately before and after any c j in the cycle are joined by an edge in G, say e. Let us consider the following Hamiltonian cycle given on our graph

P1P P2P P3P P4P4 s t C1C1 5 C2C2 C3C3

Hamiltonian Cycle Problem Obtain a Hamiltonian cycle on the subgraph G – {c1,……ck} by removing c j and adding ‘e’ as shown below

P1P P2P P3P P4P4 s t C1C1 5 C2C2 C3C3

Hamiltonian Cycle Problem We now use this new cycle on the subgraph to obtain the truth assignments for the 3-SAT instance. If it traverses P i left to right, set x i =1, else set x i = 0. We therefore get the following assignments: x 1 = 1 x 2 = 0 x 3 = 0 x 4 = 1

Hamiltonian Cycle Problem Can we claim that the assignment thus determined would satisfy all clauses. YES ! Since the larger cycle visited each clause node cj, at least one Pi was traversed in the right direction relative to the node cj

Acknowledgements BIG Thanks to Sonika Arora