FACULTY OF ENGINEERING & INFORMATION TECHNOLOGIES P, NP, and Complexity Six fundamental facts One rule of thumb Three fundamental notions One fundamental.

Slides:



Advertisements
Similar presentations
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
Advertisements

What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2012 Adam Finkelstein.
The Theory of NP-Completeness
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.
What is the computational cost of automating brilliance or serendipity? (Computational complexity and P vs NP question) COS 116: 4/12/11 Sanjeev Arora.
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Computational problems, algorithms, runtime, hardness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
P versus NP and Cryptography Wabash College Mathematics and Computer Science Colloquium Nov 16, 2010 Jeff Kinne, Indiana State University (Theoretical)
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
CSCE350 Algorithms and Data Structure
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Great Theoretical Ideas in Computer Science.
MIT and James Orlin1 NP-completeness in 2005.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
What is Computer Science About? Part 2: Algorithms.
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Instructor: Shengyu Zhang 1. Tractable While we have introduced many problems with polynomial-time algorithms… …not all problems enjoy fast computation.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
Cliff Shaffer Computer Science Computational Complexity.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
COMPSCI 102 Introduction to Discrete Mathematics.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Erdal Kose CC30.10 These slides are based of Prof. N. Yanofsky Lecture notes.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
2101INT – Principles of Intelligence Systems Lecture 3.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
The Theory of NP-Completeness
The NP class. NP-completeness
Computational problems, algorithms, runtime, hardness
Lecture 22 Complexity and Reductions
NP-Completeness Yin Tat Lee
Computability and Complexity
Lecture 24 NP-Complete Problems
Intro to NP Completeness
Chapter 11 Limitations of Algorithm Power
Prabhas Chongstitvatana
CPS 173 Computational problems, algorithms, runtime, hardness
NP-Completeness Yin Tat Lee
The Theory of NP-Completeness
What is Computer Science About? Part 2: Algorithms
Presentation transcript:

FACULTY OF ENGINEERING & INFORMATION TECHNOLOGIES P, NP, and Complexity Six fundamental facts One rule of thumb Three fundamental notions One fundamental question School of IT Peter Eades

Fundamental Fact #1 Exponential functions are eventually bigger than polynomial functions

Fundamental Fact #1 3 Exponential functions are eventually bigger than polynomial functions exponential function polynomial function

Fundamental Fact #2 4 Some algorithms are efficient, some are not

Fundamental Fact #2 Sorting problem: Alice Bob Chen Doug Evelyn Franz Georgie 5 Some algorithms are efficient, some are not Evelyn Georgie Franz Chen Bob Alice Doug ? Algorithm ?

sorting Basic step: ›If two things are out of order, we can swap them to improve the sortedness of the list 6 There are many different algorithms for sorting Evelyn Georgie Franz Chen Bob Alice Doug Evelyn Georgie Chen Franz Bob Alice Doug Evelyn Georgie Chen Franz Alice Bob Doug …

sorting Exhaustively swap to get every possible ordering of the list At each step, check to see if the list of ordered 7 exhaustingSort

sorting 8 bubbleSort

sorting 9 geeky_bubbleSort -Same old bubbleSort algorithm, but use really clever coding in assembler and C languages to make it go faster. -Run on a fast computer.

sorting 10 AISASort Run-time for AISASort: exponential

sorting 1.Choose an element, called a pivot, from the list. 2.Swap things around so that smaller things come before the pivot, and larger things come after it 3.Recursively sort the sub-list of lesser elements and the sub-list of greater elements. 11 quickSort Evelyn Georgie Franz Bob Chen Alice Doug Bob Alice Chen Evelyn Doug Franz Georgie Alice Bob Chen Doug Evelyn Franz Georgie 123

sorting 12 Remarks: -quickSort is excellent -bubbleSort and geeky_bubbleSort are feasible -AISASort is infeasible (as well as exhaustingSort) exhausting Sort bubbleSort geeky _bubbleSort AISASort quickSort 10About * *

Rule of Thumb #1 13 Rule of Thumb #1 An algorithm that runs in exponential time is not feasible; an algorithm that runs in polynomial time may be feasible.

Rule of Thumb #1 ›Infeasible -exhaustingSort -AISASort ›Feasible -bubbleSort -quickSort 14 An algorithm that runs in exponential time is not feasible; an algorithm that runs in polynomial time may be feasible.

Fundamental Notion #1: P 15 Fundamental Notion #1: P P is the set of all problems that can be solved in polynomial time

Fundamental Notion #1: P 16 P Sorting problem Find Max Max Flow

Fundamental Fact #3 17 Fundamental Fact #3 Some problems can be solved with efficient algorithms, and some others … maybe not

