NP and Computational Intractability
Definition
- If Problem X is at least as hard as Problem Y, it means that if we could solve X, we could also solve Y.
-
- Y is polynomial-time reducible to X
- Y can be solved using a polynomial number of computational steps plus a polynomial number of calls to a blackbox that solves X
- X is at least as hard as Y
Some NP Problems
Independent Set
Given a graph , we say a set of nodes is independent if no two nodes in S are joined by an edge.
Optimization Version: find the maximum size of an independent set.
Decision Version: whether G has an independent set of size at least a given k.
Vertex Cover
Given a graph , we say that a set of nodes is a vertex cover if every edge in E has at least one end in S.
Let , then is a independent set if and only if its complement is a vertex cover set.
Independent Set Vertex Cover.
Vertex Cover Independent Set.
Vertex Cover Problem and Independent Set Problem are in the same complexity class.
Let be a graph. Then S is an independent set if and only if its complement V − S is a vertex cover.
Set Cover
Given a set of elements, a collection , . . . , of subsets of , and a number , does there exist a collection of at most of these sets whose union is equal to all of ?
Vertex Cover Set Cover
Satisfiability Problem (SAT)
Given a set of n Boolean variables
A clause is simply a disjunction of distince terms .
We say the clause has length if it contains terms
A truth assignment for is an assignment of the value 0 or 1 to each ; in other words, it is a function
An assignment satisfies a clause if it causes to evaluate to 1 under the rules of Boolean logic.
An assignment satisfies a collection of clauses if it causes all of the to evaluate to 1. In this case, we will say that is a satisfying assignment with respect to ; and that the set of clauses is satisfiable.
Problem Statement
Given a set of clauses over a set of variables ,
does there exist a satisfying truth assignment?
3-SAT: all clauses contain exactly three terms
efficient certification:
to show efficient certification:
- Polynomial length certificate
- Polynomial time certifier the certifier is basically an algorithm that takes the certificate and decides whether or not it is a good solution.
NP(Non deterministic polynomial) is the set of all problems for which there exists an efficient certifier.
The Hamiltonian Cycle Problem
Given a directed graph , we say that a cycle in G is Hamiltonian Cycle if it visits each vertex exactly once.
The Hamiltonian Cycle Problem is then simply the following:
Given a directed graph G, does it contain a Hamiltonian cycle?
Show Hamiltonian Cycle Problem is NP-Complete:
Prove Vertex Cover is polynomial reducible to Hamiltonian Cycle Problem
The Traveling Salesman Problem
Order the cities into a tour , with , so as to minimize the total distance
Decision version of the Traveling Salesman Problem:
Given a set of distances on n cities, and a bound D, is there a tour of length at most D?
TSP is polynomial reducible to Hamiltonian Cycle Problem
Prove a problem is NP-Complete
- Prove X belongs to NP
- Choose a problem Y that is known to be NP-Complete
- Prove that YX