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



Similar documents
NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

Tutorial 8. NP-Complete Problems

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Lecture 7: NP-Complete Problems

CSC 373: Algorithm Design and Analysis Lecture 16

Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

A Working Knowledge of Computational Complexity for an Optimizer

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

P versus NP, and More

Theoretical Computer Science (Bridging Course) Complexity

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

OHJ-2306 Introduction to Theoretical Computer Science, Fall

CMPSCI611: Approximating MAX-CUT Lecture 20

Introduction to Logic in Computer Science: Autumn 2006

Computational complexity theory

Tetris is Hard: An Introduction to P vs NP

On the Relationship between Classes P and NP

CoNP and Function Problems

Complexity Classes P and NP

Chapter. NP-Completeness. Contents

Introduction to Algorithms. Part 3: P, NP Hard Problems

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

Why Study NP- hardness. NP Hardness/Completeness Overview. P and NP. Scaling 9/3/13. Ron Parr CPS 570. NP hardness is not an AI topic

Introduction to computer science

Lecture 19: Introduction to NP-Completeness Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

NP-completeness and the real world. NP completeness. NP-completeness and the real world (2) NP-completeness and the real world

CAD Algorithms. P and NP

One last point: we started off this book by introducing another famously hard search problem:

! X is a set of strings. ! Instance: string s. ! Algorithm A solves problem X: A(s) = yes iff s! X.

Lecture 30: NP-Hard Problems [Fa 14]

The Classes P and NP. mohamed@elwakil.net

Chapter 1. NP Completeness I Introduction. By Sariel Har-Peled, December 30, Version: 1.05

Discuss the size of the instance for the minimum spanning tree problem.

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Problem Set 7 Solutions

Fundamentals of algorithms

Algorithm Design and Analysis

Applied Algorithm Design Lecture 5

8.1 Min Degree Spanning Tree

Cloud Computing is NP-Complete

NP-Completeness and Cook s Theorem

CS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin

Euler Paths and Euler Circuits

Million Dollar Mathematics!

Quantum Monte Carlo and the negative sign problem

Notes on NP Completeness

Guessing Game: NP-Complete?

Approximated Distributed Minimum Vertex Cover Algorithms for Bounded Degree Graphs

Quantum and Non-deterministic computers facing NP-completeness

CHOOSING THE BEST HEURISTIC FOR A NP-PROBLEM

Universality in the theory of algorithms and computer science

Offline 1-Minesweeper is NP-complete

THE PROBLEM WORMS (1) WORMS (2) THE PROBLEM OF WORM PROPAGATION/PREVENTION THE MINIMUM VERTEX COVER PROBLEM

The Classes P and NP

SOLVING NARROW-INTERVAL LINEAR EQUATION SYSTEMS IS NP-HARD PATRICK THOR KAHL. Department of Computer Science

Ian Stewart on Minesweeper

Cycle transversals in bounded degree graphs

Small Maximal Independent Sets and Faster Exact Graph Coloring

Mathematics for Algorithm and System Analysis

V. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

Graph Theory Problems and Solutions

5.1 Bipartite Matching

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Boulder Dash is NP hard

Classification - Examples

11. APPROXIMATION ALGORITHMS

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

1 Definitions. Supplementary Material for: Digraphs. Concept graphs

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

The P versus NP Solution

Can linear programs solve NP-hard problems?

On the k-path cover problem for cacti

Near Optimal Solutions

Single machine parallel batch scheduling with unbounded capacity

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

Exact Polynomial-time Algorithm for the Clique Problem and P = NP for Clique Problem

Exponential time algorithms for graph coloring

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

On the Unique Games Conjecture

Midterm Practice Problems

Cycles and clique-minors in expanders

Introduction to NP-Completeness Written and copyright c by Jie Wang 1

Discrete Mathematics Problems

Generalized Induced Factor Problems

Approximation Algorithms

Chapter 6: Graph Theory

Computational Game Theory and Clustering

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 NP-Complete Does P = NP? 6

NP Problems Non-deterministic Polynomial-time (NP) problems are decidable, but can 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 E.g., Check if tour visits each vertex once and sum of edge costs K 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? x ( y z)? x y x? 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 SAT: Is there an assignment of variables that makes a Boolean formula true? Clique Clique: Is there a completely-connected subgraph with K vertices in graph G? (max K?) Vertex Cover Vertex-Cover: Is there a set of K vertices in a graph such that every edge is connected to one of these K vertices? (min K?) Ham-Cycle: Is there a simple cycle in a graph that visits every vertex? Hamiltonian Cycle TSP: Is there a simple cycle in a graph that visits every vertex whose path cost is K? (min K?) 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 Garey & Johnson, Computers and Intractability, 1971. 17