Lecture 7: NP-Complete Problems



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

Chapter. NP-Completeness. Contents

CSC 373: Algorithm Design and Analysis Lecture 16

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

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

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

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

OHJ-2306 Introduction to Theoretical Computer Science, Fall

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

Introduction to Logic in Computer Science: Autumn 2006

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

Tutorial 8. NP-Complete Problems

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

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

On the Relationship between Classes P and NP

A Working Knowledge of Computational Complexity for an Optimizer

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

Theoretical Computer Science (Bridging Course) Complexity

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

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

Lecture 30: NP-Hard Problems [Fa 14]

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

Generating models of a matched formula with a polynomial delay

CAD Algorithms. P and NP

The Classes P and NP

Cloud Computing is NP-Complete

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

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

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

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

P versus NP, and More

CMPSCI611: Approximating MAX-CUT Lecture 20

Exponential time algorithms for graph coloring

NP-Completeness and Cook s Theorem

Problem Set 7 Solutions

Tetris is Hard: An Introduction to P vs NP

Analysis of Algorithms, I

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

Guessing Game: NP-Complete?

Applied Algorithm Design Lecture 5

Complexity Classes P and NP

Algorithm Design and Analysis

ON THE COMPLEXITY OF THE GAME OF SET.

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

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

Lecture 1: Course overview, circuits, and formulas

Lecture 1: Oracle Turing Machines

Introduction to computer science

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

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

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

Some Minesweeper Configurations

Approximation Algorithms

(67902) Topics in Theory and Complexity Nov 2, Lecture 7

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

Boulder Dash is NP hard

Classification - Examples

Notes on Complexity Theory Last updated: August, Lecture 1

How to Prove a Theorem So No One Else Can Claim It

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

School Timetabling in Theory and Practice

2.1 Complexity Classes

Notes on Complexity Theory Last updated: August, Lecture 1

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

On the Unique Games Conjecture

Fairness in Routing and Load Balancing

Lecture Notes on Polynomials

Euler Paths and Euler Circuits

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

Notes on NP Completeness

Nan Kong, Andrew J. Schaefer. Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA

The Approximability of the Binary Paintshop Problem

Satisfiability Checking

Quantum and Non-deterministic computers facing NP-completeness

Updating Action Domain Descriptions

The Basics of Graphical Models

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

Class One: Degree Sequences

Ian Stewart on Minesweeper

CNFSAT: Predictive Models, Dimensional Reduction, and Phase Transition

Offline 1-Minesweeper is NP-complete

Bounded-width QBF is PSPACE-complete

Max Flow, Min Cut, and Matchings (Solution)

Data Structures and Algorithms Written Examination

ARTICLE IN PRESS. European Journal of Operational Research xxx (2004) xxx xxx. Discrete Optimization. Nan Kong, Andrew J.

Transportation Polytopes: a Twenty year Update

Lecture 16 : Relations and Functions DRAFT

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Near Optimal Solutions

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

Discrete Mathematics Problems

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Computational complexity theory

Transcription:

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit Satisfiability The circuit satisfiability problem (CIRCUIT-SAT) is the circuit analogue of SAT. Given a Boolean circuit C, is there an assignment to the variables that causes the circuit to output 1? Theorem 1 CIRCUIT-SAT is NP-complete. Proof It is clear that CIRCUIT-SAT is in NP since a nondeterministic machine can guess an assignment and then evaluate the circuit in polynomial time. Now suppose that A is a language in NP. Recall from Lecture 3 that A has a polynomial-time verifier, an algorithm V with the property that x A if and only if V accepts x, y for some y. In addition, from Lecture 5, we know that there is a polynomial-size circuit C equivalent to V. The input of C is the entire input of V, i.e., both x and y. And C can be constructed in polynomial time given the length of x and y. The reduction from A to CIRCUIT-SAT operates as follows: given an input x, output a description of the circuit C(x, y) with the x variables set to the given values and the y variables left as variables. The resulting circuit is satisfiable if and only x A. And the reduction can be computed in polynomial time because of the uniformity of C. Theorem 2 SAT is NP-complete. Proof It is clear that SAT is in NP: guess an assignment an evaluate the formula as if it was a circuit. To show that SAT is NP-complete we reduce CIRCUIT-SAT to SAT. 1

