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

Similar documents
Chapter 34: NP-Completeness

NP-completeness. Chapter 34. Sergey Bereg

NP-Complete problems

1. Introduction Recap

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

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

VIII. NP-completeness

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

NP-Complete Reductions 1

CS 583: Algorithms. NP Completeness Ch 34. Intractability

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

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

CMPT307: Complexity Classes: P and N P Week 13-1

Introduction. Pvs.NPExample

Computational Intractability 2010/4/15. Lecture 2

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

Automata Theory CS Complexity Theory I: Polynomial Time

ECS122A Handout on NP-Completeness March 12, 2018

Geometric Steiner Trees

BBM402-Lecture 11: The Class NP

NP and Computational Intractability

NP-Complete Problems. More reductions

Design and Analysis of Algorithms

NP and Computational Intractability

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

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

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

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

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

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

NP-Complete Reductions 2

Lecture 4: NP and computational intractability

CMSC 441: Algorithms. NP Completeness

NP and NP-Completeness

SAT, Coloring, Hamiltonian Cycle, TSP

NP-Completeness. Subhash Suri. May 15, 2018

Polynomial-time reductions. We have seen several reductions:

Combinatorial Optimization

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

NP Complete Problems. COMP 215 Lecture 20

1.1 P, NP, and NP-complete

Essential facts about NP-completeness:

Introduction to Complexity Theory

NP-Complete Problems and Approximation Algorithms

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

CS Fall 2011 P and NP Carola Wenk

NP-Completeness. NP-Completeness 1

COP 4531 Complexity & Analysis of Data Structures & Algorithms

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

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

NP-problems continued

Notes for Lecture 21

Complexity, P and NP

Algorithm Design and Analysis

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

CS/COE

CS154, Lecture 13: P vs NP

NP-problems continued

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

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

Formal definition of P

Lecture 15 - NP Completeness 1

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

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

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

CS154, Lecture 13: P vs NP

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

Algorithms Design & Analysis. Approximation Algorithm

Algorithm Design and Analysis

Limitations of Algorithm Power

Polynomial-Time Reductions

NP-Completeness. NP-Completeness 1

Chapter 2 : Time complexity

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

Spring Lecture 21 NP-Complete Problems

Intro to Theory of Computation

More NP-Complete Problems

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

8.3 Hamiltonian Paths and Circuits

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

3130CIT Theory of Computation

4. How to prove a problem is NPC

Topics in Complexity Theory

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

8.5 Sequencing Problems

NP Completeness and Approximation Algorithms

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

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

COMP 382. Unit 10: NP-Completeness

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

NP Completeness. Richard Karp, 1972.

Polynomial-time Reductions

Algorithms: COMP3121/3821/9101/9801

SAT, NP, NP-Completeness

Correctness of Dijkstra s algorithm

Travelling Salesman Problem

Lecture 13, Fall 04/05

Transcription:

NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1

NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320 NP 2

P & NP Often a problem can have a Polynomial time solution and a similar one may not: P: Find a single source shortest path NP: Does a graph contain a simple path with at least k edges? 320 NP 3

P & NP Another example: P: Find an Euler tour a cycle that traverses each edge once (can visit vertices more than once) NP: Does a graph have a Hamiltonian cycle? a simple cycle containing every vertex 320 NP 4

Examples of P & NP Finally: Is a 2 CNF satisfiable? (x1 x2) ^ ( x1 x3) ^ ( x2 x3) Is a 3 CNF satisfiable? (x1 : x1 x2) ^ (x3 x2 x4) ^ ( x1 _ x3 x4) 320 NP 5

Problem Classes P solvable in polynomial time NP verifiable in polynomial time NPC (NP complete) in NP and as hard as any problem in NP If a problem is NP complete then there is good evidence that it is intractable. 320 NP 6

Showing a problem is NPC 1. Convert an optimization problem into a related decision problem. 2. Reduce one problem to another to show that it is no harder or easier. NP 320 NP 7

Diversion Reduction Where have we seen reduction before? Cole gave an example the Friday before break manipulating a new problem into a format where we can solve it with an algorithm we already know. 320 NP 8

Reducibility Uses a framework of formal language: A language L over an alphabet is any set of strings made up of symbols from. We can perform set operations (e.g. membership testing) on languages. Notation: language L reduces to language L: L p L 320 NP 13

