Presentation is loading. Please wait.

Presentation is loading. Please wait.

Complexity Classes Kang Yu 1. NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP.

Similar presentations


Presentation on theme: "Complexity Classes Kang Yu 1. NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP."— Presentation transcript:

1 Complexity Classes Kang Yu 1

2 NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP is polynomial reducible to this problem in polynomial time. NP-hard – Problem satisfies condition 2. co-NP – Its complement is in NP 2

3 NP 3

4 Do you know? Beyond NPC is what? / What is detail of NP-hard? What doest “If XXX happens Polynomial Hierarchy collapse to a certain level” mean? Is NP-hard problem unsolvable? What is inside P? 4

5 Polynomial Hierarchy Parameterized Complexity Parallel Complexity Conclusion 5

6 Optimization Problems Travelling Salesman Problem (TSP) – Wiki: Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. 6

7 Optimization Problems Several related problems: TSP(D) – is there a TSP path of length at most D? EXACT TSP(D) – is D the length of the shortest TSP path? TSP COST – compute the length D of the shortest TSP path TSP – find the shortest TSP path 7

8 Optimization Problems TSP(D) is NP-complete Is EXACT TSP(D) in NP? – We don’t know – We don’t know a compact disqualification that D is not the exact TSP cost if the real TSP cost is less then D, its easy, but what if the real TSP is more? – EXACT TSP(D) is intersection of two languages, one in NP and one in co-NP: an input is yes instance of EXACT TSP(D) if it is yes instance of TSP(D), and yes instance of co-TSP(D-1) 8

9 The Class DP Definition: A language L is in the class DP (D P ) iff there are two languages L 1  NP and L 2  co-NP such that L=L 1  L 2. Note : DP is not NP  co-NP! SAT-UNSAT problem: given two formulas  and  ’, both in conjunctive normal form with three literals per clause, is it true that  is satisfiable and  ’ is unsatisfiable? Theorem: SAT-UNSAT is DP complete – completeness: R(( ,  ’))=(R 1 (  ), R 2 (  ’)), where R 1 and R 2 are the corresponding reductions in NP and co-NP 9

10 The Class DP Theorem: EXACT TSP is DP complete. The exact cost versions of all NP complete problems we have seen are in DP. 10

11 Oracle TM 11 Query tape Query state yes no Remark:

12 Class P NP DP – class of languages recognizable by oracle machine with two queries to SAT oracle and accepts if first answer is “yes” and second “no”. What happens when we allow polynomial number of queries? – P SAT, but since SAT is NP-complete, we can write P NP 12

13 Polynomial Hierarchy We have defined P NP, what about NP NP ? And what about oracle machines using P NP or NP NP as oracles? Definition: The polynomial hierarchy is the following sequence of classes First,  i  0: Cumulative polynomial hierarchy: 13

14 Polynomial Hierarchy Theorm: 14

15 PSPACE P

16 Polynomial Hierarchy Parameterized Complexity Parallel Complexity Conclusion 16

17 Parameterized Problem Motivation: –For some hard problem (e.g., NPC problem), we may assume some parameter to be small or even fixed. Exponential time complexity on these parameters is acceptable.

18 Parameterized Problem Given: Graph G, integer k, … Parameter: k Question: Does G have a ??? of size at least (at most) k? – Examples: vertex cover, independent set, coloring, … 18

19 Parameterized Complexity The behavior of these two are different: – O( f(k) * n c ) –  ( n f(k) ) Proposed by Downey and Fellows. FPT contains the fixed parameter tractable problems, which are those that can be solved in time O(f(k)*n O(1) ) for some computable function f. 19

20 Example of Parameterized Problem Vertex cover Given: Graph G, integer k Parameter: k Question: Is there a vertex cover of G of size at most k? Solvable in O(2 k (n+m)) time 20

21 More on Parameterized Complexity W hierarchy – FPT ⊆ W[1] ⊆ W[2] ⊆ … ⊆ W[t] ⊆ … – π ∈ W[1] if there is an FPT-reduction from to Weighted 2- CNF Satisfiability. – For t ≥ 2, a parameterized problem π ∈ W[t] is there is an FPT-reduction from π to Weighted t-Normalized Satisfiability. A Boolean expression is t-normalized if it is of the form ∧∨∧ …with t -1 alternations of ∨ and ∧. A 2- normalized expression is the same as a CNF expression. The Weighted t-Normalized Satisfiability problem asks whether a Boolean expression in t-normalized form has a satisfying truth assignment with weight k. Fortunately many natural computational problems occupy the lower levels, W[1] and W[2]. 21

22 Polynomial Hierarchy Parameterized Complexity Parallel Complexity Conclusion 22

