



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




The larger independent set problem is, given a graph G and an independent set I in G, is there an independent set of G larger than I? This problem is in N P , since an independent set larger than I would have size at most n, and could be verified in polynomial-time. To show that it is N P -complete, we reduce from the Big Independent Set problem: Given G, k , is there an independent set I of size k in G? Given G = (V, E) and k, we let V ′^ be V together with k − 1 new nodes, w 1 , ..wk− 1. We let E′^ be E together with v, wj for each v ∈ V and 1 ≤ j ≤ k −1. We let I be the set {w 1 , ..wk− 1 }. The output of the reduction is G′^ = (V ′, E′), I. We need to show that there is an independent set larger than I in G′^ if and only if there is an independent set of size k in G. Assume I′^ is an independent set larger than I in G. Since |I| = k − 1, |I′| ≥ k. Thus, at least one v ∈ V is in I′, since there are only k − 1 nodes not in V in V ′. Since there is an edge from v to each wj in E′^ and I′^ is an independent set in G′, no wj is in I′. Thus, I′^ ⊂ V. Since all edges from G are also in G′, I′^ is an independent set in G of size at least k. Taking any k nodes of I′^ gives an independent set of size exactly k. Conversely, assume G has an independent set of size k, I′. Then I′^ is also an independent set in G′, since we added no edges between nodes in V. Since it is of size k, and I′^ is of size k − 1, |I′| > |I|, and there is a bigger independent set in G′^ than I. Thus, the reduced instance is a member of BiggerIndependentSet if and only if the original instance is a member of BigIndependentSet. Thus, the reduction is correct, and BiggerIndependentSet is N P -complete.
rove that the following problem is N P -complete:
Problem: Machine budget
Instance: A bipartite graph G = (M, J, E), where the nodes in M represent types of machines, the nodes in J represent types of jobs, and the edges
represent that the machine is capable of performing the job. For each machine m, an integer price pm > 0. A positive integer B representing the total budget.
Solution space: A subset S ⊂ M of machines to purchase.
Constraints: For each j ∈ J, there must me some m ∈ S that can perform job j, i.e., so that (m, j) ∈ E. The total price
m∈S pm^ of purchased machines must be at most B.
We reduce from Vertex Cover. Given a graph G = (V, E) and integer 1 ≤ k ≤ n, construct a bipartite graph whose left side M = V and right side J = E. We put an edge betwen v ∈ V and e ∈ E if v is an endpoint of e. We set the price for each machine v to 1, and set the budget to k. If the resulting instance of lowest cost machines has a solution of cost less than v, that solution specifies a set of machines S which is also a set of vertices of the original graph. Since each e ∈ J has a machine in S that can perform it, and e can only be performed by its endpoints, each e ∈ E has at least one endpoint in S, so S is a vertex cover. Since the total price is equal to the number of machines and is less than k, |S| ≤ k. So there is a vertex cover of size at most k. If there is a vertex cover S of size at most k, the solution that purchases the machines in S can perform each machine e by the endpoint of e in S. Since |S| =
v∈S pv^ ≤^ k, we can afford this set of machines. Thus, there is a set of machines that fits our budget and can perform every job if and only if there is a vertex cover of the graph of size at most k. Thus, we’ve given a reduction from the known N P -complete problem of vertex cover to the Lowest Cost Machines problem. So LCM is N P -hard. To see that it is in N P , verifying that a set of machines fits the budget involves checking that each job can be performed by some machine in the set and totalling the costs and comparing to the budget, all of which is polynomial time in the input size. Therefore, LCM is N P -complete.
We can represent a solution by giving a color for every variable, and since colors are between 1 and k ≤ n, this will take at most n log k ≤ n log m bits. Then to verify a solution, we simply run through all sets Si and verify that each color occurs once. Thus, abstract sudoku is in N P. To show that it is N P -complete, we reduce from the known N P -complete problem, 3-colorability. Given a graph G = (V, E), we create an abstract sudoku instance with variables xv for v ∈ V and xe for e ∈ E. We set k = 3. For each edge e = {u, v}, we add the set Se = {xu, xv , xe}. We need to show that the constructed abstract sudoku problem is satisfiable if and only if G is 3-colorable. Assume the sudoku problem is satisfiable by colors av v ∈ V and ae, e ∈ E. Then let χ color each node u the value au
There are some obvious ways of performing the reduction. In these ways, the variables are xi,j,k representing “M [i][j] = k”. Let B(a,b) be the (a, b)’th block, the set of positions (i, j) with (a − 1)n + 1 ≤ i ≤ an and (b − 1)n + 1 ≤ j ≤ bn. We can define the following sets of clauses: V≤ 1 : (at most one value) For each (i, j), there is at most one k with M [i][j] = k: for each 1 ≤ i ≤ n^2 , 1 ≤ j ≤ n^2 , 1 ≤ k < k′^ ≤ n^2 , ¬xi,j,k ∨ ¬xi,j,k′^. (O(n^6 ) clauses of size 2.) V≥ 1 : (at least one value) For each (i, j), there is at least one such k with M [i][j] = k: for each 1 ≤ i ≤ n^2 , 1 ≤ j ≤ n^2 , ∨ 1 ≤k≤n 2 xi,j,k. (O(n^4 ) clauses of size n^2 ) R≤ 1 : (at most one k in each row) For each row, k appears at most once: for each 1 ≤ i ≤ n^2 , 1 ≤ k ≤ n^2 , 1 ≤ j < j′^ ≤ n^2 , ¬xi,j,k ∨ ¬xi,j′,k. (O(n^8 ) clauses of size 2.) R≥ 1 : (at least one k in each row) For each row there is at least one k: with M [i][j] = k: for each 1 ≤ i ≤ n^2 , 1 ≤ k ≤ n^2 , ∨ 1 ≤j≤n 2 xi,j,k. (O(n^4 ) clauses of size n^2 ) C≤ 1 For each column, k appears at most once: for each 1 ≤ j ≤ n^2 , 1 ≤ k ≤ n^2 , 1 ≤ i < i′^ ≤ n^2 , ¬xi,j,k ∨ ¬xi′,j,k. (O(n^8 ) clauses of size 2.) C≥ 1 : (at least one k in each column) For each 1 ≤ j ≤ n^2 , 1 ≤ k ≤ n^2 , ∨ 1 ≤i≤n 2 xi,j,k. (O(n^4 ) clauses of size n^2 ) B≤ 1 For each block, k appears at most once: for each 1 ≤ a ≤ n, 1 ≤ b ≤ n, 1 ≤ k ≤ n^2 , (i, j) ∈ Ba,b, (i′, j′) ∈ Ba,b, (i, j) 6 = (i′, j′), ¬xi,j,k ∨ ¬xi′,j,k. (O(n^8 ) clauses of size 2.) B≥ 1 : (at least one k in each block) For each 1 ≤ a ≤ n, 1 ≤ b ≤ n, 1 ≤ k ≤ n^2 , ∨(a−1)n+1≤i≤an,(b−1)n+1≤j≤bnxi,j,k. (O(n^4 ) clauses of size n^2 ) Many combinations of these constraints are valid reductions. (Together with xi,j,k whenever we are given that M [i, j] = k]). For example, V≥ 1 , R≤ 1 , B≤ 1 , C≤ 1. People were conjecturing different kinds of tradeoffs between more clauses versus smaller clause size. But actually, for complete methods (algorithms that explore all possibilities), it is usally better to have as many constraints as possible. My guess is it would be better to just include all constraints above than to select subsets for these methods. Other heuristic search methods such as WalkSAT might get confused by a large number of “less important” constraints. However, all of these methods have O(n^6 ) variables, which may make them prohibitively large. But here’s another method that uses O(n^5 ) variables instead. Consider variables Yi,b,k and Za,j,k for 1 ≤ i ≤ n^2 , 1 ≤ a, b ≤ n, 1 ≤ k ≤ n^2 that express: there is a k in row i in a column between n(b − 1) + 1 and nb (i.e., in the intersection of row i and block Bidivn,b ) and likewise for columns. These variables also determine the solution by M [i][j] = k if and only if Yi,jdivn,k and Zidivn,j,k. Plus, the above constraints can be “factored” into these new variables:
For example: R≤ 1 : (at most one k in each row) For each 1 ≤ i ≤ n^2 , 1 ≤ k ≤ n^2 , 1 ≤ b < b′^ ≤ n, ¬Yi,b,k ∨ ¬Yi,b′,k. (O(n^6 ) clauses of size 2.) R≥ 1 : (at least one k in each row) For each row there is at least one k: with M [i][j] = k: for each 1 ≤ i ≤ n^2 , 1 ≤ k ≤ n^2 , ∨ 1 ≤b≤nYi,b,k. (O(n^4 ) clauses of size n) This both reduces the number of variables from n^6 to 2n^5 and the maximum clause width from n^2 to n. (We’ll also have some clauses of size 4 saying that there can’t be two values in the same square, ¬Yi,b,k ∨¬Yi,b,k′ ∨¬Za,j,k ∨¬Za,j,k′ for 1 ≤ i ≤ n^2 , 1 ≤ j ≤ n^2 , a = idivn, b = jdivn, 1 ≤ k < k′^ ≤ n^2 .) My feeling is that this would be a dramatic improvement over the reductions above, but no experiments have been made.