Problem Language Example PATH: decision problem given a directed graph G, vertices u and v, and an integer k, does a path exist from u to v k? Problem as a language over the alphabet {0, 1}: PATH = { G, u, v, k where G = (V, E) is an undirected graph, u, v V, k 0 is an integer, decision is whether path from u to v in G consisting of at most k edges} 320 NP 14

Algorithms An algorithm A accepts the set of strings in L for which it returns 1, and rejects the set of strings for which it returns 0. Verification algorithm A: 2 arguments: input string and certificate Input string: x = G, u, v, k Certificate: y = path p from u to v A (x, y) = 1 if y is in G and is of length k 320 NP 15

Verification as a language PATH verification algorithm verifies language L = {x {0, 1}* : A(x, y) = 1} NP: A language L NP iff L = {x {0, 1}* : a certificate y with y = O( x c ) such that A(x, y) = 1} Algorithm A verifies language L in polynomial time 320 NP 16

Definition of NP complete A language L {0, 1}* is NP complete if 1. L NP 2. L p L for every L NP A language L is NP hard if #2 is satisfied, and #1 may not be satisfied All proofs have these 2 parts. Many start with #2, showing that a problem is NP hard first, then going on to show #1. 320 NP 17

Need an initial NP problem! Circuit Satisfiability: Given a Boolean combinational circuit of AND, OR, and NOT gates, is it satisfiable? Circuit size is # gates + # wires. Encode as binary string of a mapping to a graph 320 NP 18

Circuit satisfiability as NP Language CIRCUIT SAT = { C : C is a satisfiable Boolean combinational circuit} #1: L NP Construct polynomial time verification algorithm A(x, y) where x = encoded C, y = assignments of Boolean values to the wires in C 320 NP 19

Circuit satisfiability reducibility Language CIRCUIT SAT = { C : C is a satisfiable Boolean combinational circuit} #2: L is NP hard Show that every language in NP is reducible in polynomial time to CIRCUIT SAT 320 NP 20

Circuit satisfiability reducibility Every L NP has a verification algorithm A that takes an input x and certificate y and outputs a decision A is a sequence of program configurations that can all be computed by a single combinational circuit Creating the circuit can be done in polynomial time. 320 NP 21

NPC Circuit satisfiability is NP complete Formula satisfiability (SAT): is a given Boolean formula satisfiable? #1: SAT NP we can create a polynomial algorithm A to test a certificate #2: CIRCUIT SAT p SAT 3 CNF satisfiability: is a Boolean formula in 3 CNF satisfiable? #1: 3 CNF SAT NP we can create a polynomial algorithm A to test a certificate #2: SAT p 3 CNF SAT 320 NP 22

Finally to the examples in the book Clique: Undirected graph G Subset of vertices where each pair is connected (complete subgraph of G) Social networks: subset of people who all know each other NP complete: #1 CLIQUE NP #2: 3 CNF SAT p CLIQUE 320 NP 23

More book examples Vertex Cover: Undirected graph G Subset of vertices that have all the edges in the graph as incident edges NP complete: #1 VERTEX COVER NP #2: CLIQUE p VERTEX COVER 320 NP 24

More book examples Hamiltonian Cycle: Undirected graph G Simple cycle containing every vertex NP complete: #1 HAM CYCLE NP #2: VERTEX COVER p HAM CYCLE 320 NP 25

More book examples Traveling Salesman: Undirected graph G Simple cycle containing every vertex NP complete: #1 TSP NP #2: HAM CYCLE p TSP 320 NP 26

And finally Subset Sum: Finite set S of positive integers, integer target t > 0 S S where the elements sum to t? NP complete: #1 SUBSET SUM NP #2: 3 CNF SAT p SUBSET SUM 320 NP 27

CIRCUIT SAT Reductions CLIQUE SAT 3 CNF SAT SUBSET SUM VERTEX COVER HAM CYCLE TSP 320 NP 28

Image Credits np.gif, cirsat.gif, clique.gif, vert cover.giv: http://ramos.elo.utfsm.cl/~lsb/elo320/aplicaciones/aplicaciones/cs460algorithmsandcomplexity/lecture25/comp460%20algorithms%20an d%20complexity%20lecture%2025.htm hamtour.jpg: https://ubpdqnmathematica.wordpress.com/2011/04/09/euler and hamilton knight adventure/ penguins.png: http://www.cgl.uwaterloo.ca/csk/projects/tsp/ subsetsum.png, pulsars.gif: https://thquinn.github.io/projects/automaton.html 320 NP 29