The Complexity Classes NP-Hard, BPP.

Similar documents
Computational Complexity

NP-Completeness. Until now we have been designing algorithms for specific problems

Hamiltonian Cycle. Hamiltonian Cycle

6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch

Data Structures in Java

Computational Complexity

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

Randomized Complexity Classes; RP

Analysis of Algorithms. Unit 5 - Intractable Problems

CMSC 441: Algorithms. NP Completeness

Introduction to Complexity Theory

CSC 5170: Theory of Computational Complexity Lecture 5 The Chinese University of Hong Kong 8 February 2010

Lecture 4: NP and computational intractability

NP Completeness and Approximation Algorithms

Polynomial-time reductions. We have seen several reductions:

ECS 120 Lesson 24 The Class N P, N P-complete Problems

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Chapter 6 Randomization Algorithm Theory WS 2012/13 Fabian Kuhn

Computational Complexity Theory

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Quantum Complexity Theory. Wim van Dam HP Labs MSRI UC Berkeley SQUINT 3 June 16, 2003

Randomized Computation

Design and Analysis of Algorithms

The Beauty and Joy of Computing

NP-Complete Problems. More reductions

NP Complete Problems. COMP 215 Lecture 20

The P = NP Problem Bristol Teachers Circle, June P.D.Welch, University of Bristol

CS 583: Algorithms. NP Completeness Ch 34. Intractability

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

COP 4531 Complexity & Analysis of Data Structures & Algorithms

PAC Learning. prof. dr Arno Siebes. Algorithmic Data Analysis Group Department of Information and Computing Sciences Universiteit Utrecht

Intractable Problems [HMU06,Chp.10a]

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

The Beauty and Joy of Computing

Limitations of Algorithm Power

Beyond NP [HMU06,Chp.11a] Tautology Problem NP-Hardness and co-np Historical Comments Optimization Problems More Complexity Classes

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

13.1 Nondeterministic Polynomial Time

Friday Four Square! Today at 4:15PM, Outside Gates

Lecture 19: Finish NP-Completeness, conp and Friends

The running time of Euclid s algorithm

Polynomial-time Reductions

1 Reductions and Expressiveness

Algorithms: COMP3121/3821/9101/9801

NP-Complete and Non-Computable Problems. COMP385 Dr. Ken Williams

Chapter 7 Randomization Algorithm Theory WS 2017/18 Fabian Kuhn

Problems and Solutions. Decidability and Complexity

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Computational Complexity

Essential facts about NP-completeness:

CS/COE

Automata Theory CS Complexity Theory I: Polynomial Time

CPSC 467b: Cryptography and Computer Security

A Working Knowledge of Computational Complexity for an Optimizer

Computer Sciences Department

Algorithm Design and Analysis

Lecture Examples of problems which have randomized algorithms

conp = { L L NP } (1) This problem is essentially the same as SAT because a formula is not satisfiable if and only if its negation is a tautology.

SAT, Coloring, Hamiltonian Cycle, TSP

P,NP, NP-Hard and NP-Complete

Umans Complexity Theory Lectures

Limits of Feasibility. Example. Complexity Relationships among Models. 1. Complexity Relationships among Models

Algorithms Design & Analysis. Approximation Algorithm

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

CSC 1700 Analysis of Algorithms: P and NP Problems

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

P vs. NP. Data Structures and Algorithms CSE AU 1

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Complexity Theory Part II

CPSC 467b: Cryptography and Computer Security

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Turing Machines and Time Complexity

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

Lecture 23: More PSPACE-Complete, Randomized Complexity

CSC 421: Algorithm Design & Analysis. Spring 2018

Factorization & Primality Testing

Algorithm Design and Analysis

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

COMP Analysis of Algorithms & Data Structures

CSCI3390-Second Test with Solutions

Complexity Theory Part I

IE418 Integer Programming

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Lecture 5. 1 Review (Pairwise Independence and Derandomization)

Chapter 2 : Time complexity

Notes for Lecture 21

Mathematics, Proofs and Computation

4. LIMITS OF COMPUTATION: Tractable and Intractable Problems

CS151 Complexity Theory. Lecture 1 April 3, 2017

Lecture 22: Counting

The P versus NP Problem. Ker-I Ko. Stony Brook, New York

Advanced Algorithms and Complexity Course Project Report

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity

