Presentation is loading. Please wait.

Presentation is loading. Please wait.

Course 9 NP Theory序論 An Introduction to the Theory of NP

Similar presentations


Presentation on theme: "Course 9 NP Theory序論 An Introduction to the Theory of NP"— Presentation transcript:

1 Course 9 NP Theory序論 An Introduction to the Theory of NP

2 ▓ Outlines 本章重點 Intractability Input Size General Problem Categories
The Theory of NP

3 ▓ Intractability (難解問題)
什麼是 “多項式時間 (Polynomial Time)”? Definition: A polynomial-time algorithm is one whose worst-case time complexity is bounded above by a polynomial function of its input size. That is, if n is the input size, there exists a polynomial p (n) such that Polynomial Time Exponential Time

4 In computer science, a problem is called intractable if it is impossible to solve it with a polynomial-time algorithm. For a problem to be intractable, there must be no polynomial-time algorithm that solves it. 如果一個問題,目前還找不到一個Polynomial-Time Algorithm解它,但是也無法保証未來就找不到Polynomial-Time Algorithm來解這個問題,則無法証明該問題是Intractable. For example: The brute-force algorithm (暴力演算法) for the Chained Matrix Multiplication problem is non-polynomial time. However, the dynamic programming algorithm (Algorithm 3.6) developed in that section is Θ(n3).

5 Polynomial-time computable
一函數 f(x) 為polynomial-time computable若且為若存在一演算法,使得對所有的x,皆可在Polynomial Time內求得 f。 There are three general categories of problems as far as intractability is concerned: Problems for which polynomial-time algorithms have been found Problems that have been proven to be intractable Problems that have not been proven to be intractable, but for which polynomial-time algorithms have never been found It is a surprising phenomenon that most problems in computer science seem to fall into either the first or third category.

6 ▓ The Theory of NP 所謂 “NP” 是指Non-deterministic與Polynomial兩個單字的簡寫。
Deterministic v.s. Non-deterministic Deterministic Algorithm (決定性演算法) Definition: Permitting at most one next move at any step in a computation. 是指演算法中每一個步驟的運算都需要被唯一定義,因此產生的結果也是唯一的。 執行決定性演算法的機器,稱為決定性的機器 (Deterministic Machine)。電腦就是一種決定性的機器。 Non-deterministic Algorithm (非決定性演算法) Definition: Permitting more than one choice of next move at some step in a computation. 是指演算法中允許一些步驟可能有變動的執行選擇,因此該步驟的運算結果不是唯一的,但是需要限制在一組可能的結果之中。 執行非決定性演算法的機器,稱為非決定性的機器 (Non-deterministic Machine)。實際上並不存在此種機器。

7 在所有的問題當中,除了過去所討論過的各種最佳化問題 (Optimization Problem) 以外,尚有另外一種型態的問題: 決策問題 (Decision Problem)
Decision Problem: 此類問題輸出的答案非常簡單,就是 “yes” 或 “no” 兩者之一。

8 The partition problem (分割問題):
給予一組正整數的集合S={a1, a2, … , an},問: 是否可以將其分割成兩個子集合S1與S2,而此兩個子集合的個別總和相等。 Ex: Let S = {13, 2, 17, 20, 8}. The answer to this problem instance is "yes" because we can partition S into S1 = {13, 17} and S2 = {2, 20, 8}. The Sum of Subset Problem (部份集合的和問題): 給予一組正整數的集合S={a1, a2, … , an}及一個常數c,問: 集合S中是否存在一組子集合S’,此子集合S’的數字總合為c。 Ex: Let S = {12, 9, 33, 42, 7, 10, 5} and c = 24. The answer of this problem instance is "yes" as there exists S’ = {9, 10, 5} and the sum of the elements in S’ is equal to 24. If c is 6, the answer will be "no".

9 The Satisfiability Problem (滿足問題):
給一個布林函數X,我們對存在於此函數X中的一些變數分別指派True或False,使這個函數為True。 Ex: Let X = (-x1  x2 - x3)(x1  -x2 ) (x2  x3). Then the following assignment will make X true and the answer will be “yes”. x1 F, x2 F, x3 T If X is -x1  x1 , there will be no assignment which can make X true and the answer will be “no”. The Minimal Spanning Tree Problem (最小擴張樹問題): Given a graph G, find a spanning tree T of G with the minimum length.

10 The Traveling Salesperson Problem (旅行推銷員問題):
給予一個圖G = (V,E) ,找出一個由該圖的某一點出發所構成的cycle,此cycle會經過該圖中的每個點一次而再回到出發點,同時其總長度為最短 Ex: Consider following graph. There are two cycles satisfying our condition. They are C1 = abedcfa and C2 = acbe dfa. C1 is shorter and is the solution of this problem instance.

11 (Optimization Problems)
Some problems: The Partition Problem The Sum of Subset Problem The Satisfiability Problem The Minimal Spanning Tree Problem The Traveling Salesperson Problem In general, optimization problems are more difficult that decision problems. (Decision Problems) (Optimization Problems)

12 For example (MST Problem):
An optimization problem always has a decision problem corresponding to it. For example (MST Problem): Given a graph G and a constant c. The total length of the spanning tree of the graph G is a: If a < c, then the answer is “yes”, otherwise, its answer is “no”. The decision version of this minimal spanning tree problem is called the minimal spanning tree decision problem. If the decision version of the optimization problem is difficult already, the optimization version must be difficult.

13 Polynomial-Time Reducible (多項式時間的轉化性)
Def: 如果一個問題L1可多項式時間轉化成問題L2,則存在一函數f為polynomial-time computable,使得對所有x而言,xL1  f(x)L2。 可表示成 L1  L2 若L1可以reduce到L2,則隱含著L1較L2容易的意義。

14 P: 是一群Decision Problem的集合,在此集合之問題皆可利用Deterministic Algorithm於Worst Case的情況下,在Polynomial Time的複雜度內被解決。 NP: 這類的問題只要給個解答,可以在Polynomial Time的複雜度內很快地驗證 (Verify) 出這個解答是否正確。 因此P可視為NP的一個特例 NP-hard: 是一群Decision Problem的集合。當 L2  NP-hard 若且唯若所有屬於NP的Decision Problem L1 (L1NP) 皆可多項式時間轉化成L2 (L1L2)

15 一般而言,理論學家相信上述問題之集合圖示如下:
NP-complete: 是一群Decision Problem的集合。 若某一個問題Q屬於NP-complete,則滿足以下兩個條件: Q屬於NP Q屬於NP-hard 一般而言,理論學家相信上述問題之集合圖示如下: NP NP-hard NP- complete P

16 Nearly all of the decision problems are NP problems.
In NP problems, there are some problems which have polynomial algorithms. They are called P problems. Every P problem must be an NP problem. There are a large set of problems which, up to now, have no polynomial algorithms.

17 no polynomial algorithms
NP-complete problem constitute a subset of NP problems. NP-complete problems P problems no polynomial algorithms NP problems

18 Some important properties of NP-complete problems:
Up to now, no NP-complete problem has any worst case polynomial algorithm. If any NP-complete problem can be solved in polynomial time, NP = P. There are thousands of problems proved to be NP-complete problems. If the decision version of an optimization problem is NP-complete, this optimization problem is called NP-hard. We can conclude that all NP-complete and NP-hard problems must be difficult problems because They do not have polynomial algorithms at present. It is quite unlikely that they can have polynomial algorithms in the future.


Download ppt "Course 9 NP Theory序論 An Introduction to the Theory of NP"

Similar presentations


Ads by Google