Recap from Last Time

Similar documents
Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

NP-Completeness Part II

Recap from Last Time

NP-Completeness Part II

NP-Completeness Part II

Complexity Theory Part II

Complexity Theory Part One

SAT, NP, NP-Completeness

Friday Four Square! Today at 4:15PM, Outside Gates

NP-Completeness Part One

NP-Completeness Part I

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 Part One

Complexity Theory Part Two

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Complexity Theory Part I

NP and NP Completeness

Complexity Theory Part Two

CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9

NP-Completeness Part One

1. Introduction Recap

Topics in Complexity Theory

Approximation Algorithms

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

CSE 135: Introduction to Theory of Computation NP-completeness

P, NP, NP-Complete, and NPhard

ECS122A Handout on NP-Completeness March 12, 2018

Essential facts about NP-completeness:

Complexity Theory Part Two

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Complexity Theory Part Two

NP-Completeness and Boolean Satisfiability

NP-Completeness Part One

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Design and Analysis of Algorithms

1.1 P, NP, and NP-complete

NP Completeness and Approximation Algorithms

CSC 1700 Analysis of Algorithms: P and NP Problems

COMP Analysis of Algorithms & Data Structures

Intro to Theory of Computation

CS154, Lecture 13: P vs NP

NP-Complete problems

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

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

Topics in Complexity

CMSC 441: Algorithms. NP Completeness

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

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

Limitations of Algorithm Power

About the impossibility to prove P NP or P = NP and the pseudo-randomness in NP

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

On the Computational Hardness of Graph Coloring

Comp487/587 - Boolean Formulas

Geometric Steiner Trees

CS154, Lecture 13: P vs NP

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

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

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Correctness of Dijkstra s algorithm

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Spring Lecture 21 NP-Complete Problems

Lecture 18: P & NP. Revised, May 1, CLRS, pp

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

Propositional Logic: Models and Proofs

CS 5114: Theory of Algorithms

Lecture 3: Nondeterminism, NP, and NP-completeness

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

INTRO TO COMPUTATIONAL COMPLEXITY

Introduction to Computational Complexity

(Note that these points are to give a relative sense of the weights on the final exam and have no bearing on extra credit points)

Computability Theory

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Advanced Topics in Theoretical Computer Science

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-Complete Reductions 1

Algorithms: COMP3121/3821/9101/9801

More NP-Complete Problems

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

CSC 373: Algorithm Design and Analysis Lecture 15

Tecniche di Verifica. Introduction to Propositional Logic

A Note on Turing Machine Design

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

NP and Computational Intractability

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

Complexity and NP-completeness

Introduction to Complexity Theory

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

NP-Complete Reductions 2

NP and Computational Intractability