Polynomial-Time Reductions

Transcription:

SE 3310b Theoretical Foundations of Software Engineering The Complexity Classes NP-Hard, BPP. Aleksander Essex 1 / 26

The NP-Hard Class 2 / 26

The NP-Hard Class Recall the NP-complete complexity class was defined as the set of problems that are: In NP, and, Evey problem in NP is polynomial time reducible to problems in this class. The second property is interesting because it captures the idea that problems in this class are hard to solve. Ok so what about this first condition? What if we just want to look at problems that are hard to solve, regardless of whether they are in NP or not? 3 / 26

The NP-Hard Class So let s consider the class of hard problems, regardless of whether they re in NP or not. Definition 1 (NP-Hard). A problem is NP-Hard if all problems in NP are polynomial time reducible to it. Translation: NP-Hard is the set of problems that are as hard or harder than anynp problem. 4 / 26

The NP-Hard Class Let s examine a few consequences of this definition of the NP-Hard class: It contains the NP-complete class It includes problems that are not in NP It includes problems that aren t decision problems It even includes decision problems that are undecidable! 5 / 26

The NP-Hard Class Here s how P, NP, NP-complete and NP-Hard interrelate: NP-Hard NP-Complete NP P 6 / 26

Optimization Problems NP-Hard contains NP-complete decision problems, but it s also well known for containing optimization problems, e.g., find the best/cheapest/fastest/smallest solution to a particular problem. Here are just a few real-world situations where you might encounter hard optimization problems: Scheduling Data mining Selection Diagnosis Classification Process control Planning and resource allocation 7 / 26

Example: The Traveling Salesman Problem Problem: Given a list of cities and the distance between each city, find the shortest route that (a) visits each city once, and (b) returns to the starting point. More generally: Given a wighted graph, find a Hamiltonian Cycle with the lowest weight. Applications: Scheduling, route planning, etc 8 / 26

Traveling Salesman Problem Figure: TSP for all official cities in the US. Source: David Applegate, Robert Bixby, Vasek Chvatal and William Cook 9 / 26

Example: Knapsack Problem Problem: Given a knapsack with that can hold up to a certain weight, and a list of items, each with a weight and corresponding value, fill the knapsack with the highest value selection of items (without exceeding the knapsack s max load). Applications: Resource allocation, financial planning, cryptography, etc. 10 / 26

Optimization Problems vs. NP How do optimization problems relate to NP? Here s a natural question: is the Traveling Salesman problem in NP-complete? In it s basic form: no. TSP ask to find the best solution, so its clearly not a yes/no decision problem, thus it s not in NP. Ok so what if we re-stated it as a decision problem: here s a certificate (i.e., a claimed solution), is this the best? Is this in NP? For it to be in NP it must be checkable in polynomial time. But checking it s the best would mean being able to decide it it was less then all the other solutions. 11 / 26

Optimization Problems vs. NP We can convert the basic TSP problem (which is NP-Hard but not NP-complete) into one that is NP-Hard and NP-complete as follows: Given a weighted graph and a weight w, is there a Hamiltonian cycle below weight w? The point is subtle, which is why you will see people refer to TSP as an NP-complete problem, even though it isn t technically. 12 / 26

Probabilistic Algorithms 13 / 26

Probabilistic Turing Machines Recall a deterministic Turing machine (DTM) follows a single computational path whereas a non-deterministic Turing machine (NTM) can potentially follow many paths simultaneously. For certain types of problems (such as brute-force searches) NTMs provide a decisive performance advantage: they can explore exponentially more computational paths per unit time as DTMs (assuming, of course, P NP). 14 / 26

Probabilistic Turing Machines NTMs are a useful for helping us establish bounds on the hardness of various real-world problems. But as a real-world construct they have a major limitation: we can t build them (at least not to efficiently solve the really interesting problems)! But maybe there s a way we can borrow a page from the NTM playbook, so to speak. 15 / 26

Probabilistic Turing Machines Recall for a problem to be in NP, any single computational path can be evaluated by a DTM in polynomial time. So in a sense a DTM could efficiently decide an NP problem if only it had an efficient way to decide which path to take. This would imply P=NP, which of course we conjecture to be false. Here s an idea: what if we picked a computational path at random? That is, at each step that NTM branches, we let a coin-toss decide which path to follow. It s not really non-deterministic because it doesn t branch, but it s not really deterministic either since it follows paths by chance. 16 / 26

