Polynomial-time reductions. We have seen several reductions:

Similar documents
1. Introduction Recap

Polynomial-time Reductions

Design and Analysis of Algorithms

NP Complete Problems. COMP 215 Lecture 20

CMSC 441: Algorithms. NP Completeness

NP-Completeness. NP-Completeness 1

SAT, Coloring, Hamiltonian Cycle, TSP

Computational Complexity

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

CS 583: Algorithms. NP Completeness Ch 34. Intractability

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

NP-Complete Reductions 1

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

Essential facts about NP-completeness:

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

Limitations of Algorithm Power

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

CSC 1700 Analysis of Algorithms: P and NP Problems

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

NP-Complete Problems. More reductions

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

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

Algorithms Design & Analysis. Approximation Algorithm

CS21 Decidability and Tractability

Correctness of Dijkstra s algorithm

NP Completeness and Approximation Algorithms

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

NP-completeness. Chapter 34. Sergey Bereg

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

Introduction to Computational Complexity

Chapter 34: NP-Completeness

Theory of Computation Chapter 9

Introduction to Complexity Theory

NP-Complete Reductions 2

BBM402-Lecture 11: The Class NP

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

Lecture 4: NP and computational intractability

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

Complexity, P and NP

Lecture 18: More NP-Complete Problems

Reductions. Example 1

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

Intro to Theory of Computation

Computational Complexity

COP 4531 Complexity & Analysis of Data Structures & Algorithms

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

Lecture 19: Finish NP-Completeness, conp and Friends

Topics in Complexity Theory

Exercises NP-completeness

Spring Lecture 21 NP-Complete Problems

Computational Complexity

Polynomial-Time Reductions

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

Lecture 13, Fall 04/05

ECS122A Handout on NP-Completeness March 12, 2018

CS 350 Algorithms and Complexity

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

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

1 Non-deterministic Turing Machine

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

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

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

Notes for Lecture 21

Lecture 15 - NP Completeness 1

NP-problems continued

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

Approximation Algorithms

Computational Intractability 2010/4/15. Lecture 2

INTRO TO COMPUTATIONAL COMPLEXITY

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP and NP Completeness

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

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

Algorithm Design and Analysis

3130CIT Theory of Computation

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

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

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

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.

Chapter 2 : Time complexity

CS 350 Algorithms and Complexity

Algorithm Design and Analysis

1.1 P, NP, and NP-complete

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16

SAT, NP, NP-Completeness

NP and Computational Intractability

Chapter 7: Time Complexity

IE418 Integer Programming

CSC 373: Algorithm Design and Analysis Lecture 15

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

NP and NP-Completeness

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

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

NP-Completeness Review

NP-Completeness. Sections 28.5, 28.6

CSE 421 NP-Completeness

Lecture Notes 4. Issued 8 March 2018

Transcription:

Polynomial-time reductions We have seen several reductions:

Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in polynomial-time. Can we use the black-box to solve Y in polynomial-time? If yes, we write Y P X and say that Y is polynomial-time reducible to X.

Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in polynomial-time. Can we use the black-box to solve Y in polynomial-time? If yes, we write Y P X and say that Y is polynomial-time reducible to X. More precisely, we take any input of Y and in polynomial number of steps translate it into an input (or a set of inputs) of X. Then we call the black-box for each of these inputs. Finally, using a polynomial number of steps we process the output information from the boxes to output the answer to problem Y.

Polynomial-time reductions Polynomial-time: what is it? Class of problems P: - Consider problems that have only YES/NO output - Every such problem can be formalized - e.g. encode the input into a sequence of 0/1 and the problem is defined as the union of all input sequences for the YES instances - Polynomial-time algorithm runs (on a Turing machine) in time polynomial in the length of the input, e.g. for an input of length n the algo takes (e.g.) O(n 4 ) steps to determine if this input is a YES instance

Polynomial-time reductions Example: Problem 1: CNF-SAT Given is a conjunctive normal form (CNF) expression such as: (x or y or z) and ((not x) or z or w) and and ((not w) or x) Question: Does there exist a satisfiable assignment?

Polynomial-time reductions Example: Problem 2: Clique Given is a graph G=(V,E) and number k. Question: Does there exist a clique of size k, i.e. a subset of vertices S of size k such that for every u,v in S, (u,v) is in E? G: k = 4

Polynomial-time reductions Example: Goal: show CNF-SAT P CLIQUE.

Polynomial-time reductions Example: Goal: show CNF-SAT P CLIQUE. (Given an instance of CNF-SAT, convert to an instance of CLIQUE so that (what?).)

Polynomial-time reductions Why reductions?

Polynomial-time reductions Why reductions? to solve our problem with not much work (using some already known algorithm) to say that some problems are harder than others

Class NP Class P YES/NO problems with a polynomial-time algorithm Class NP YES/NO problems with a polynomial-time checking algorithm more precisely, given a solution (e.g. a subset of vertices) we can check in a polynomial time if that solution is what we are looking for (e.g. is it a clique of size k?) Example: Show that CNF-SAT is in NP. What is the thing we want to check? How does the checking algorithm work in this case?

Class NP Class P YES/NO problems with a polynomial-time algorithm Class NP YES/NO problems with a polynomial-time checking algorithm more precisely, given a solution (e.g. a subset of vertices) we can check in a polynomial time if that solution is what we are looking for (e.g. is it a clique of size k?) Example: Show that CNF-SAT is in NP. Now consider CNF-UNSAT, the problem of unsatisfiable formulas (YES instances are the unsatisfiable formulas, not the satisfiable ones as in CNF-SAT). Is CNF-UNSAT in NP?

