NP and NP Complete. Definitions A problem is in the class P if there is a polynomial time solution to the problem A problem is in the class NP if there.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
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.
NP-Completeness: Reductions
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Graphs 4/16/2017 8:41 PM NP-Completeness.
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.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
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.
P, NP, and NP-Complete Suzan Köknar-Tezel.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
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.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Lecture 22 More NPC problems
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.
1 How to prove that a problem is NPC. 2 Cook Cook showed the first NPC problem: SAT Cook received Turing Award in 1982.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NPC.
CSC 413/513: Intro to Algorithms
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.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
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.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
NP-Completeness A problem is NP-complete if: It is in NP
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-complete problems
Richard Anderson Lectures NP-Completeness
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
Hard Problems Introduction to NP
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Richard Anderson Lecture 29 NP-Completeness
NP-Complete Problems.
Prabhas Chongstitvatana
Richard Anderson Lecture 26 NP-Completeness
The Theory of NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Hamiltonian Circuit (HC) problem
Presentation transcript:

NP and NP Complete

Definitions A problem is in the class P if there is a polynomial time solution to the problem A problem is in the class NP if there is a non- deterministic polynomial time solution to the problem –Essentially, given a solution, can you determine if it works in polynomial time A problem is in the class NP-Hard if every problem in NP reduces to it –What does it mean for one problem to reduce to another? A problem is in the class NP-Complete if it is both NP and NP-Hard

Cook's Theorem SAT is NP-Complete –Clearly in NP SAT – Given a boolean expression, it is satisfiable if there exists an assignment of 0s and 1s to its variables such that the expression evaluates to 1 –(x|y)&(x|y) –(x|y)&(!x|y)&(!y)

Cook's Theorem SAT is NP-Complete –Clearly in NP SAT – Given a boolean expression, it is satisfiable if there exists an assignment of 0s and 1s to its variables such that the expression evaluates to 1 –(x|y)&(x|y) – x=T y=T or x=T y=F or x=F y=T –(x|y)&(!x|y)&(!y) – ???

Clique Given an undirected graph G=(V, E) and an integer k, determine whether G contains a clique of size >=k. –Clique – a subgraph such that all vertices are connected to all other vertices Clique is in NP – given a subset of >= k vertices, easy to determine if subset represents a clique

Reduce SAT to Clique Show how to create an instance of Clique to represent any SAT problem –if you can solve the Clique problem, you can solve SAT Given an expression in conjunctive normal form, create a column of vertices for each clause Connect each vertex to all other vertices that are not in same column and are not the complement

Example (Manber text) E=(x|y|!z)&(!x|!y|z)&(y|!z) x y !z !x !y z y !z Choose k as m (number of clauses) If clique of size k, it must contain one vertex from every column since vertices in a column do not connect Assign value of 1 to each variable represented by vertex in clique(x and !x not connected) – solution to SAT!

TSP Hamiltonian Cycle (HAM) –Find a simple cycle, in an undirected graph, that visits every vertex. TSP –Given a complete graph G=(V, E), with edge costs, and an integer K, is there a simple cycle that visits all vertices and has total cost <= K?

TSP NP

TSP NP – Given a simple cycle, in polynomial time can check if it contains all vertices and has cost <= K. Reduce HAM to TSP –solve HAM using a solution to TSP –create an instance of TSP to represent any HAM

TSP – NP-Complete Determine if Hamiltonian Cycle exists for G. Create complete graph G' that has same vertices as in G. Edge has weight 1 if it is in G and 2 otherwise. Solve TSP on G' with K = number of vertices. TSP tour that visits all vertices will contain each vertex 1 time and will use only edges of weight 1