Probabilistic Turing Machines Definition 2. Probabilistic Turing Machine A probabilistic Turing machine (PTM) is a Turing machine that has access to a source of random bits. when faced with more than one legal nextmove, the PTM uses the random bits to pick exactly one path to follow. 17 / 26

Probabilistic Turing Machines At first glance a PTM picking a random computational path leaves us no better off than a DTM brute force searching exponentially many paths: if there are e.g., 2 n computational paths, and only m of them accept (for some m! n), then we have a vanishingly small chance (i.e., P = m 2 n ) of picking this path at random. But what if we add another ingredient: the ability for the decision to be wrong sometimes? Well maybe it doesn t help us with exponentially growing brute-force searches, but maybe there is class of problems that would be faster to solve... 18 / 26

The Class BPP Definition 3 (The class BPP). Bounded-error probabilistic polynomial-time (BPP) is the class problems solvable by a probabilistic Turing machine in polynomial time with an error probability of at most 1 3. The choice of 1 3 as an error bound is mainly by convention. Ultimately any number ă 0.5 would suffice; the idea is that BPP problems are one in which the associated PTM (a) halts in polynomial time, and (b) is right most of the time. 19 / 26

The Class BPP Stated more formally, L P BPP iff there exists a PTM M where for all stringsx : M halts in polynomial time, If x P L, P(M outputs accept) ě 2 3 If x R L, P(M outputs accept) ă 1 3 20 / 26

PRIMES P BPP One of the classic BPP problems is PRIMES: PRIMES = tx : x is a prime numberu The first major primality test is due to Fermat, however, a certain class of composite numbers (called Psuedoprimes) will always pass the test, i.e., P(M accepts x is a composite pseudoprime) = 1 Fermat s test therefore isn t in BPP since the error probability exceeds the bound for certain inputs. An extension due to Miller and Rabin provides an unconditional probabilistic algorithm, i.e., error is bounded across all inputs. 21 / 26

More trials = more confidence The error of the Miller-Rabin test is one-sided (no false negatives), and the probability of false positives can be decreased through repeated trails: Small chance of false positives: P(Output= prime input was composite) ď 1 4 k for k trails No chance of false negatives: P(Output= composite input was prime) = 0 So after only 20 trials if the M-R test claims the input was prime, there s a less than one-in-a-trillion chance the input was composite. 22 / 26

PRIMES P P Despite a small probability of error, the Miller-Rabin test is extremely fast and easy to implement, and as such remains the most widely used primality test for real-world applications (e.g., internet security). For many years (1980-2006) it was generally thought that a probabilistic polynomial solution to PRIMES was the best we could do. Then in 2006, Agrawal et al. proved an important result: PRIMES P P The AKS primality test runs in polynomial time, and, unlike Miller Rabin, is deterministic, i.e., P(Output= prime input was composite) = 0 23 / 26

So What? The fact that PRIMES was found to be in P underlines the sometimes staggering difference between complexity theory and complexity practice. Consider an earlier test due to Adleman, Pomerance and Rumely (the APR test). Like AKS it is deterministic, but has the following (non-polynomimal) complexity: O((ln n) c ln ln ln n ) That s right: 3 consecutive ln s. By definition it s not polynomial because the exponent is a function of n. But as Manindra Agrawal joked, although ln ln ln n grows to infinity, emperically it has been found to be less than or equal to 4. So although AKS is more efficient in general, it s actually considerably slower for any conceivable practical practical purpose. 24 / 26

Does P=BPP? Another major open question in complexity theory (in addition to P vs. NP) is whether P=BPP? This is somewhat of an interesting development, because when BPP was initially considered, it was thought that PTMs with bounded error really could solve more problems efficiently than DTMs. Over the years, however, many BPP problems (like PRIMES) have been shown to be in P after all. In fact there are few known problems remaining in BPP that are not known to also be in P (one example is polynomial identity testing) leading us to conjecture P=BPP. 25 / 26

BPP vs. P and NP Here s a depiction of the relationship between P, NP and BPP. NP-Hard NP-Complete NP BPP P In the diagram BPP extends beyond NP, however P? = BPP remains an open problem in the theory of computation. 26 / 26