

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!


ECS122A Handout June 2, 2009
How to prove a problem is NP-complete?
Example 1. The directed Hamilton cycle (HC) problem is known to be NP-complete. In the following, we show that the directed HC problem is reducible to the undirected Hamilton cycle problem. Therefore, we conclude that the undirected HC problem is also NP-complete.
Proof: Let G = (V, E) be a directed graph with n vertices. G is transformed into the undirected graph G′^ = (V ′, E′) by the transform function T defined as the following:
v ∈ V −→ v^1 , v^2 , v^3 ∈ V ′^ and (v^1 , v^2 ), (v^2 , v^3 ) ∈ E′.
and (u, v) ∈ E −→ (u^3 , v^1 ) ∈ E′.
Clearly, T is polynomial-time computable. We now show that G has a HC ⇐⇒ G′^ has a HC.
v^11 , v 12 , v^31 , v^12 , v^22 , v 23 ,... , v^1 n, v^2 n, v n^3 , v 11
is an undirected HC for G′.
v^1 i 1 , v^2 i 1 , v i^31 , v i^12 , v^2 i 2 , v i^32 ,... , v^1 in , v i^2 n , v^3 in , v i^11 , v^2 i 1 , v^3 i 1.
Then vi 1 , vi 2 ,... , vin , vi 1 is a directed Hamilton cycle for G. 2
Example 2: The subset sum problem is known to be NP-complete, In the following, we show that the subset sum problem is reducible to the job scheduling (with penalties) problem. Therefore, we conclude that the problem of job scheduling with penalties is also NP-complete.
Proof ∑ : Let s 1 , s 2 ,... , sn and C be an input for the subset sum problem (we may assume that n i=1 si^ ≥^ C). Let the input be transformed into the following input for the job scheduling problem
ti = pi = si for 1 ≤ i ≤ n, di = C for 1 ≤ i ≤ n,
k =
∑^ n i=
si − C.
Clearly the transformation takes polynomial time. Now we shows that Yes-instance of the subset sum ⇐⇒ Yes-instance of the job scheduling.
∑ i∈J si^ =^ C. Then let^ π^ be any permutation of^ N^ that causes all jobs with indices in J to be done before any job with indices in N − J. The first |J| jobs are completed by their deadline since ∑ i∈J ti^ =^
∑ i∈J si^ =^ C^ and^ C^ is the deadline for all jobs. Then the total penalty
Pπ =
∑^ |J|
j=
pπ(j) +
∑^ n
j=|J|+
pπ(j) = 0 +
∑^ n
j=|J|+
pπ(j) =
∑^ n
j=|J|+
sπ(j) =
∑^ n
j=
sj − C = k.
Thus the jobs can be done with total penalty ≤ k.
i=
tπ(i) ≤ C; (1)
i.e., m is the number of jobs completed by the deadline C. The penalty, then, is
∑^ n
i=m+
pπ(i) ≤ k =
∑^ n
i=
si − C. (2)
Since ti = pi = si for all 1 ≤ i ≤ n, we must have
∑^ m
i=
tπ(i) +
∑^ n
i=m+
pπ(i) =
∑^ m
i=
sπ(i) +
∑^ n
i=m+
sπ(i) =
∑^ n
i=
si,
and this can happen only if the inequalities in (1) and (2) are equalities. Thus
∑^ m i=
tπ(i) = C,
so the objects with indices π(1), π(2),... , π(m) are a solution to the subset sum problem. 2