23 Parallel Computing Roughly speaking, A problem is feasible if it can be solved by a parallel algorithm with both worst case time and processor complexity n O(1). A problem is feasible highly parallel if it can be solved by an algorithm with worst case time complexity (log n) O(1) and processor complexity n O(1). A problem is inherently sequential if it is feasible but has no feasible highly parallel algorithm for its solution. 23

24 Parallel Model Parallel Random Access Machine (PRAM) model – a number of processors all can access – a large share memory – all processors are synchronized – all processor running the same program each processor has an unique id, pid. and may instruct to do different things depending on their pid 24

25 PRAM Models PRAM models vary according – how they handle write conflicts – The models differ in how fast they can solve various problems. Concurrent Read Exclusive Write (CREW) – only one processor are allow to write to – one particular memory cell at any one step Concurrent Read Concurrent Write (CRCW) Algorithm works correctly for CREW – will also works correctly for CRCW – but not vice versa 25

26 Evaluation Preliminary – Let T*(n) be the time complexity of a sequential algorithm to solve a problem P of input size n – Let T p (n) be the time complexity of a parallel algorithm to solves P on a parallel computer with p processors Speedup – S p (n) = T*(n) / T p (n) – S p (n) <= p – Best possible, S p (n) = p when T p (n) = T*(n)/p Efficiency – E p (n) = T 1 (n) / (p T p (n)) where T 1 (n) is when the parallel algorithm run in 1 processor – Best possible, E p (n) = 1 26

27 Related Complexity Classes Definitions: – P : set of all languages L that are decidable in sequential time n O(1). – NC : set of all languages L that are decidable in parallel time (logn) O(1) and processors n O(1). – FP : set of all functions from {0,1}* to {0,1}* that are computable in sequential time n O(1). – FNC : set of all functions from {0,1}* to {0,1}* that are computable in parallel time (logn) O(1) and processors n O(1). – NC k, k  1 : set of all languages L such that L is recognized by a uniform Boolean circuit family {  n } with size(  n ) = n O(1) and depth (  n ) = O((logn) k ). 27

28 Boolean Circuit Model 28 1 01 1 0 ANDOR AND OR NOT

29 Example: Finding Max in Constant Time 29 Uses n 2 processors, does only three read/write steps!

30 Example: Finding Max in Constant Time 30 CRCW method

31 31

32 Polynomial Hierarchy Parameterized Complexity Parallel Complexity Conclusion 32

33 Conclusion Beyond NPC is what? / What is detail of NP-hard? – Polynomial hierarchy as well as complexity class such as PSPACE, EXP, EXPSPACE What doest “If XXX happens Polynomial Hierarchy collapse to a certain level” mean? – If, ploynomial hierarchy collaspe to i-th level 33

34 Conclusion Is NP-hard problem unsolvable? – SAT solvers http://www.satcompetition.org/http://www.satcompetition.org/ – Efficient FPT algorithm can solve some NP- hard problem in small cases efficiently What is inside P? – Parallel computing and NC-complete class 34

35 References Polynomial Hierarchy – https://www.utdallas.edu/~dxd056000/cs6382/ lect11.ppt (, lect12-13.ppt) https://www.utdallas.edu/~dxd056000/cs6382/ lect11.ppt – http://theoryofcomputing.org/libfiles/slides/bey ondnp.ppt http://theoryofcomputing.org/libfiles/slides/bey ondnp.ppt Parameterized Complexity – http://en.wikipedia.org/wiki/Parameterized_co mplexity http://en.wikipedia.org/wiki/Parameterized_co mplexity – http://www.win.tue.nl/ipa/archive/algbasiccour se2007/ipa-fixedparameter-smallerfile.ppt http://www.win.tue.nl/ipa/archive/algbasiccour se2007/ipa-fixedparameter-smallerfile.ppt 35

36 References Parallel Complexity – http://www2.latech.edu/~choi/Bens/Teaching/ Development/Algorithm/PowerPoint/CH14.ppt http://www2.latech.edu/~choi/Bens/Teaching/ Development/Algorithm/PowerPoint/CH14.ppt – http://sslab.cs.nthu.edu.tw/~cylin/PDS/slides1. 3-Parallel%20Algorithm%20Complexity.ppt http://sslab.cs.nthu.edu.tw/~cylin/PDS/slides1. 3-Parallel%20Algorithm%20Complexity.ppt – http://www.cs.armstrong.edu/greenlaw/presen tations/parallel.ppt http://www.cs.armstrong.edu/greenlaw/presen tations/parallel.ppt 36

37 37


Download ppt "Complexity Classes Kang Yu 1. NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP."

Similar presentations


Ads by Google