Nondeterministic Polynomial Time

Similar documents
Computational Complexity

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

Tractable & Intractable Problems

CS/COE

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

NP Complete Problems. COMP 215 Lecture 20

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

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Lecture 4: NP and computational intractability

Limitations of Algorithm Power

CS481: Bioinformatics Algorithms

NP-Completeness. NP-Completeness 1

P, NP, NP-Complete. Ruth Anderson

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

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

ECS122A Handout on NP-Completeness March 12, 2018

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

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

Data Structures in Java

Unit 1A: Computational Complexity

Analysis of Algorithms. Unit 5 - Intractable Problems

Polynomial-time Reductions

VIII. NP-completeness

Introduction to Complexity Theory

CSE 105 THEORY OF COMPUTATION

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

SAT, Coloring, Hamiltonian Cycle, TSP

Design and Analysis of Algorithms

CSCI3390-Lecture 17: A sampler of NP-complete problems

Polynomial-time reductions. We have seen several reductions:

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

Graduate Algorithms CS F-21 NP & Approximation Algorithms

Informatique Fondamentale IMA S8

Complexity, P and NP

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

NP-Complete Reductions 1

Data Structures and Algorithms

NP and Computational Intractability

NP-Complete Problems. More reductions

Problems and Solutions. Decidability and Complexity

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

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

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

CSE 105 Theory of Computation

Algorithms Design & Analysis. Approximation Algorithm

P,NP, NP-Hard and NP-Complete

8.3 Hamiltonian Paths and Circuits

NP Completeness and Approximation Algorithms

CS Algorithms and Complexity

Chapter Finding parse trees

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

Computational Complexity

CSCI3390-Lecture 14: The class NP

Models of Computation

Algorithms. Grad Refresher Course 2011 University of British Columbia. Ron Maharik

Algorithm Design and Analysis

1. Introduction Recap

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

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

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CS Fall 2011 P and NP Carola Wenk

Theoretical computer science: Turing machines

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

Travelling Salesman Problem

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

Notes for Lecture 21

Graph Theory and Optimization Computational Complexity (in brief)

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

CS 6505, Complexity and Algorithms Week 7: NP Completeness

Computational Intractability 2010/4/15. Lecture 2

Lecture 15 - NP Completeness 1

CSE 105 THEORY OF COMPUTATION

CMSC 441: Algorithms. NP Completeness

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

Check off these skills when you feel that you have mastered them. Write in your own words the definition of a Hamiltonian circuit.

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

Warm-up Find the shortest trip (total distance) starting and ending in Chicago and visiting each other city once.

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

Lecture 24: How to become Famous with P and NP

Problem Complexity Classes

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

NP-completeness. Chapter 34. Sergey Bereg

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

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

July 18, Approximation Algorithms (Travelling Salesman Problem)

NP-Complete problems

CSE 105 THEORY OF COMPUTATION

BBM402-Lecture 11: The Class NP

NP and Computational Intractability

CSC 1700 Analysis of Algorithms: P and NP Problems

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

The Traveling Salesman Problem: An Overview. David P. Williamson, Cornell University Ebay Research January 21, 2014

Algorithm Design and Analysis

Computational complexity theory

Data Structures and Algorithms

1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)).

Turing Machines and Time Complexity

Transcription:

Nondeterministic Polynomial Time 11/1/2016 Discrete Structures (CS 173) Fall 2016 Gul Agha Slides based on Derek Hoiem, University of Illinois 1

2016 CS Alumni Awards Sohaib Abbasi (BS 78, MS 80), Chairman & CEO (retired) of Informatica, speaks of the history of Illinois CS alums https://youtu.be/3evts8tki18 2

This class Multiplying large numbers (review) Algorithmic complexity P vs. NP 3

Example: multiplying large numbers Multiplying small numbers in binary 101 011 Complexity: Multiplying large numbers 2 2 2 2 2 2 Complexity: 4

Example: multiplying large numbers Multiplying large numbers 2 2 2 2 2 2 Trick by Anatolii Karatsuba Complexity: 5

