0% found this document useful (0 votes)
20 views4 pages

34-Class-New v3

The document discusses NP-Completeness, detailing the characteristics of problems in NP, P, and NP-Hard categories, along with their relationships and implications. It covers decision problems, polynomial and exponential time complexities, and various NP-Complete problems such as SAT, 3SAT, and the traveling-salesperson problem. Additionally, it introduces concepts like Branch-and-Bound, Approximation Algorithms, and Heuristic Algorithms, along with exercises to assess understanding of these concepts.

Uploaded by

Kevin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

34-Class-New v3

The document discusses NP-Completeness, detailing the characteristics of problems in NP, P, and NP-Hard categories, along with their relationships and implications. It covers decision problems, polynomial and exponential time complexities, and various NP-Complete problems such as SAT, 3SAT, and the traveling-salesperson problem. Additionally, it introduces concepts like Branch-and-Bound, Approximation Algorithms, and Heuristic Algorithms, along with exercises to assess understanding of these concepts.

Uploaded by

Kevin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

-------------------------------- 34 ------------------------------ "δ(s, v) < 45 ?" "|f*| > 36 ?

" 34-2
NP-Completeness 34-1x
Decision problem: return Yes/No!
(Branch-and-bound) Reduction: transform a problem into another. 34-2a

Polynomial time: O(nk) for some constant k, n is * Selection Sorting


the problem size. polynomial easy, can solve it * Decision version Optimization version
* if A B, then usually B is harder (B ≥hard A) 34-2de

* if A p B and B p C, then A p C 34-2x


Exponential time: O(2n), O( 3n 3 ), ... reduction (hardness) is transitive 34-2fg
non-polynomial hard, cannot solve it
NP-Complete: a problem A is in NP-C iff (i) A is in
(verification algo.) NP, and (ii) all problems in NP can be reduced
non-deterministic algorithm: an algorithm which to it in O(nk) time. 34-2h
1. guesses an answer, and then 34-1a
* all NP-C problems are of the same difficulty
2. verifies the answer. non-deterministic sort ? 34-1x * all NP p A ≅ an NP-C p A ≅ all NP-C p A
polynomial (deterministic) 計算 * If any problem in NP-C can be solved in O(nk)
P: the set of problems that can be solved in O(nk) time, then P=NP. It is believed (not proved) that
time (using a deterministic algorithm). P≠NP.
NP (P) NP
* if NP = P if NP ≠ P
P NPC
NP: the set of problems that can be solved in O(nk) NPC
time using a non-deterministic algorithm.
(Or, problems whose answers can be verified NP-Hard: a problem A is in NP-H iff
in O(nk) time.) 驗算 34-1y (1) A is at least as hard as problems in NP-C.
polynomial *會計算就一定會驗算 34-1b
or (2) all problems in NP can be reduced to A in
non-deterministic NP O(nk) time. all NP p A
P or (3) a problem in NP-C can be reduced to A in
NP-C
34-1z
O(nk) time. an (all) NP-C p A
e2
e3 e1
34-3 e4 v 34-4
* The longest "simple "path problem
NP
NP-Hard P * The vertex-cover problem

NP-C * The independent set problem


NP-C
min # of colors
NP-H * The graph coloring problem
34-3ab

34-3x * 2SAT ∈ P. (2CNF ∈ P)


