NPC.

Slides:



Advertisements
Similar presentations
P, NP, NP-Complete Problems
Advertisements

Complexity ©D.Moshkovits 1 Where Can We Draw The Line? On the Hardness of Satisfiability Problems.
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 
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
CS21 Decidability and Tractability
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
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Clique Cover Cook’s Theorem 3SAT and Independent Set
P, NP, and NP-Complete Suzan Köknar-Tezel.
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
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.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
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 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Unit 9: Coping with NP-Completeness
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
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.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
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.
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
Chapter 10 NP-Complete Problems.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
(xy)(yz)(xz)(zy)
Where Can We Draw The Line?
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
NP-Complete Problems.
CS 3343: Analysis of Algorithms
The Theory of NP-Completeness
CSE 589 Applied Algorithms Spring 1999
Our old list of problems
Presentation transcript:

NPC

Millennium Prize Problems http://en.wikipedia.org/wiki/Millennium_Prize_Problems Poincare (pon car re)

8 NP-complete problem Hard problems: demo NP-hard (Non-deterministic Polynomial-time hard), in computational complexity theory, is a class of problems that are, informally, "at least ashard as the hardest problems in NP".

Informal Definition of NP Solutions to the problem can be verified easily (in polynomial time). The idea of “guessing” the right answer or checking all possible solutions in parallel to determine which is correct is called non-determinism. Any problem with an algorithm that runs on a non-deterministic machine in polynomial time is called a problem in NP. Is Towers of Hanoi problem in NP?

NPC

2-Coloring 2-coloring (2Col): Given a graph G, can each of its vertices be labeled with one of 2 different “colors”, such that no two adjacent vertices have the same label? Is 2-coloring problem in NP ? Yes Is it in P?  Determine the graph is a bipartite graph or not

3-Coloring 3-coloring (3Col): Given a graph G, can each of its vertices be labeled with one of 3 different “colors”, such that no two adjacent vertices have the same label?

3-Coloring

3-Coloring Is 3-coloring problem in NP ? Yes Is it in P?

3-Coloring Is 3-coloring problem in NP ? Yes It is in NPC

4-coloring Four color conjecture – a planar map can be colored properly using 4 colors.

4-coloring Four color theorem – a planar map can be colored properly using 4 colors. The conjecture was first proposed in 1852 1970s, was proved with help from computer programs

Hamilton cycle problem a simple cycle contains all vertices Hamilton cycle problem: Does a given undirected graph have a Hamilton cycle ? Is Hamilton cycle problem in NP? Yes

Traveling salesman problem Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?

Vertex Cover Given a graph G, a vertex cover for G is a subset C of the vertices such that, for every edge (u,v) of G, uC or vC. The optimization goal is to find as small a vertex cover for G as possible. Vertex cover problem: Given a graph G and an integer k, determine whether there is a vertex cover for G containing at most k vertices. A C B D B D

Vertex Cover Is vertex cover problem in NP ? Yes

(xy)(yz)(xz)(zy) 2SAT Often expressed as 2CNF (conjunctive normal form - a conjunction of clauses, where a clause is a disjunction of literals and there are n different literals) Ex: The 2-satisfiability problem is to find a truth assignment to these variables that makes a formula of this type true. It’s a decision problem. (xy)(yz)(xz)(zy)

(xy)(yz)(xz)(zy) exercise (x  y) (xz) (xy)(yz)(xz)(zy)

kSAT P NP-hard Maximal number of literals per clause 4 3 2 1

2SAT is in P Theorem: 2SAT is polynomial-time decidable. Proof: using path searches (DFS/BFS) in graphs…

Graph Construction Vertex for each variable and a negation of the variable Edge (,) iff there exists a clause equivalent to ()

Graph Construction: Example (xy)(yz)(xz)(zy) More edges? x Note: xy  yx y x y z z

Observation Claim: If the graph contains a path from  to , it also contains a path from  to . Proof: If there’s an edge (,), then there’s also an edge (,).

Corollary A 2-CNF formula  is unsatisfiable iff there exists a variable x, such that: there is a path from x to x in the graph AND there is a path from x to x in the graph

Graph Construction: Example (xy)(yz)(xz)(zy)(zx) x y x y z z

IF Suppose there are paths x..x and x..x for some variable x, AND there’s also a satisfying assignment . If (x)=T (similarly for (x)=F): () =? () is false! x x . . .   T T F F

Only IF Suppose there are no such paths. Construct an assignment as follows: 1. pick an unassigned literal , with no path from  to , and assign it T x y x z z y x 2. assign T to all reachable vertices y x 3. assign F to their negations y z 4. Repeat until all vertices are assigned z

Only IF (2) Claim: The algorithm is well defined. Proof: If there were a path from x to both y and y, then there would have been a path from x to y and from y to x which indicate a path from x to x.

Corollary Claim: a 2-CNF formula  is unsatisfiable iff there exists a variable x, such that: there is a path from x to x in the graph AND there is a path from x to x in the graph

2SAT is in P We get the following efficient algorithm for 2SAT: For each variable x find if there is a path from x to x and vice-versa. Reject if any of these tests succeeded. Accept otherwise  2SATP.

3SAT Is E satisfiable? 3SAT is in NP – a decision problem that can be solved in nondeterministic polynomial time

Final review