NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms NP-Complete
Advertisements

NP-Hard Nattee Niparnan.
Polynomial-time reductions We have seen several reductions:
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 More Reductions. Definitions P: is the class of all decision problems which can be solved in polynomial time, O(n^k) for some constant.
Lecture 21 NP-complete 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 
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
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.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
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.
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.
Polynomial-time reductions We have seen several reductions:
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
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.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
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.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
NPC.
CSC 413/513: Intro to Algorithms
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
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.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
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.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
NP-completeness Ch.34.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 11 Limitations of Algorithm Power
Prabhas Chongstitvatana
CS 3343: Analysis of Algorithms
Presentation transcript:

NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph

Overview NP-Completeness  Longest Path Problem  Hamiltonian Cycle Problem Reduction Decision Problems More Problems  HCP and Traveling Salesman  3SAT and Clique Problem

Polynomial (P) Problems Are solvable in polynomial time Are solvable in O(n k ), where k is some constant. Most of the algorithms we have covered are in P

Nondeterministic Polynomial (NP) Problems This class of problems has solutions that are verifiable in polynomial time.  Thus any problem in P is also NP, since we would be able to solve it in polynomial time, we can also verify it in polynomial time

NP-Complete Problems Is an NP-Problem Is at least as difficult as an NP problem (is reducible to it) More formally, a decision problem C is NP- Complete if:  C is in NP  Any known NP-hard (or complete) problem ≤ p C  Thus a proof must show these two being satisfied

Exponential Time Algorithms 2n2n nlogn √n√n Log(n) α(n) Polynomial-time (Easy) Exponential- time (Hard) n F(n) 2 2 n2n2 NP-Complete

Examples Longest path problem: (similar to Shortest path problem, which requires polynomial time) suspected to require exponential time, since there is no known polynomial algorithm. Hamiltonian Cycle problem: Traverses all vertices exactly once and form a cycle.

Reduction P1 : is an unknown problem (easy/hard ?) P2 : is known to be difficult If we can easily solve P2 using P1 as a subroutine then P1 is difficult Must create the inputs for P1 in polynomial time. * P1 is definitely difficult because you know you cannot solve P2 in polynomial time unless you use a component that is also difficult (it cannot be the mapping since the mapping is known to be polynomial)

Longest Path problem:  Input: Weighted graph, s, t  Output: The longest path between s and t Hamiltonian Cycle  Input: Unweighted graph  Output: Yes/No Hamiltonian Cycle Problem Longest Path Problem m times Unweighed graph Weighted graph(weight 1) Weight s,t Longest path Mapping is done by taking any edge. The nodes it connects are used to call Longest Possible Path. This will give Hamiltonian cycle if LPP traverses same Number of nodes as number in graph.

Where does NP Complete lie? Polynomial Class Non-Polynomial Class Exponential Class Non-Polynomial Complete

Decision Problems Represent problem as a decision with a boolean output  Easier to solve when comparing to other problems  Hence all problems are converted to decision problems. P = {all decision problems that can be solved in polynomial time} NP = {all decision problems where a solution is proposed, can be verified in polynomial time} NP-complete: the subset of NP which are the “hardest problems”

Alternative Representation Every element p in P1 can map to an element q in P2 such that p is true (decision problem) if and only if q is also true. Must find a mapping for such true elements in P1 and P2, as well as for false elements. Ensure that mapping can be done in polynomial time. *Note: P1 is unknown, P2 is difficult

Polynomial Reductions Polynomial-time Matching- algorithm P1P1 P2P2 Σ*Σ* Σ*Σ* P1P1 P2P2 =< p Elements that are true Thus solution can be expressed in terms of solutions of P2, which is known to be NP-Complete. Thus P1 is NP Complete as well.

Traveling Salesman problem Input:  Weighted graph G  Length l Output:  Yes if a circuit exists of length ≤ l  No otherwise TSP can be reduced from Hamiltonian cycle. TSP can be represented as a subroutine of HC, so as to represent TSP as NPC.

Cook’s Theorem Stephen Cook (Turing award winner) found the first NP-Complete problem, 3SAT.  Basically a problem from Logic.  Generally described using Boolean formula.  A Boolean formula involves AND, OR, NOT operators and some variables. Ex: (x or y) and (x or z), where x, y, z are boolean variables.  Problem Definition – Given a boolean formula of m clauses, each containing ‘n’ boolean variables, can you assign some values to these variables so that the formula can be true?  Boolean formula: (x v y v ẑ) Λ (x v y v ẑ)  Try all sets of solutions. Thus we have exponential set of possible solutions. So it is a NPC problem. Having one definite NP-Complete problem means others can also be proven NP-Complete, using reduction.

3SAT applied to Clique Problem Clique Problem: It is a subgraph of a graph which contains all possible edges between each pair of vertices in the subgraph. Is NP complete if it is reducible to 3SAT.  1) Represent as decision tree problem:  Input: Graph G,K  o utput: Yes, if clique with at least ‘K’ nodes exists, No, otherwise

Clique (Complete graph) in terms of 3SAT  For example: (x1 OR ~x2 OR ~x3) AND (~x1 OR x2 OR X3) AND (x1 OR x2 OR x3). This is a 3SAT problem and we will create a graph from it. We will put all possible edges, except edges in the same clause and between a variable and its negation.  Does there exist a subgraph of ≥ l nodes which is a clique? Graph showing Clique

A node and its negations are not connected X1 X3 X1 X2 X3 X2 X3 X2 X1 (x 1 v x 2 v x 3 ) Λ (x 1 v x 2 v x 3 ) Λ (x 1 v x 2 v x 3 )

Reduction of clique from 3SAT 3SAT is satisfiable, if one variable from each clause should be true. Suppose there are ‘m’ clauses, then it is satisfiable if the equivalent graph has a clique of size atleast ‘m’. If it is given that 3SAT problem is satisfiable, then we can select one variable from each clause to form a clique of size atleast ‘m’, as there will be atleast ‘m’ inter- connected nodes (one true node from each clause). Thus clique problem can be reduced to a NP-complete problem from 3SAT.

References 1) NP-Completeness - TUSHAR KUMAR J. & RITESH BAGGA 2) Introduction to Algorithms (Cormen et al) 3) Wikipedia.com