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

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

VIII. NP-completeness

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

1. Introduction Recap

Limitations of Algorithm Power

Data Structures in Java

NP-Complete Problems. More reductions

NP-Complete problems

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

CS/COE

Design and Analysis of Algorithms

NP-Completeness. NP-Completeness 1

Chapter 34: NP-Completeness

NP-Complete Reductions 1

NP Complete Problems. COMP 215 Lecture 20

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

Polynomial-time reductions. We have seen several reductions:

ECS122A Handout on NP-Completeness March 12, 2018

CMSC 441: Algorithms. NP Completeness

NP-completeness. Chapter 34. Sergey Bereg

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Correctness of Dijkstra s algorithm

NP and Computational Intractability

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

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

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

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

Computational Complexity

Analysis of Algorithms. Unit 5 - Intractable Problems

Complexity, P and NP

Lecture 4: NP and computational intractability

Computational Complexity

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

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

Tractable & Intractable Problems

NP Completeness and Approximation Algorithms

Spring Lecture 21 NP-Complete Problems

Introduction. Pvs.NPExample

P,NP, NP-Hard and NP-Complete

Algorithms Design & Analysis. Approximation Algorithm

Introduction to Complexity Theory

Lecture 24: How to become Famous with P and NP

8.3 Hamiltonian Paths and Circuits

Polynomial-Time Reductions

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples

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

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

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

NP-Complete Reductions 2

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

Computational Intractability 2010/4/15. Lecture 2

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

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

NP-problems continued

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

Computational Complexity

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

COP 4531 Complexity & Analysis of Data Structures & Algorithms

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

CSC 1700 Analysis of Algorithms: P and NP Problems

CS 241 Analysis of Algorithms

Formal definition of P

CS 6505, Complexity and Algorithms Week 7: NP Completeness

Automata Theory CS Complexity Theory I: Polynomial Time

NP-Complete Problems and Approximation Algorithms

CS Fall 2011 P and NP Carola Wenk

Topics in Complexity Theory

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

Computational Complexity

Computational complexity theory

COMP Analysis of Algorithms & Data Structures

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

Graph Theory and Optimization Computational Complexity (in brief)

Polynomial-time Reductions

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

1 Primals and Duals: Zero Sum Games

NP-Completeness. Subhash Suri. May 15, 2018

Circuits. CSE 373 Data Structures

Nondeterministic Polynomial Time

SAT, Coloring, Hamiltonian Cycle, TSP

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

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

Data Structures and Algorithms (CSCI 340)

Lecture 19: Finish NP-Completeness, conp and Friends

Instructor N.Sadagopan Scribe: P.Renjith

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

Algorithms: COMP3121/3821/9101/9801

Computational complexity theory

Turing Machines and Time Complexity

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

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

Approximation Algorithms

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

CSE 548: (Design and) Analysis of Algorithms

CS 350 Algorithms and Complexity

Comparison of several polynomial and exponential time complexity functions. Size n

Transcription:

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

Hard Graph Problems Hard means no known solutions with better than exponential worst-case running time Find a simple path that traverses each edge once (Euler circuit): Easy Find a simple path that visits each vertex once (Hamiltonian cycle): Hard Single-source, unweighted shortest path problem: Easy Longest simple path problem: Hard Find simple, shortest path in a weighted graph that visits every vertex once (Traveling Salesman Problem): Hard 2

Running Times for Hard Problems Input Size vs. Complexity 10 20 30 40 50 60 n.00001 s.00002 s.00003 s.00004 s.00005 s.00006 s n 2.0001 s.0004 s.0009 s.0016 s.0025 s.0036 s n 3.001 s.008 s.027 s.064 s.125 s.216 s n 5.1 s 3.2 s 24.3 s 1.7 min 5.2 min 13.0 min 2 n.001 s 1.0 s 17.9 min 12.7 days 35.7 years 366 centuries 3 n.059 s 58 min 6.5 years 3855 centuries 2x10 8 centuries 1.3 x 10 13 centuries 3

Hard Problems These hard problems belong to a class of problems that all have the same level of complexity Called NP-Complete problems Whether any of these problems can be solved in polynomial time is one of the biggest open questions in computer science Either all of these problems have polynomialtime solutions, or none of them do 4

Hard-est Problems Some problems are impossible to solve with today s computers Called undecidable problems E.g., the halting problem Can we write a program that will determine if another program will terminate? Answer: No 5

Classes of Hard Problems All Problems P NP NP-Hard Difficulty Does P = NP? NP-Complete 6

NP Problems Non-deterministic Polynomial-time (NP) problems are decidable, but take a long time to solve Non-deterministic problems offer choices to the computer at each step of the solution E.g., foreach edge in my graph, should I include it in the TSP tour or not? E binary choices, 2 E solutions 7

NP Problems Another way to look at it Decision problem Turn the problem into a yes/no problem E.g., Is there a TSP tour with cost < K? If a solution to a decision problem can be verified in polynomial time, then that problem is in the class NP 8

NP-Complete Problems Hardest problems in NP All problems in NP can be reduced to an NP-Complete problem Reduced to means NP problem can be converted into a NPC problem in polynomial-time Solution to NPC problem can be converted back into a solution to the NP problem 9

NP-Complete Problems Example: Traveling Salesman Problem Given complete, weighted graph G=(V,E) and integer K, is there a simple cycle that visits all vertices with total cost K? Is TSP in NP? Yes Given a path, we can verify (in polynomial time) if it visits all vertices and has cost K Is TSP NP-Complete? Need to reduce a known NP-Complete problem to TSP 10

NP-Complete Problems If we check NP-Completeness by reducing from a known NP-Complete problem, then how do we start? In 1971 Stephen Cook proved that the Boolean satisfiability (SAT) problem was NP-Complete using an argument from how computers work (not via reduction) SAT: Does a Boolean formula have a setting for variables that makes it true? x1 or (not x1 and x2) Historical note: Cook was denied tenure at UC Berkeley in 1970, then moved to U. Toronto (still there). 11

NP-Complete Problems SAT reduces to Clique Vertex Cover Hamiltonian Cycle Traveling Salesman 12

Is TSP NP-Complete? Assuming Hamiltonian Cycle is NP-Complete, reduce Ham-Cycle to TSP Given Ham-Cycle input graph G=(V,E) Create complete, weighted graph G =(V,E ) Each edge in E is in E with weight of 1 Each edge not in E is in E with weight of 2 Solve TSP with K = V If such a TSP tour exists in G, the same tour is a Hamiltonian Cycle in G 13

Reduction of Ham-Cycle to TSP G G 14

NP-Complete Problems Thus, TSP is NP-Complete TSP is in NP (polynomial-time verifiable) All problems in NP can be reduced to TSP I.e., All problems in NP can be reduced to a problem in NP (Ham-Cycle) that can be reduced to TSP List of NP-Complete problems http://en.wikipedia.org/wiki/list_of_npcomplete_problems 15

Fun with NP-Completeness 16

Summary Classes of problems helps us understand their relative difficulty P, NP, NP-Complete, NP-Hard, Most think P NP, but still unproven 17