Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5 NP Class.

Similar presentations


Presentation on theme: "Lecture 5 NP Class."— Presentation transcript:

1 Lecture 5 NP Class

2 P = ? NP = ? PSPACE They are central problems in computational complexity.

3 If P = NP, then NP-complete P

4 Ladner Theorem If NP ≠ P, then there exists a set A lying -between P and NP-complete class, i.e., A is in NP, but not in P and not being NP-compete.

5 Is it true that a problem belongs to NP iff its solution can be polynomial-time verified ? Answer: No!

6 Integer Programming

7 Decision version of Integer Programming

8

9 How to prove a decision problem belonging to NP?
How to design a polynomial-time nondeterministic algorithm?

10 Hamiltonian Cycle Given a graph G, does G contain a Hamiltonian cycle?
Hamiltonian cycle is a cycle passing every vertex exactly once.

11 Post office

12 Nondeterministic Algorithm
Guess a permutation of all vertices. Check whether this permutation gives a cycle. If yes, then algorithm halts. What is the running time?

13 Minimum Spanning Tree Given an edge-weighted graph G, find a spanning tree with minimum total weight. Decision Version: Given an edge-weighted graph G and a positive integer k, does G contains a spanning tree with total weight < k.

14 Nondeterministic Algorithm
Guess a spanning tree T. Check whether the total weight of T < k. This is not clear!

15 How to guess a spanning tree?
Guess n-1 edges where n is the number of vertices of G. Check whether those n-1 edges form a connected spanning subgraph, i.e., there is a path between every pair of vertices.

16 Co-decision version of MST
Given an edge-weighted graph G and a positive integer k, does G contain no spanning tree with total weight < k?

17 Algorithm Computer a minimum spanning tree.
Check whether its weight > k. If yes, the algorithm halts.

18 co-NP co-NP = {A | Σ* - A ε NP}

19 NP ∩ co-NP So far, no natural problem has been found in NP ∩ co-NP, but not in P. NP co-NP P

20 Linear Programming Decision version: Given a system of linear inequality, does the system have a solution? It was first proved in NP ∩ co-NP and later found in P (1979).

21 Primality Test Given a natural number n, is n a prime?
It was first proved in NP ∩ co-NP and later found in P (2004).

22 Therefore A natural problem belonging to NP ∩ co-NP is a big sign for the problem belonging to P.

23 Proving a problem in NP In many cases, it is not hard.
In a few cases, it is not easy.

24 Integer Programming Decision version: Given A and b, does Ax > b contains an integer solution? The difficulty is that the domain of “guess” is too large.

25 Lecture 6 Polynomial-time many-one reduction

26 A < m B p A set A in Σ* is said to be polynomial-time many-one reducible to B in Γ* if there exists a polynomial-time computable function f: Σ* → Γ* such that x ε A iff f(x) ε B.

27 A = Hamiltonian cycle (HC)
Given a graph G, does G contain a Hamiltonian cycle?

28 B = decision version of Traveling Salesman Problem (TSP)
Given n cities and a distance table between these n cities, find a tour (starting from a city and come back to start point passing through each city exactly once) with minimum total length. Given n cities, a distance table and k > 0, does there exist a tour with total length < k?

29 HC < m TSP p From a given graph G, we need to construct (n cities, a distance table, k).

30

31 SAT < m 3-SAT p SAT: Given a Boolean formula F, does F have a satisfied assignment? An assignment is satisfied if it makes F =1. 3-SAT: Given a 3-CNF F, does F have a satisfied assignment?

32

33

34

35 Property of < m A < m B and B < m C imply A < m C
A < m B and B ε P imply A ε P p p p

36 NP-complete A set A is NP-hard if for any B in NP, B < m A.
A set A is NP-complete if it is in NP and NP-hard. A decision problem is NP-complete if its corresponding language is NP-complete. An optimization problem is NP-hard if its decision version is NP-hard. p

37 Cook Theorem SAT is NP-complete

38 Proof of Cook Theorem

39

40

41

42 The 1st tape should be

43 The last tape should contain
The final state.

44

45

46

47

48 Exercise!!!

49 3-SAT is NP-complete

50 Lecture 7 More examples

51 Integer Programming TSP Knapsack VC HC 3DM Partition Planar 3SAT 3SAT SAT

52 Vertex-Cover is NP-complete
Proof.

53

54

55 HC is NP-complete

56

57

58 3DM

59 Example of 3DM Messrs. Spinnaker, Buoy, Luff, Gybe, and Windward are yacht owners. Each has a daughter, and each has named his yacht after the daughter of one of the others. Mr. Spinnaker’s yacht, the Iris, is named after Mr. Buoy’s daughter. Mr. Buoy’s own yacht is the Daffodil; Mr. Windward’s yacht is the Jonquil; Mr. Gybe’s, the Anthea. Daffodil is the daughter of the owner of the yacht which is named after Mr. Luff’s daughter. Mr. Windward’s daughter is named Lalage. Who is Jonquil’s father?

60

61

62

63 Trash Can ( )

64 Partition

65

66 S= 1 1


Download ppt "Lecture 5 NP Class."

Similar presentations


Ads by Google