Odds and Ends HP ≤ p HC (again) –Turing reductions Strong NP-completeness versus Weak NP-completeness Vertex Cover to Hamiltonian Cycle.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

Polynomial-time reductions We have seen several reductions:
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
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.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Combinatorial Algorithms
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
Techniques for Proving NP-Completeness
Reduction Techniques Restriction Local Replacement Component Design Examples.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
NP-complete and NP-hard problems
The Knapsack Problem The classic Knapsack problem is typically put forth as: A thief breaks into a store and wants to fill his knapsack with as much value.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
Example: HP ≤ p HC Hamiltonian Path –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Path? Hamiltonian Cycle –Input: Undirected.
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Dynamic Programming 0-1 Knapsack These notes are taken from the notes by Dr. Steve Goddard at
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
The Knapsack Problem Input –Capacity K –n items with weights w i and values v i Goal –Output a set of items S such that the sum of weights of items in.
Hardness Results for Problems
NP Complete: The Exciting Conclusion Review For Final
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
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.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
1 Steiner Tree Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
DP TSP Have some numbering of the vertices We will think of all our tours as beginning and ending at 1 C(S, j) = length of shortest path visiting each.
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
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.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
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.
WK15. Vertex Cover and Approximation Algorithm By Lin, Jr-Shiun Choi, Jae Sung.
Instructor Neelima Gupta Table of Contents Class NP Class NPC Approximation Algorithms.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NP-completeness NP-complete problems. Homework Vertex Cover Instance. A graph G and an integer k. Question. Is there a vertex cover of cardinality k?
Algorithms for hard problems Introduction Juris Viksna, 2015.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Introduction to NP Instructor: Neelima Gupta 1.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
The Theory of NP-Completeness
More NP-Complete and NP-hard Problems
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Chapter 5. Optimal Matchings
The Theory of NP-Completeness
Richard Anderson Lecture 27 Survey of NP Complete Problems
The Greedy Approach Young CS 530 Adv. Algo. Greedy.
Presentation transcript:

Odds and Ends HP ≤ p HC (again) –Turing reductions Strong NP-completeness versus Weak NP-completeness Vertex Cover to Hamiltonian Cycle

Example: HP ≤ p HC Hamiltonian Path –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Path? Hamiltonian Cycle –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Cycle?

Specification of R(x) Consider any undirected graph G = (V,E) as input x R(x) will be a graph G’ = (V’, E’) where –V’ = V union {v} where v is not in V –E’ = E union {(v,w) | w in V} Argument that R(x) has polynomial size –We add exactly 1 node and |V| edges.

x is yes  R(x) is yes Suppose graph G has a Hamiltonian Path Let this path be v 1, v 2, …, v n We now argue that v 1, v 2, …, v n, v is a Hamiltonian Cycle in G’ –First, all nodes in V’ are included exactly once above or else v 1, v 2, …, v n would not be a HP in G –Since G’ has all the edges that G has, (v i,v i+1 ) is an edge in E’ for 1 ≤ i ≤ n-1 –Finally, since E’ contains edge (v,w) for all w in V, it must be the case that E’ contains edges (v n, v) and (v,v 1 ).

R(x) is yes  x is yes Suppose graph G’ has a Hamiltonian Cycle Let this cycle be v 1, v 2, …, v n, v We now argue that v 1, v 2, …, v n is a Hamiltonian Path in G –First, all nodes in V are included exactly once above or else v 1, v 2, …, v n, v would not be a HC in G’ –Since the only extra edges in E’ compared to E are edges involving node v, it must be the case that E contains edge (v i,v i+1 ) for 1 ≤ i ≤ n-1

Turing Reducibility Consider the following alternate reduction. Given graph G, output  (n 2 ) graphs G v,w = (V,E v,w ) where –E v,w = E union {(v,w)} where v,w are nodes in V This is not a polynomial-time reduction because we are outputting  (n 2 ) graphs. However, this idea can be used to show that if HC can be solved in polynomial time, then HP can be solved in polynomial time. –Run each graph G v,w through our procedure that solves HC. –If HC says yes for any one of these graphs, return yes. –Otherwise return no. This more general reduction is often called a Turing reduction. We allow ourselves to use the procedure that solves HC (or  2 ) a polynomial number of times rather than just once.

Number Problems Problems where the inputs are numbers –Prime number problem: Input: Integer n Yes/No Question: Is n prime? –Partition problem Input: Set S of n numbers {s 1, …, s n } Yes/No Question: Is there an S’ subset of S such that the sum of numbers in S’ = the sum of numbers in S – S’. What is the input size for these problems?

Knapsack Problem 0-1 Knapsack optimization problem –Input Capacity K n items with weights w i and values v i –Yes/No Question Find a set of items S such that –the sum of weights of items in S is at most K –the sum of values of items in S is maximized We gave a dynamic programming solution for this problem We showed that Partition ≤ p Knapsack on hw 8 Is this a contradiction?

Definining subproblems Define P(i,w) to be the problem of choosing a set of objects from the first i objects that maximizes value subject to weight constraint of w. –Impose an arbitrary ordering on the items V(i,w) is the value of this set of items Original problem corresponds to V(n, K)

Recurrence Relation/Running Time V(i,w) = max (V(i-1,w-w i ) + v i, V(i-1, w)) –A maximal solution for P(i,w) either uses item i (first term in max) or does NOT use item i (second term in max) V(0,w) = 0 (no items to choose from) V(i,0) = 0 (no weight allowed) What is the running time of this solution? –Number of table entries: –Time to fill each entry:

Example w A = 2 v A = $40 w B = 3 v B = $50 w C = 1 v C = $100 w D = 5 v D = $95 w E = 3 v E = $30 Weight Items

Weak NP-completeness An NP-complete problem is called “weakly NP- complete” if it has in its description one or more integer parameters and the corresponding problem where these parameters are represented in unary is in P. An NP-complete problem is strongly NP- complete if the problem is still NP-complete even if integer parameters are encoded in unary

Vertex Cover to Ham Cycle Edge Component: For every edge in the Minimum Vertex Cover problem, we create a component in the Hamiltonian Cycle Problem: v u u u v v

Observations…. u u v v u u v v u u v v There are only three possible ways that a cycle can include all of the vertices in this component. Key property: If a path enters v (u), it leaves on v’ (u’)

u u u u Node Selection u v v w w u x x All components that represent edges connected to node u are strung together into a chain. If there are V vertices, then we will have V of these chains, all interwoven. Choosing a node u corresponds to traversing such a chain

u v v v u u u u w w u x x y y v v z z v vu yw xz Vertex cover = (v,u)

u v v v u u u u w w u x x y y v v z z v vu yw xz Vertex cover = (v,w,x)

Tying the Chains Together If we want to know if its possible to cover the original graph using only k vertices, this would be the same as seeing if we can include all of the vertices using only k chains. How can we include exactly k chains in the Hamiltonian Cycle problem? We must add k extra vertices and connect each of them to the beginning and end of every chain. Since each vertex can only be included once, this allows k chains in the final cycle.

Beginning a Transform

The Final Transform for k=1