NP-Complete Problem Exercises

来源:互联网 发布:淘宝店招在线设计 编辑:程序博客网 时间:2024/05/29 11:39

8.3 STINGY SAT

STINGY SAT is the following problem: given a set of clauses(each a disjunction of literals) and an integer k, find a satisfying assignment in which at most k variables are true, if such an assignment exists. Prove that STINGY SAT is NP-complete.

题解:给出STINGY SAT问题的设定:有一组子句,每个子句都是其中文字的析取,再给出一个整数k,求证是否存在一个最多k变量为真的赋值满足这个子句(合取范式的公式),如果存在求出这个赋值。证明这个问题是NP-complete的。
证明: 易知STINGY SAT的任意一个解S的正确性都能在多项式时间被快速的检验,所以它是一个NP problem;又假设k等于变量的总数,则此时SAT 问题可以归约到STINGY SAT问题;又因为SAT是NP-complete的,因此STINGY SAT也是NP-complete的。

8.8 EXACT 4SAT

In the EXACT 4SAT problem, the input is a set of clauses, each of which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clauses. The goal is to find a satisfying assignment, if one exits. Prove that EXACT 4SAT is NP-complete.

题解: EXACT 4SAT问题的输入是一组子句(每个子句都是4个文字的析取),且每个变量最多在每个子句中出现一次。证明是否存在满足的赋值,若存在则求出这组赋值。题目要求证明这个问题NP-complete。
证明:尝试将《算法概论》中已证明为NP-complete的3SAT问题归约到EXACT 4SAT问题。
描述一下3SAT问题:输入是一个子句集,每个子句包含不超过3个的文字,目标是求它的一个可满足赋值。对于任意一个3SAT实例,如果其中某个文字多次出现,可以保留其一,省略剩余的;如果某个文字及它的否定同时出现,则直接将这个文字及它的否定省略。接下来需要补齐至4个变量,在每个子句中添加一些对问题没有影响的辅助变量(设定为1的虚拟变量)使得每个子句恰好4个变量。至此,3SAT实例已被转化为一个EXACT 4SAT实例;即3SAT问题可以归约到EXACT 4SAT问题。因此EXACT 4SAT问题也NP-complete。

8.12 K-Spanning Tree

The k-spanning tree problem is the following:
Input: An undirected graph G = (V, E);
Output: An spanning tree of G in which each node has degree ≤ k, if such a tree exists.
Show that for any k ≥ 2:
(a)k-spanning tree is a search problem.
(b)K-spanning tree is NP-complete.(Hints: Start with k = 2 and consider the relation between this problem and Rudrata Path.)

题解:
(a)K-spanning Tree的任意一个解S的正确性都能在多项式时间内被验证,因此这是一个搜索问题。
(b)当k = 2时,这棵K-Spanning tree就是一条Rudrata路径(即指定两个特殊顶点s和t,由s到t的恰好经过每个顶点一次的路径),即Rudrata路径问题可以归约到K-Spanning tree问题,且Rudrata路径问题是NP-complete问题,因此K-spanning Tree也NP-complete。