Class NP Class P YES/NO problems with a polynomial-time algorithm Class NP YES/NO problems with a polynomial-time checking algorithm more precisely, given a solution (e.g. a subset of vertices) we can check in a polynomial time if that solution is what we are looking for (e.g. is it a clique of size k?) In short: P find a solution in polynomial-time NP check a solution in polynomial-time

Class NP Class P YES/NO problems with a polynomial-time algorithm Class NP YES/NO problems with a polynomial-time checking algorithm more precisely, given a solution (e.g. a subset of vertices) we can check in a polynomial time if that solution is what we are looking for (e.g. is it a clique of size k?) In short: P find a solution in polynomial-time NP check a solution in polynomial-time BIG OPEN PROBLEM Is P = NP?

NP-complete and NP-hard NP-hard A problem is NP-hard if all other problems in NP can be polynomially reduced to it. NP-complete A problem is NP-complete if it is (a) in NP, and (b) NP-hard. In short: NP-complete: the most difficult problems in NP

NP-complete and NP-hard NP-hard A problem is NP-hard if all other problems in NP can be polynomially reduced to it. NP-complete A problem is NP-complete if it is (a) in NP, and (b) NP-hard. In short: NP-complete: the most difficult problems in NP Why study them? Find a polynomial-time algo for any NPcomplete problem, or prove that none exists. (Either way, no worry about job offers till the end of your life.)

NP-complete and NP-hard: how to prove Given: a problem Suspect: polynomial-time algorithm unlikely Want: prove that the problem is NP-hard or NP-complete (thus a polynomial-time algorithm VERY unlikely) How to prove this?

NP-complete and NP-hard: how to prove Given: a problem Suspect: polynomial-time algorithm unlikely Want: prove that the problem is NP-hard or NP-complete (thus a polynomial-time algorithm VERY unlikely) How to prove this? Thm (Cook-Levin): CNF-SAT is NP-hard.

NP-complete and NP-hard: how to prove Given: a problem Suspect: polynomial-time algorithm unlikely Want: prove that the problem is NP-hard or NP-complete (thus a polynomial-time algorithm VERY unlikely) How to prove this? Thm (Cook-Levin): CNF-SAT is NP-hard. We have already proved that CLIQUE is NP-hard. How come?

NP-complete and NP-hard: how to prove The recipe to prove NP-hardness of a problem X: 1. Find an already known NP-hard problem Y. 2. Show that Y P X. The recipe to prove NP-completeness of a problem X: 1. Show that Y is NP-hard. 2. Show that Y is in NP.

NP-complete and NP-hard: examples INDEPENDENT SET problem Input: A graph G=(V,E) and an integer k Output: Does there exist an independent set of size k, i.e. a subset of vertices S of size k such that for every u,v in S, (u,v) is not in E? G: k = 4

NP-complete and NP-hard: examples INDEPENDENT SET problem Input: A graph G=(V,E) and an integer k Output: Does there exist an independent set of size k, i.e. a subset of vertices S of size k such that for every u,v in S, (u,v) is not in E? Is INDEPENDENT SET problem NP-complete?

NP-complete and NP-hard: examples VERTEX COVER problem Input: A graph G=(V,E) and an integer k Output: Does there exist a subset of vertices S of size k such that every edge has at least one endpoint in S G: k = 5

NP-complete and NP-hard: examples VERTEX COVER problem Input: A graph G=(V,E) and an integer k Output: Does there exist a subset of vertices S of size k such that every edge has at least one endpoint in S Recall: CNF-SAT, CLIQUE, INDEPENDENT SET all NP-complete. We will show that INDEPENDENT SET P VERTEX COVER.

NP-complete and NP-hard: examples Lemma: INDEPENDENT SET P VERTEX COVER.

Other well-know NP-complete problems HAMILTONIAN CYCLE Input: A graph G Output: Is there a cycle going through every vertex (exactly once)?

Other well-know NP-complete problems TRAVELING SALESMAN PROBLEM (TSP) Input: A complete weighted graph G = (V,VxV) with weights w, a treshold number t Output: Is there a cycle going through every vertex (exactly once), with total weight of the cycle < t? G,w: t = 14 1 6 5 4 3 4

Other well-know NP-complete problems TRAVELING SALESMAN PROBLEM (TSP) Input: A complete weighted graph G = (V,VxV) with weights w, a treshold number t Output: Is there a cycle going through every vertex (exactly once), with total weight of the cycle < t? Is TSP NP-complete?

Other well-know NP-complete problems 3-COLORING Input: A graph G Output: Is it possible to color vertices of G by three colors so that no edge has its end-points colored by the same color?

Other well-know NP-complete problems Remarks about coloring problems: 2-COLORING is in P (what is the algorithm?) 3-COLORING is NP-complete how about 4-COLORING?

Other well-know NP-complete problems KNAPSACK (sometimes also disguised as problem named SUBSET-SUM) - we have O(nW) algorithm for KNAPSACK - but KNAPSACK is NP-complete -how come?

Decision vs. construction Suppose we have a black-box answering YES/NO for the 3-COLORING problem. Can we use it to find a 3-coloring?