第八章課後題答案

8.1. Optimization versus search. Recall the traveling salesman problem:
TSP
Input: A matrix of distances; a budget b
Output: 
A tour which passes through all the cities and has length ≤ b, if
such a tour exists
.
The optimization version of this problem asks directly for the shortest tour.
TSP-OPT
Input: A matrix of distances
Output: The shortest tour which passes through all the cities.
Show that if TSP can be solved in polynomial time, then so can TSP-OPT. 
證明:若 爲圖中所有邊的長度之和,顯然所求最短迴路的長度不會超過 。倘若 TSP
能在多項式時間內解決,那麼通過在區間[0, S]內二分的進行 TSP 詢問,從而也就
能在多項式時間內解決 
TSP-OPT 

8.2. Search versus decision. Suppose you have a procedure which runs in polynomial
time and tells you whether or not a graph has a Rudrata path. Show that you can
use it to develop a polynomial-time algorithm for R
UDRATA PATH (which returns
the actual path, if it exists).
 
證明:如果圖中存在哈密頓迴路(亦即是 Rudrata path),那麼對於圖中的每一條邊 
詢問
除去邊 後是否還存在哈密頓迴路。如果答案是“否”,說明 正好是迴路中
的一條邊。如果答案是“是”,則將 
中從圖中去掉。在上述過程完成之後,圖G
中剩餘的邊即是所求的迴路。顯然,若每次詢問都是多項式時間的,那麼整個過程
可以在多項式時間內完成。
 


8.3STINGY 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 的解是可在多項式時間內驗證的,因此屬於 NP。另外,
很容易可以將 
SAT 歸約到 STINGY SAT(將 設爲所有變量的總個數即可),於是可
知 
STINGY SAT 爲 NP 完全問題 

8.4Consider the CLIQUE problem restricted to graphs in which every vertex has
degree at most 3. Call this problem 
CLIQUE-3.
(a) Prove that 
CLIQUE-3 is in NP 
(b) What is wrong with the following proof of NP-completeness for CLIQUE-3?
We know that the 
CLIQUE problem in general graphs is NP-complete, so it
is enough to present a reduction from 
CLIQUE-3 to CLIQUE. Given a graph G
with vertices of degree ≤ 3, and a parameter g, the reduction leaves the
graph and the parameter unchanged: clearly the output of the reduction
is a possible input for the 
CLIQUE problem. Furthermore, the answer to
both problems is identical. This proves the correctness of the reduction
and, therefore, the 
NP-completeness of CLIQUE-3.
(c) It is true that the 
VERTEX COVER problem remains NP-complete even when
restricted to graphs in which every vertex has degree at most 3. Call this
problem 
VC-3. What is wrong with the following proof of
NP-completeness for CLIQUE-3?
We present a reduction from 
VC-3 to CLIQUE-3. Given a graph (VE)
with node degrees bounded by 3, and a parameter 
b, we create an
instance of 
CLIQUE-3 by leaving the graph unchanged and switching the
parameter to 
|V| - b. Now, a subset ⊆ is a vertex cover in if and
only if the complementary set 
is a clique in G. Therefore has a
vertex cover of size 
≤ if and only if it has a clique of size ≥ |V| - b.
This proves the correctness of the reduction and, consequently, the
NP-completeness of CLIQUE-3.
(d) Describe an 
O(|V|) algorithm for CLIQUE-3. 
證明:a) 顯然 CLIQUE-3 的解是可以多項式時間內驗證的,於是屬於 NP
b) 歸約的方向反了,應該是 CLIQUE→ CLIQUE-3,而不是 CLIQUE-3→ CLIQUE
c) 注意求出的團之後只能得到的頂點覆蓋,而非的頂點覆蓋。
d) 若圖中所有的頂點的度不大於 3,那麼可知在圖的最大團中不會超過 
頂點。於是,直接枚舉所有的頂點四元組即可求解,時間複雜度爲(|V|^4) 


8.7. Consider a special case of 3SAT in which all clauses have exactly three literals,
and each variable appears exactly three times. Show that this problem can be
solved in polynomial time. (
Hint: Create a bipartite graph with clauses on the
left, variables on the right, and edges whenever a variable appears in a clause.
Use Exercise 7.30 to show that this graph has a matching.)
 
證明:按提示構造二分圖。因爲每個子句( clause)恰好包含三個文字( literal),所以任
意 
個子句總共包含了3個文字(可能有重複)。又因每個變量最多對應三個文字,
所以這
3個文字至少對應了 個變量。於是在圖中,任意 個子句都與不少於 n
個變量相連,由 Hall 定理知圖存在完美匹配。找出一個完美匹配,假設子句 
變量 
配對,若 中包含了 的肯定,則將 設爲 true,若 包含了 的否定,則將 v
設爲 false,若 同時包含了 的肯定及否定,那麼 可以任意取值。分別爲每個配
對進行上述賦值過程,即可找到一組可滿足解。
 


8.8. 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 clause. The goal is to find a satisfying assignment, if one exists.
Prove that 
EXACT 4SAT is NP-complete. 
證明:首先很顯然, EXACT 4SAT 屬於 NP。現在通過將 3SAT 歸約到 EXACT 4SAT 來證
明後者的 
NP 完全性。對於任意一個 3SAT 實例,如果其中某個子句中包含了同一個
文字多次,那麼可以縮減爲一次,如果同時包含了某個變量的肯定及否定,那麼可
以將這個變量去掉。然後,可以再在每個子句中可以添加一些啞變量(即沒用的輔
助變量),這樣就可以將每個子句所包含的文字數目擴充到四個。至此,即已將該
3SAT 實例轉化成了一個 EXACT 4SAT 問題 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章