A brief introduction to Logic. (slides from

SAT, Coloring, Hamiltonian Cycle, TSP

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

Non-Deterministic Time

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

Announcements. Using a 72-hour extension, due Monday at 11:30AM.

CISC 4090 Theory of Computation

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

Notes for Lecture 21

Transcription:

NP-Completeness

Recap from Last Time

Analyzing NTMs When discussing deterministic TMs, the notion of time complexity is (reasonably) straightforward. Recall: One way of thinking about nondeterminism is as a tree. The time complexity is the height of the tree (the length of the longest possible choice we could make). Intuition: If you ran all possible branches in parallel, how long would it take before all branches completed?

The Complexity Class NP The complexity class NP (nondeterministic polynomial time) contains all problems that can be solved in polynomial time by an NTM. Formally: NP = { L There is a nondeterministic TM that decides L in polynomial time. }

Another View of NP Theorem: L NP iff there is a deterministic TM V with the following properties: w L iff there is some c Σ* such that V accepts w, c. V runs in time polynomial in w. Some terminology: A TM V with the above property is called a polynomial-time verifier for L. The string c is called a certificate for w. You can think of V as checking the certificate that proves w L.

NP and Reductions

Polynomial-Time Reductions Suppose that we know that B NP. Suppose that A P B and that the reduction f can be computed in time O(n k ). Then A NP as well. Input size: n Time required: O(n k ) Input size: O(n k ) A Solvable by NTM in O(n kr ) Compute f(w) f(w) B iff w A Time required: O(n kr ) B Solvable by NTM in O(n r )

A Sample Reduction

U = 1, 2, 3, 4, 5, 6 1, 2, 5 2, 5,, 1, 3, 6, S = 2, 3, 4 4 1, 5, 6,, Let U be a set of elements (the universe) and S ( U). An exact covering of U is a collection of sets I S such that every element of U belongs to exactly one set in I.

U = 1, 2, 3, 4, 5, 6 1, 2, 5, 2, 5, 1, 3, 6, S = 2, 3, 4 4, 1, 5, 6 Let U be a set of elements (the universe) and S ( U). An exact covering of U is a collection of sets I S such that every element of U belongs to exactly one set in I.

Exact Covering Given a universe U and a set S ( U), the exact covering problem is As a formal language: Does S contain an exact covering of U? EXACT-COVER = { U, S S ( U) and S contains an exact covering of U }

EXACT-COVER NP Here is a polynomial-time verifier for EXACT-COVER: V = On input U, S, I, where U, S, and I are sets: Verify that every set in S is a subset of U. Verify that every set in I is an element of S. Verify that every element of U belongs to an element of I. Verify that every element of U belongs to at most one element of I.

Applications of Exact Covering 1 2 3 4 5 6 7 8 9 { C, 1, 4, 5 } { C, 1, 2, 4 } { C, 1, 2, 5 } { C, 2, 4, 5 } { M, 1, 4, 7 } C Y M { M, 2, 5, 8 } { M, 3, 6, 9 }

Trust me, these reductions matter. We'll see why in a few minutes.

The Most Important Question in Theoretical Computer Science

What is the connection between P and NP?

P = { L There is a polynomial-time decider for L } NP = { L There is a nondeterministic polynomial-time decider for L } P NP

Which Picture is Correct? P NP

Which Picture is Correct? P NP

Does P = NP?

P NP The P NP question is the most important question in theoretical computer science. With the verifier definition of NP, one way of phrasing this question is If a solution to a problem can be verified efficiently, can that problem be solved efficiently? An answer either way will give fundamental insights into the nature of computation.

Why This Matters The following problems are known to be efficiently verifiable, but have no known efficient solutions: Determining whether an electrical grid can be built to link up some number of houses for some price (Steiner tree problem). Determining whether a simple DNA strand exists that multiple gene sequences could be a part of (shortest common supersequence). Determining the best way to assign hardware resources in a compiler (optimal register allocation). Determining the best way to distribute tasks to multiple workers to minimize completion time (job scheduling). And many more. If P = NP, all of these problems have efficient solutions. If P NP, none of these problems have efficient solutions.

Why This Matters If P = NP: A huge number of seemingly difficult problems could be solved efficiently. Our capacity to solve many problems will scale well with the size of the problems we want to solve. If P NP: Enormous computational power would be required to solve many seemingly easy tasks. Our capacity to solve problems will fail to keep up with our curiosity.

What We Know Resolving P NP has proven extremely difficult. In the past 35 years: Not a single correct proof either way has been found. Many types of proofs have been shown to be insufficiently powerful to determine whether P = NP. A majority of computer scientists believe P NP, but this isn't a large majority. Interesting read: Interviews with leading thinkers about P NP: http://web.ing.puc.cl/~jabaier/iic2212/poll-1.pdf

The Million-Dollar Question The Clay Mathematics Institute has offered a $1,000,000 prize to anyone who proves or disproves P = NP.

Time-Out For Announcements

Please evaluate this course in Axess. Your feedback really does make a difference.

Final Exam Logistics Final exam is this upcoming Monday, December 9 th from 12:15PM 3:15PM. Room information TBA; we're still finalizing everything. Exam is cumulative, but focuses primarily on material from DFAs onward. Take a look a the practice exams for a sense of what the coverage will be like.

Practice Finals We have three practice exams available right now: An extra credit practice exam worth +5 EC points. Two actual final exams from previous quarters, which are good for studying but not worth any extra credit. Solutions to the two additional practice finals will be released Wednesday. Please take the additional final exams under realistic conditions so that you can get a sense of where you stand. Most of the problems are nondeterministically trivial.

A Note on Honesty and Integrity

Review Sessions We will be holding at least one final exam review session later this week. We will announce date and time information once it's finalized. Feel free to show up with any questions you'd like answered!

Casual CS Dinner The second biquarterly Casual CS Dinner for Women in CS is tonight at 6PM on the fifth floor of Gates. Everyone is welcome! RSVP appreciated; check the email sent to the CS103 list.

Back to CS103!

NP-Completeness

Polynomial-Time Reductions If L 1 P L 2 and L 2 P, then L 1 P. If L 1 P L 2 and L 2 NP, then L 1 NP. P NP

NP-Hardness A language L is called NP-hard iff for every L' NP, we have L' P L. A language in L is called NP-complete iff L is NP-hard and L NP. The class NPC is the set of NP-complete problems. NP NPC NP-Hard P

The Tantalizing Truth Theorem: If any NP-complete language is in P, then P = NP. Proof: If L NPC and L P, we know for any L' NP that L' P L, because L is NP-complete. Since L' P L and L P, this means that L' P as well. Since our choice of L' was arbitrary, any language L' NP satisfies L' P, so NP P. Since P NP, this means P = NP. NPC NP P

The Tantalizing Truth Theorem: If any NP-complete language is not in P, then P NP. Proof: If L NPC, then L NP. Thus if L P, then L NP P. This means that NP P Ø, so P NP. NP P NPC

A Feel for NP-Completeness If a problem is NP-complete, then under the assumption that P NP, there cannot be an efficient algorithm for it. In a sense, NP-complete problems are the hardest problems in NP. All known NP-complete problems are enormously hard to solve: All known algorithms for NP-complete problems run in worst-case exponential time. Most algorithms for NP-complete problems are infeasible for reasonably-sized inputs.

How do we even know NP-complete problems exist in the first place?

Satisfiability A propositional logic formula φ is called satisfiable if there is some assignment to its variables that makes it evaluate to true. p q is satisfiable. p p is unsatisfiable. p (q q) is satisfiable. An assignment of true and false to the variables of φ that makes it evaluate to true is called a satisfying assignment.

SAT The boolean satisfiability problem (SAT) is the following: Formally: Given a propositional logic formula φ, is φ satisfiable? SAT = { φ φ is a satisfiable PL formula }

Theorem (Cook-Levin): SAT is NP-complete.

A Simpler NP-Complete Problem

Literals and Clauses A literal in propositional logic is a variable or its negation: x y But not x y. A clause is a many-way OR (disjunction) of literals. x y z x But not x (y z)

Conjunctive Normal Form A propositional logic formula φ is in conjunctive normal form (CNF) if it is the many-way AND (conjunction) of clauses. (x y z) ( x y) (x y z w) x z But not (x (y z)) (x y) Only legal operators are,,. No nesting allowed.

The Structure of CNF ( x y z ) ( x y z ) ( x y z ) Each Each clause clause must must have have at at least least one one true true literal literal in in it. it.

The Structure of CNF ( x y z ) ( x y z ) ( x y z ) We We should should pick pick at at least least one one true true literal literal from from each each clause clause

The Structure of CNF ( x y z ) ( x y z ) ( x y z ) subject subject to to the the constraint constraint that that we we never never choose choose a a literal literal and and its its negation negation

3-CNF A propositional formula is in 3-CNF if It is in CNF, and Every clause has exactly three literals. For example: (x y z) ( x y z) (x x x) (y y x) (x y y) But not (x y z w) (x y) The language 3SAT is defined as follows: 3SAT = { φ φ is a satisfiable 3-CNF formula }

Theorem: 3SAT is NP-Complete

Using the Cook-Levin Theorem When discussing decidability, we used the fact that A TM R as a starting point for finding other undecidable languages. Idea: Reduce A TM to some other language. When discussing NP-completeness, we will use the fact that 3SAT NPC as a starting point for finding other NPC languages. Idea: Reduce 3SAT to some other language.

NP-Completeness Theorem: Let L₁ and L₂ be languages. If L₁ P L₂ and L₁ is NP-hard, then L₂ is NP-hard. Theorem: Let L₁ and L₂ be languages where L₁ NPC and L₂ NP. If L₁ P L₂, then L₂ NPC. NP P NPC

Next Time More NP-Complete Problems Independent Sets Graph Coloring Applied Complexity Theory (ITA) Why does all of this matter?