P vs. NP A problem is class P if a polynomial time solution exists A problem is class NP (non deterministic polynomial time) if a solution can be checked in polynomial time, but no known algorithm can generate the solution in polynomial time 6

Examples Boolean satisfiability: Determine if any assignment of boolean variables can satisfy a set of logical expressions E.g., is a 3 SAT problem 7

Boolean Satisfiability How fast can you find a solution to 3 SAT? How fast can you check a solution to 3 SAT? NP: finding solution takes exponential time, but checking solution is polynomial 8

Examples Sorting a set of integers.. How fast can you find a solution? P: sorting takes linearithmic time How fast can you check a solution? Checking takes linear time 9

Examples (1) Determining if a graph of size is colorable brute force search 2 algorithm exists, for any (2) Determining the chromatic number of a graph. (1) is in NP, can be checked quickly. It is NP complete. (2) is in NP hard (not necessarily in NP) 10

P = NP? If a problem can be checked efficiently (class P), then can we solve it efficiently? Yes: No: Introduced by Stephen Cook in 1971 Notion of NP complete introduced in the same paper Proof is worth $1,000,000 (Millenium Prize Problem) 11

Problem Reduction Problem P can be reduced to Problem Q if we can transform an instance of P into an instance of Q. Thus: Given an algorithm for Q, we can use it to find an algorithm for P Problem P can be reduced to Problem Q in polynomial time if we can transform an instance of P into an instance of Q in polynomial time Q is at least as hard as P 12

Example Problem Reduction We can reduce the problem of multiplication to the problem of squaring assuming we have addition, subtraction and division operations using the formula: 13

NP complete and NP hard Any NP problem can be reduced in polynomial time to an NP complete problem Example: satisfiability If any NP complete problem can be solved in polynomial time, then all NP problems can be solved in polynomial time A problem is NP hard if an NP complete problem can be reduced to it If then no NP complete algorithm can be solved in polynomial time 14

Wikidpedia diagram 1. Everything inside the circle is in NP. 2. All NP problems can be reduced an NP-Complete problem in polynomial time. 3. A problem is NP-Hard if an NP problem can be reduced to it. An NP-Hard problem may or may not be in NP. 15

Examples Traveling salesman problem: determine an order of cities to visit that minimizes total travel time without visiting the same city twice. mathworld.wolfram.com Find the most efficient (with the least weight) Hamiltonian cycle (circuit) through a graph 16

Traveling Salesman Brute force: branch on all 1!/2 possibilities. Example: 8, 7! / 2 = 360 combinations. Branch and Bound: use best known solution thus far to prune the search (bound). By Saurabh.harsh - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=23385823 Traveling Salesman Problem (TSP) is NP Hard 17

Traveling Salesman Problem variants Is their a tour covering all the cities whose cost is less than a given bound. This problem is in NP: A solution can be checked in nondeterministic polynomial time: 1. just walk through the tour and add the cost as you go. 2. At the end check if every city is covered and that the total cost is less than the bound. (Occassionally, some textbooks call this problem TSP) 18

How large is (Trapezoid rule) Stirling s Formula: 19

Exact TSP solutions 1998: A tour of 13,509 US cities (population > 500). There are 19,358 US cities and towns according the Census Bureau). 2004: A tour of 24,978 cities in Sweden. 2006: Hamiltonian circuit 85,900 locations in a VLSI circuit were solved. 20

NP Complete Problems Some NPcomplete problems and typical reductions Reductions are transitive TSP is NP hard Wikipedia 21

Alternatives to Exact Solutions Heuristics: e.g. Monte Carlo Methods Approximations. TSP in planar graphs is still NP hard Can find approximations (in this case, twice the length) http://courses.csail.mit.edu/6.889/fall11/lectures/l15.html 22

Other NP complete examples Lemmings Candy Crush Saga Battleship Set cover 23

Things to remember Be able to analyze code for computational cost Tools: finding loops and recursive calls, using recursion trees Sometimes need to know inner workings of a library to determine (e.g., factorialseries) Be able to convert to big O or big Theta and be familiar with basic complexity terms E.g., linear, nlogn, polynomial, exponential Problems in NP can be checked in polynomial time but probably not solved in polynomial time P=NP is open problem, most think not 24