NP and Computational Intractability
Last updated
Last updated
NP-complete problems is a set of problems that a polynomial-time algorithm for any one of them would imply the existence of a polynomial-time algorithm for all of them.
To express the notation that a particular problem X is at least at hard as some other problem Y, we assume that there's a "black box" capable of solving X in a single step.
If an instance of problem Y could be solved using a polynomial number of standard computational steps and a polynomial number of calls to the black box that solves X, Y is polynomial-time reducible to X. ()
If and X could be solved in polynomial time, then Y could be solved in polynomial time.
If and Y couldn't be solved in polynomial time, then X couldn't be solved in polynomial time.
In a graph , a set of nodes is independent if no two nodes in are joined by an edge. The problem is to determine if G contains an independent set of size at least , given a number .
In a graph , a set of nodes is a vertex cover if every edge has at least one end in . The problem is to determine if G contains a vertex cover of size at most , given a number .
In a graph , is an independent set if and only if its complement is a vertex cover.
The SAT problem is to determine if a satisfying truth assignment exists for a set of clauses over a set of variables.
The 3-SAT problem if a satisfying truth assignment exists for a set of clauses, each of length 3, over a set of variables.
The definition of a circuit is a labeled, directed acyclic graph.
The inputs (nodes without incoming edges) are labeled either 0 or 1.
Every other node is labeled with one of the boolean operators AND, OR, or NOT. Nodes labeled with AND or OR will have two incoming edges, and nodes labeled with NOT will have one incoming edge.
There's an output node without outgoing edges, which is the output computed by the circuit.
The circuit satisfiability problem is to determine whether there's an assignment of values to the inputs that cause the output to be 1, given a circuit as input.
Any algorithm that takes a fixed number of bits as input and produces a yes/no answer could be represented by a circuit. (1 -> yes, 0 -> no) If the algorithm takes several polynomial steps, then the circuit has a polynomial size. Algorithms implemented on physical computers could be reduced to the boolean logic gates.
3-coloring is NP-complete. The problem is NP because the solution could be verified efficiently by checking the number of colors and if there's a pair of nodes that receive the same color.
To prove the NP-completeness, we could determine if 3-SAT could be solved using a black box for 3-coloring.
The circuit satisfiability problem could be reduced to an equivalent instance of 3-SAT problem, thus 3-SAT, Independent set, Set packing, Vertex cover, and Set cover are NP-complete.
Independent set vertex cover. If there's a black box to solve vertex cover, the independent set problem of size at least is equivalent to the vertex problem of size at most .
Vertex cover independent set. If there's a black box to solve the independent set, the vertex cover problem of size at most is equivalent to the independent set of size at least .
Given a set of elements, a collection of subsets of , and a number , the problem is to determine if there exists a collection of at most of these sets whose union is equal to all of .
Given a set of elements, a collection of subsets of , and a number , the problem is to determine if there exists a collection of at least of these sets with the property that no two of them intersect.
Vertex cover Set cover: Let the edges be the elements of , and the sets be the edges that incident to the vertex . The vertex cover problem is then converted to the set cover problem.
Independent set Set Packing: Let the edges be the elements of , and the set be the edges that incident to the vertex . The independent set problem is then converted to the set packing problem.
Let be a set of boolean variables , each can take the value 0 or 1. A clause is simply a disjunction of distinct terms . ()
A truth assignment assigns 0 or 1 to each . An assignment satisfies a clause if . An assignmeent satisfies a collection of clauses if .
The 3-SAT problem could be interpreted as choosing one term from each clause without any conflict, then find a truth assignment that causes all of them to evaluate to 1, which satisfies all clauses. Two terms conflict if one is equal to a variable and the other is equal to its negation .
Let be a graph with nodes grouped into triangles where each represents a clause. If two terms belong to the same clause (triangle) or conflict, there's an edge that connects them. An independent set with size in is the set of terms without conflict, which is the solution to the 3-SAT problem. Therefore, 3-SAT Independent set.
If , then .
Therefore, 3-SAT Independent set \leq{p} Vertex cover \leq{p} Set cover.
Let be the string of input to a problem, which has the length . An algorithm for a decision problem receives an input and returns the value "yes" or "no", and the returned value is denoted by .
Let be a polynomial function for the input , has a polynomial running time if terminates in at most steps. is the set of all problems that an algorithm with a polynomial running time that solves exists.
To check a solution, let be a certificate string that contians the evidence that is a "yes" instance of a problem .
is an efficient certifier for a problem if:
is a polynomial-time algorithm that takes two input arguments and .
There's a polynomial function that for every string , if there's a string that , and .
3-SAT: the certificate is an assignment of truth values to the variables; the certifier evaluates the given set of clauses with respect to this assignment.
Independent set: the certificate is the identity of a set of at least vertices; the certifier checks that, for these vertices, no edge joins any pair of them.
Set cover: the certificate is a list of sets from the given collection; the certifier checks that the union of these sets is equal to the underlying set .
is the set of all problems that an algorithm with a polynomial running time that solves exists.
is the set of all problems for which there exists an efficient certifier, which indicates that the solution to the problems could be efficiently verified.
. Let , ignore , and then use to directly solve the problem in polynomial time.
The question of whether , or whether every problem whose solution can be quickly verified can also be solved quickly, is one of the most famous unsolved problems in computer science.
If is an NP-complete problem, then and for all . If is solvable in polynomial time, then .
To proof that circuit satisfiability, we know that has an efficient certifier . To determine whether an input (with length ) , we need to determine whether a of length exists so that .
The question could be answered with the black box for circuit satisfiability. Suppose there's a circuit with inputs, and the first inputs are hard-coded with the value of . The remaining inputs will be labeled with variables representing . If there's a way to set the input so that the circuit produces an output of 1, then the () exists, and . Therefore, .
If is an NP-complete problem, and is a problem in NP with the property that , then is NP-complete.
For a new problem :
Prove that .
Choose a problem that is known to be NP-complete.
Consider an arbitrary instance of problem , and show how to construct an instance of problem that satisfies the following properties:
If is a yes instance of , then is a yes instance of .
If is a yes instance of , then is a yes instance of .
Let be an undirected graph in which nodes are the regions to be colored and edges are the pairs that are neighbors. The problem is to assign a color to each node of . If is an edge, and are assigned different colors. The goal is to minimize the number of colors. If has a k-coloring, then it's a k-colorable graph. The algorithmic version of the problem is that given a graph and a bound , does have a k-coloring?
The graph is 2-colorable if and only if it is bipartite. It could be solved efficiently with breadth-first search.
Let be a graph with three special nodes , , and , which are joined into a triangle.
To begin, join each pair of nodes with an edge, and join both these nodes to .
In any 3-coloring of , the nodes and must get different colors, and must be different from .
In any 3-coloring of , the nodes , and must get all tree colors in some permutation. Therefore, one of and gets the color, and the other gets the color.
For each clause in the 3-SAT instance, attach a six-node subgraph to the nodes in the clause so that at least one of them must have color. Therefore, the 3-SAT instance is satisfiable if and only if has 3-coloring.
k-coloring for is NP-complete. Take an instance of 3-coloring, add ne wnodes, and join them to each other and to every node in G. The resulting graph is k-colorable if and only if the original graph is 3-colorable.