traveling salesman problem 18 Some problems can be solved with efficient algorithms, and some others … maybe not

traveling salesman problem 19 Some problems can be solved with efficient algorithms, and some others … maybe not

traveling salesman problem Basic problem: ›We need to swap around the order of cities to decrease the length travelled 20 There are many different algorithms for the traveling salesman problem 1.Sydney 2.Darwin 3.Brisbane 4.Melbourne 5.Perth 6.Adelaide 7.Hobart 1.Sydney 2.Brisbane 3.Darwin 4.Melbourne 5.Perth 6.Adelaide 7.Hobart Like the sorting problem

traveling salesman problem Exhaustively swap to get every possible ordering of the cities At each step, compute the total distance travelled Keep the tour with the minimum total distance 21 exhaustingTSP

traveling salesman problem 22 bubbleTSP Run-time for bubbleTSP:  Hard theorem: it can take exponentially time, but not as bad as exhaustingTSP Effectiveness of bubbleTSP:  Does not give optimal results  Gives mediocre results

traveling salesman problem 23 AISA_TSP -Choose swaps that decrease distance as much as possible -Use an AI technique called “simulated annealing” to search for an ordering with smallest total distance Run-time for AISA_TSP:  Hard theorem: it can take exponentially long  Faster than exhaustingTSP  Slower than bubbleTSP Effectiveness of AISA_TSP:  Does not give optimal results  Gives mediocre results, but better than bubbleTSP

traveling salesman problem 24 How long does it take to find a solution to TSP? Remarks: -We don’t know any algorithm for TSP that runs fast and gives an optimal result AISA_TSP

Fundamental Fact #3 25 Fundamental Fact #3 Some problems can be solved with efficient algorithms, and some others … maybe not (continued)

cliques 26

cliques 27 Bob is connected to Alice Bob is connected to Andrea Bob is connected to Amelia Brian is connected to Alice Brian is connected to Andrea Brian is connected to Amelia Boyle is connected to Alice Boyle is connected to Andrea Boyle is connected to Annie Bernard is connected to Alice Bernard is connected to Andrea Bernard is connected to Annie Some people: Alice, Andrea, Annie, Amelia, Bob, Brian, Bernard, Boyle Some connections Is there a clique of size 3 among these people? (Clique: a group of people who are all connected to each other)

cliques 28 Is there a clique of size 5 among these nodes? Another network

cliques 29 Clique of size 4

cliques 30 exhaustingClique

Fundamental Fact #3 31 Fundamental Fact #3 Some problems can be solved with efficient algorithms, and some others … maybe not (still continued)

sat If Peter is Australian, then Patrick is Australian, and Either Patrick is Australian, or Patrick is Irish, or Paul is English, and If Catherine is English then either Paul is not English or Jane is French, and If Jane is French and Patrick is not Australian, then Peter is English, and If Peter is English then Peter is not Irish, and If Paul is not English then either Catherine is Australian or Jane is French, and …. 32 The Satisfiabilty (SAT) problem Question: Is there any way that this statement could be true?

sat 33 SAT Given an abstract proposition

sat 34 exhaustingSAT

Cliques, travelling salesmen, and satisfaction The Travelling Salesman Problem, the Clique Problem, and SAT all share some characteristics: -They can be solved by exhausting algorithms that use exponential time -No-one knows any algorithms that run fast and always solve these problems 35 Some problems can be solved with efficient algorithms, and some others … maybe not Remarks -These problems are commercially important, and a huge amount of research has been done on them. -There are many algorithms for specific versions, and many algorithms that almost work -There are many other problems with the same characteristics

Fundamental Fact #4 36 Fundamental Fact #4 Sometimes we can efficiently check whether an answer is correct, even if we can’t efficiently find a correct answer

Cliques, travelling salesmen, and satisfaction 37 Sometimes we can efficiently check whether an answer is correct, even if we can’t efficiently find a correct answer

Fundamental Notion #2: NP 38 Fundamental Notion #2: NP NP is the set of problems for which we can efficiently check to see whether a given answer is correct.

Fundamental Notion #2: NP 39 NP Clique SAT Traveling Salesman ? ?

Fundamental Notion #2: NP 40 NP Clique SAT Traveling Salesman ? ? P Sorting problem

Fundamental Fact #5 41 Fundamental Fact #5 Some problems are harder than others

Clique is harder than SAT ›The Clique problem is at least as difficult as SAT. Theorem If there were a good algorithm to solve the clique problem, then there would be a good algorithm to solve SAT. 42 Some problems are harder than others Proof 

Clique is harder than SAT Theorem If there were a good algorithm to solve the clique problem, then there would be a good algorithm to solve SAT. 43