Let C be a circuit. We construct a formula whose variables are the variables of the circuit plus one new variable for each gate of the circuit. These new variables are interpreted as the value of the corresponding gates. The formula will express the fact that the circuit works properly. For example, if a NOT gate h has gate g input, that NOT gate works correctly if (g h) (g h). If an AND gate h has gates g 1 and g 2 as inputs, that AND gate works correctly if (g 1 g 2 h) (g 1 g 2 h) (g 1 g 2 h) (g 1 g 2 h). The formula corresponding to the entire circuit is the conjunction of all these formulas, for every gate, and the formula g where g is the output gate. It should be clear that C is satisfiable if and only if this formula is satisfiable. It is also easy to see that the formula can be constructed in polynomial time. The NP-completeness of 3SAT can be established by a simple modification of the previous proof. Corollary 3 3SAT is NP-complete. The NP-completeness of CLIQUE then follows from an earlier reduction. Corollary 4 CLIQUE is NP-complete. 2. Vertex Cover A vertex cover of an undirected graph is a subset of the nodes such that every edge in the graph is adjacent to one of these nodes. The set of all nodes of a graph always constitutes a vertex cover and some graphs have vertex covers of size 1. The VERTEX-COVER problem is to determine, given a graph G and a number k, whether G has a vertex cover of size k. Theorem 5 VERTEX-COVER is NP-complete. Proof VERTEX-COVER is clearly in NP. We now reduce 3SAT to VERTEX- COVER. Consider a 3CNF formula with n variables and c clauses. For each variable x, we will have two nodes labeled x and x and connected by an edge. Each such group of 2

two nodes plus an edge is called a variable gadget. For each clause (x y z), we will have a clause gadget that consists of three nodes labeled x, y and z and connected to each other by three edges. The graph corresponding to the 3CNF formula consists of all these gadgets plus an edge between any two nodes that have the same label. It is clear that this graph can be constructed in polynomial time. We claim that the formula is satisfiable if and only if the graph has a vertex cover of size n + 2c. (Details can be found in Sipser s textbook.) 3. Subset Sum Given a list of numbers and a number k, is there a subset of the numbers that adds to exactly k? For example, the answer is yes for (3, 4, 12, 7, 4), 20 and no for (3, 4, 12, 7, 4), 6. This is called the SUBSET-SUM problem. In a exercise, we already showed that the problem is in P if all the numbers are given in unary. Here we show that the problem is NP-complete if the numbers are given in the usual binary notation. Theorem 6 SUBSET-SUM is NP-complete. Proof Once again, it clear that the problem is in NP. We reduce 3SAT to SUBSET- SUM. Consider a 3CNF formula with variables x 1,..., x n and clauses c 1,..., c r. For each variable x i, we will have two numbers y i and z i in the list. For each clause c j, we will also have two numbers s j and t j. We define all of these numbers by specifying their base 10 representations. The construction is best explained by an example and a picture. If the formula is (x 1 x 2 x 3 ) (x 1 x 2 x 3 ), 3

then the base 10 representations of the numbers will look like this: x 1 x 2 x 3 c 1 c 2 y 1 1 0 0 1 0 z 1 1 0 0 0 1 y 2 0 1 0 1 1 z 2 0 1 0 0 0 y 3 0 0 1 0 0 z 3 0 0 1 1 1 s 1 0 0 0 1 0 t 1 0 0 0 1 0 s 2 0 0 0 0 1 t 2 0 0 0 0 1 k 1 1 1 3 3 The number y i corresponds to the positive occurrences of x i in the formula while the number z i corresponds to its negative occurrences. It should be clear how to generalize this construction to an arbitrary 3CNF formula. And the list of numbers can clearly be constructed in polynomial time. We claim that a subset of these numbers adds to exactly k if and only if the formula is satisfiable. A key point is that the sum of the numbers can be done column by column, independently, because carries will never occur. (Details can be found in Sipser s textbook.) 4. Exercises 1. Give a direct reduction of SAT to CIRCUIT-SAT. 2. Give direct reductions of CLIQUE to VERTEX-COVER, and vice-versa. (Hint: There is a reduction that works in both directions.) 3. Consider the following BIN-PACKING problem: given a collection of objects each with a positive integer size and a collection bins each with a positive integer capacity, is there a way to put all the objects into the bins so that the capacity of no bin is exceeded? Show that SUBSET-SUM reduces to BIN-PACKING. 4. Show that 3-colorability is NP-complete. (Hint: See the hint for Exercise 7.34 in Sipser s textbook.) 4

5. Show that if P = NP, then there is a polynomial-time algorithm that given a Boolean formula determines if the formula is satisfiable and finds a satisfying assignment, if one exists. 6. 2SAT is defined exactly like 3SAT but for clauses with two literals. Show that 2SAT is in P. 5