The Class NP Lecture 39 Section 7.3 Mon, Nov 26, 2007.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
The class NP Section 7.3 Giorgi Japaridze Theory of Computability.
Department of Computer Science & Engineering
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Lecture 21 Nondeterministic Polynomial time, and the class NP FIT2014 Theory of Computation Monash University Faculty of Information Technology Slides.
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Graphs 4/16/2017 8:41 PM NP-Completeness.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
Time Complexity.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Clique Cover Cook’s Theorem 3SAT and Independent Set
Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N  N, where f(n) is the maximum.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
CS 461 – Nov. 30 Section 7.5 How to show a problem is NP-complete –Show it’s in NP. –Show that it corresponds to another problem already known to be NP-complete.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
Intro to Theory of Computation
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
NP-Complete Problems.
Prabhas Chongstitvatana
CS154, Lecture 13: P vs NP.
CSE 589 Applied Algorithms Spring 1999
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Lecture 23 NP-Hard Problems
Presentation transcript:

The Class NP Lecture 39 Section 7.3 Mon, Nov 26, 2007

Nondeterministic Algorithms When we solve a problem nondeterministically, we do not just magically write down the solution. We must be able to Generate the solution in polynomial time, and Verify the solution in polynomial time.

The COMPOSITES Problem The COMPOSITES Problem: Given an integer m, determine whether it is composite. The integer m is composite if there exist integers a and b, both greater than 1, such that m = ab.

The COMPOSITES Problem How do we generate a solution in polynomial time? Let n be the length of the integer m, in bits. To choose a divisor a, we choose n bits to create the binary representation of a.

The COMPOSITES Problem Then do the same for b. That can be done in polynomial time. How do we verify that m = ab? We just multiply a times b and compare to m. That too can be done in polynomial time.

Verifiers A verifier for a language A is an algorithm V such that A = {w | V accepts  w, c  for some string c}. c is a string containing additional information needed for verification. c is called a certificate.

Verifiers The language of the COMPOSITES problem is {m | m is composite}. The verifier is a Turing machine that accepts  m, a, b  whenever m = ab.

The Class NP A potential solution to a problem is verifiable in polynomial time if the verifier V is a polynomial-time Turing machine.

The Class NP The class NP is the class of all languages whose members can be generated in polynomial time and that have polynomial-time verifiers.

The Class NP Let NTIME(t(n)) be the set of all languages that are decidable nondeterministically in time O(t(n)). Then

Nondeterministic Programs in C++ We will assume that we have available the following three functions. accept() reject() choose()

The choose() Function The function accept() outputs “accept.” The function reject() outputs “reject.” The function choose() takes a set S as its parameter.

The choose() Function choose() will return a single value from the set S. If there is a choice of values from S that will eventually lead to calling accept() and a choice that leads to calling reject(), then choose() will choose a value that leads to accept().

The choose() Function If there is no such choice, i.e., every choice leads to accept() or every choice leads to reject(), then choose() will choose a random value from the set S. The execution time of choose() is O(|S|).

The COMPOSITES Problem COMPOSITE(m) { a = 0; b = 0; // Generate values for a and b for (i = 1; i <= n; i++) { a = 2*a + choose({0, 1}); b = 2*b + choose({0, 1}); } // Verify the choice if (m == a*b && a > 1 && b > 1) accept(); else reject(); }

The COMPOSITES Problem This is programming as it was meant to be.

Examples of NP Problems Some NP problems CLIQUE VERTEX-COVER SUBSET-SUM SAT 3SAT

The CLIQUE Problem Given a graph G, a clique of G is a complete subgraph of G. The CLIQUE Problem: Given a graph G and an integer k, does G contain a clique of size k? Let n be the number of vertices in G.

A CLIQUE Algorithm CLIQUE(G, k) { // Generate a clique C = {}; for (i = 0; i < n; i++) if (choose({true, false})) Add vertex i to C; // Verify the clique if (size of C != k) reject(); for (i = 0; i < k; i++) for (j = 0; j < k; j++) if (i != j && (C[i], C[j])  E) { reject(); exit(); } accept(); }

The VERTEX-COVER Problem Given a graph G, a vertex cover of G is a set of vertices S of G such that every edge of G is incident to a vertex in S. The VERTEX-COVER Problem: Given a graph G and an integer k, does G have a vertex cover of size k?

A VERTEX-COVER Algorithm VERTEX_COVER(G, k) { // Generate a vertex cover C = {}; for (i = 0; i < n; i++) if (choose({true, false}) Add vertex i to C; // Verify the vertex cover if (size of C != k) reject(); for (i = 0; i < n; i++) // For every edge in G for (j = i + 1; j < n; j++) if (edge(i, j)  G) { bool ok = false; for (v = 0; v < k; v++) // For every vertex in C if (C[v] is incident to edge(i, j)) ok = true; if (!ok) reject(); } accept(); }

The SUBSET-SUM Problem The SUBSET-SUM Problem: Given a set S = {a 1, a 2, …, a n } of positive integers and an integer k, does there is a subset {b 1, b 2, …, b m } of S such that b 1 + b 2 + … + b m = k?

The SAT Problem The SAT Problem: Given a Boolean expression f(x 1, x 2, …, x n ) in n Boolean variables x 1, x 2, …, x n, do there exist truth values for x 1, x 2, …, x n for which f(x 1, x 2, …, x n ) will be true? That is, is f satisfiable?

The 3SAT Problem The 3SAT Problem: This is the same as SAT except that the Boolean expression is in conjunctive normal form with exactly 3 literals in each clause.