Clique is harder than SAT 44 reduction

Clique is harder than SAT 45 reduction

Clique is harder than SAT 46 reduction

Clique is harder than SAT Theorem If there were a good algorithm to solve the clique problem, then there would be a good algorithm to solve SAT. 47 ›That is, if the clique problem were easy, then SAT would be easy ›That is, the clique problem is at least as difficult as SAT

Fundamental Fact #5 ›Also, the travelling salesman problem is at least as hard as SAT. 48 Some problems are harder than others Clique SAT Traveling Salesman Is_at_least_as_hard_as

Fundamental Fact #5 49 Clique SAT Traveling Salesman Hamilton Path Independent set Bin Packing Feedback arc set Scheduling Graph colouring In fact, the relationship “at_least_as_hard_as” between problems has been very well investigated. For many problems, there is a proof that this problem is at least as hard as SAT.

Fundamental Fact #5 In fact, the relationship “at_least_as_hard_as” between problems has been very well investigated. For many problems, there is a proof that this problem is harder than SAT. 50 Many problems are at_least_as_hard_as SAT.  Feedback Arc Set Problem: solutions needed to detect deadlocks in communications systems  Scheduling problems: solutions need in logistics industry, and in computer systems  Bin Packing problems: solutions needed in manufacturing: steel industry, clothing industry  Many layout problems: solutions needed for network visualization, newspaper layout, integrated circuit layout  Number theory problems: solutions needed for cryptography

Fundamental Fact #6 51 Fundamental Fact #6 SAT is at least as hard as every other problem in NP (Cook’s Theorem)

Fundamental Fact #6 52 NP Clique SAT Hamilton Path Independent set Bin Packing Feedback arc set Scheduling SAT is at_least_as_hard_as every problem in NP

Fundamental Fact #6 53 Cook’s Theorem SAT is “NP-complete”

Fundamental Notion #3: NP-complete 54 Fundamental Notion #3 A problem is NP-complete if it is  In NP, and  At least as difficult as every other problem in NP

NP NP-complete Fundamental Notion #3 55 Clique SAT Hamilton Path Independent set Bin Packing Feedback arc set Scheduling A problem is NP-complete if it is  In NP, and  At least as difficult as every other problem in NP P Sorting problem Find Max

Fundamental Fact #7 56 Fundamental Fact #7 Many real-world problems are NP-complete.

Fundamental Fact #7 57 Many real-world problems are NP-complete.  Feedback Arc Set Problem: solutions needed to detect deadlocks in communications systems  Scheduling problems: solutions need in logistics industry, and in computer systems  Bin Packing problems: solutions needed in manufacturing: steel industry, clothing industry  Many layout problems: solutions needed for network visualization, newspaper layout, integrated circuit layout  Number theory problems: solutions needed for cryptography

Fundamental Question #1 58 Fundamental Question #1 Does P equal NP?

NP NP-complete Fundamental Question #1 59 Clique SAT Hamilton Path Independent set Bin Packing Feedback arc set Scheduling P=NP ??? P Sorting problem Find Max

Fundamental Question #1 ›If P=NP then -All the real-world problems in NP have polynomial-time algorithms, and can be feasibly solved. 60 P=NP ???

Fundamental Question #1 ›To prove P=NP -You need to show that one NP-complete problem has a polynomial-time solution. 61 P=NP ???

Fundamental Question #1 ›This is the most fundamental issue in Computer Science ›The problem is still unsolved 62 P=NP ???

Fundamental Question #1 ›The investigation of this question and others like it is called “complexity theory” 63 P=NP ???

The Fundamentals of P, NP, and Complexity Fundamental Fact #1: Exponential functions are eventually bigger than polynomial functions Fundamental Fact #2: Some algorithms are efficient, some are not Rule of Thumb #1: An algorithm that runs in exponential time is not feasible; an algorithm that runs in polynomial time may be feasible. Fundamental Notion #1: P is the set of all problems that can be solved in polynomial time Fundamental Fact #3: Some problems can be solved with efficient algorithms, and some others … maybe not Fundamental Fact #4: Sometimes we can efficiently check whether an answer is correct, even if we can’t efficiently find a correct answer Fundamental Notion #2: NP is the set of problems for which we can efficiently check to see whether a given answer is correct. Fundamental Fact #5: Some problems are harder than others Fundamental Fact #6: SAT is at least as hard as every other problem in NP Fundamental Notion #3: A problem is NP-complete if it is in NP, and at least as difficult as every other problem in NP Fundamental Fact #7: Many real-world problems are NP-complete Fundamental Question #1: Does P equal NP? 64