Download presentation

Presentation is loading. Please wait.

Published byKaylynn Brinkworth Modified over 2 years ago

1
NP theory Pasi Fränti 22.10.2013

2
Turing machine vs. RAM © GEOFF DRAPER

3
Palindrome example …… SOS ABBA SAIPPUAKAUPPIAS INNOSTUNUT SONNI SAIPPUAKIVIKAUPPIAS

4
Turing machine solving palindrome Accept! q1q1 q2q2 q4q4 q0q0 q3q3 Final Initial 0,b 1,b b,b 1,b 0,b Copy Rewind Compare b,b b,0 b,1 1,1 0,0 b,b q0q0 bbq4q4 (b,S)(b,S)(b,S)(b,S) Empty 0bq1q1 (0,S)(b,S)(b,S) 1bq1q1 (1,S)(b,S)(b,S) q1q1 0bq1q1 (0,R) Copy 1bq1q1 (1,R) bbq2q2 (b,S)(b,S)(b,L)(b,L) q2q2 b0q2q2 (b,S)(b,S)(0,L) Move b1q2q2 (b,S)(b,S)(1,L) bbq3q3 (b,L)(b,L)(b,R)(b,R) q3q3 00q3q3 (0,L)(0,R) Compare 11q3q3 (1,L)(1,R) Bbq4q4 (b,S)(b,S)(b,S)(b,S)

5
product := n; FOR i:=1 TO (n-1) DO product := product * n; Assembler READ r1; IF r1≤0 THEN WRITE 0 ELSE r2 r1; r3 r1-1; WHILE r3>0 DO r2 r2*r1; r3 r3-1; OD; WRITE r2; PASCAL ALGOL READ1 LOAD1 JGTZpos WRITE=0 JUMPendif pos:LOAD1 STORE2 LOAD1 SUB=1 STORE3 while:LOAD3 JGTZcont JUMPendw cont:LOAD2 MULT1 STORE2 LOAD3 SUB=1 STORE3 JUMPwhile endw:WRITE2 endif:HALT Three programs to calculate N N Loop variable Output READ r1 IF r1≤0 r2 r1 r3 r3-1 r2 r2*r1 r3 r3-1 WHILE r3>0 WRITE r2 Input

6
RAM and Turing compared RAMTuring Sequence: Loop: Condition: WHILE r3>0 DO IF r1≤0 THEN … r2 r2*r1; r3 r3-1; … q1q1 q2q2 q3q3 q4q4 a b q5q5 a b

7
RAMTuring One step:O(1)S(N) T(N) stepsT(N)T(N)∙S(N) ≤ T(N) 2 Simulating RAM by Turing xxxxxЬЬxЬЬ …… R/W head Next needed S(N) Rewind

8
Empty space for notes

9
P and NP classes P Problems that can be solved in polynomial time by deterministic Turing machine P

10
P and NP classes P Problems that can be solved in polynomial time by deterministic Turing machine NP Problems that can be solved in polynomial time by non-deterministic Turing machine NP P

11
Known problems in P NP P SORT MM SEARCH SP SELECTION MST

12
Known problems in NP NP P COLORING TSP EXACT COVER KP SAT SORT MM SEARCH SP SELECTION MST

13
Anything outside of NP ? NP P CHESS GO COLORING TSP EXACT COVER KP SAT HANOI SORT MM SEARCH SP SELECTION MST

14
Coloring(E,V,k) FOR i 1 TO n DO Color[i] Choose(1,k); FOR All e(i,j) V DO IF Color[i]=Color[j] FAIL; SUCCESS; Select combination Check validity Non-deterministic algorithm Coloring problem

15
TSP(E,V,k) Sum 0; FOR i 1 TO n-1 DO Node[i] Choose(1,n); Sum Sum + w(Node[i-1],Node[i]); IF Sum

16
Reduction of problems L 1 ≤ p L 2 Search ≤ p Sort Transitivity: L 1 ≤ p L 2 and L 2 ≤ p L 3 L 1 ≤ p L 3 A2A2 I1I1 I2I2 p p O1O1 O2O2 Sort I search O search O sort min A3A3 I1I1 I2I2 p p O1O1 O2O2 I3I3 p p O3O3

17
Empty space for notes

18
NP-hard NP P NP-hard L1L1 L L2L2 L4L4 L3L3 ≤p≤p ≤p≤p ≤p≤p ≤p≤p Problem L is NP-hard iff all problems in NP reduces to L in polynomial time: L x ≤ p L L x NP

19
NP complete NP P Problem L is NP-complete iff L is NP-hard L NP NP-hard NP-complete

20
NP-complete Another view P NP complete Difficulty increases Problem L is NP-complete iff L is NP-hard L NP

21
NP P Intersection of P and NP-hard Case 1: P NP-hard = NP-hard NP P Case 2: L: L P L NP-hard NP-hard

22
P=NP Open question: P=NP ? NP P NP-hard

23
Empty space for notes

24
Turing is still going on strong… http://www.youtube.com/watch?v=cYw2ewoO6c4

Similar presentations

Presentation is loading. Please wait....

OK

NP-Hard Nattee Niparnan.

NP-Hard Nattee Niparnan.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on media revolution entertainment Ppt on rc coupled amplifier experiment Ppt on allergic contact dermatitis Ppt on earth dam stability Ppt on etiquettes of life Raster and random scan display ppt online Ppt on centring tattoo Ppt on data handling for class 3 Ppt on statistics in maths class Ppt on conic sections for class 11 free download