0: false 34-4a 34-4x 34-4b
NP-Complete problems:
1: true
Cook Thm. (Turing award)
* (Circuit) satisfiability problem (SAT): Brute-force (search): Try all possible answers.
((a → b) ∨ ¬((¬a ↔ c) ∨ d)) ∧ ¬b
2n assignments (Clearly, SAT ∈NP) 1 c 1 d
* 3-CNF satisfiability problem (3SAT): a 18 2 2 : Find a shortest path
(a ∨ b ∨ c) ∧ (a ∨ ¬d ∨ e) ∧ (b ∨ f ∨ a) 3 from a to e.
(conjunctive normal form) b e
2 a * DFS or BFS
* The subset-sum (partition) problem: partition a 3
set of (real) numbers into two subsets of the b c1 34-4z
19 2
same sum. 5 d 21 c e b d
visit each vertex exactly once ! 5
e 22 d 21d e b4 e
* The hamiltonian-cycle problem
7 21 4
e e e 6
* The traveling-salesperson problem (TSP) 24 23 optimal
(all simple paths)
* The clique problem
completely connected subgraph
34-5 34-6
Branch-and-Bound search: Brute-force + Exercises 34-6x
34-5x
Intelligent cuts to impossible answers.
a Question 1: Determine whether the following
*Assume DFS is used.
3
b c1 statements are correct of not.
5 d 21 c 19 2 (1) If a problem is NP-Complete, then it can not be
e b d
solved by any polynomial time algorithm in
5 N
e 22 d 21d e b4 e worst cases.
7 21 4 (2) If a problem is NP-Complete, then we have not
e e e 6
24 23 optimal found any polynomial time algorithm to solve it
Y in worse cases.
cut by bound 7 cut by bound 5
(3) If a problem is NP-Complete, then it is unlikely
that a polynomial time algorithm can be found
Approximation Algorithm: Let A* be the optimal Y
in the future to solve it in worst cases.
solution of an input. An approximation algorithm
(4) If a problem is NP-Complete, then it is unlikely
will produce a solution A such that
that we can find a polynomial time algorithm to
|A*-A|/A* ≤ ε, e.g. ε(n) = 0.5 -> error within 50% N
solve it in average cases.
where ε is called the relative error bound.
(5) If we can prove that the lower bound of an
啟發式的 (自以為是, 一相情願, 不負責任) NP-Complete problem is exponential, then we
Heuristic Algorithm: may produce a good Y
solution but no guarantee on the error bound. have proved that NP≠P.

34-5a
Pseudo-Polynomial: polynomial in the numeric Question 2: Determine whether the following
value of an integer; while exponential in the length statements are correct of not.
(# of bits) of the integer) (1) The NP problems consist of only decision
N problems.
Homework: None. 34-5b
34-7 34-8
(2) If we prove that problem A can polynomial-time (b) Any NP-Complete problem can be solved by a
reduce to satisfiability problem, then problem A N polynomial time deterministic algorithm in
N is NP-complete. average if and only if NP=P is proved.
(3) If a problem A is polynomial time reducible to (c) The clause-monotone satisfiability problem is
problem B and B has a polynomial time Y NP-Complete, where a formula is called
Y algorithm, then problem A has a polynomial monotone if each clause of the formula
time algorithm. contains either only positive variables or only
(4) If an NP-complete problem can be solved in negative variables.
polynomial time, then NP ≠ P.
N By yourself, using 34-def.
(5) The problem of determining whether an integer Question 4: Suppose problem P1 can be reduced
number is a prime number is an NP-complete to another problem P2 in O(n2) time, where n is
N * Big CS News in 2002
problem. the input size. Answer the following questions
* O(n) is Pseudo-Polynomial
(6) The hamiltonian-path problem can be solved in and justify your answer briefly.
y polynomial time on directed acyclic graphs Y (a) If P1 is NP-hard, is P2 NP-hard?
(7) 3-CNF (the satisfiability problem, in which
N (b) If P2 is NP-hard, is P1 NP-hard?
N? each clause has exactly three literals) is
reducible to 2-CNF problem. poly. reduction??? N (c) Suppose P1 can be solved in O(f(n)) time. Is it
possible to derive a time lower-bound or a time
* SAT ->p 3CNF ???
upper-bound for P2? If it is possible, what is
Question 3: Determine whether the following the time bound?
statements are correct of not, and justify your
answer.
(a) Any NP-hard problem can be solved in
polynomial time if there is an algorithm that can
N solve the satisfiability problem in polynomial
time.

You might also like