NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Introduction to Algorithms NP-Complete
NP-Hard Nattee Niparnan.
 2004 SDU Lecture17-P,NP, NPC.  2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of.
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.
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 
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Graphs 4/16/2017 8:41 PM NP-Completeness.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 21 Instructor: Paul Beame.
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
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.
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.
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.
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
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.
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.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
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.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
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.
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.
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.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
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.
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.
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
The NP class. NP-completeness
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
NP-completeness The Chinese University of Hong Kong Fall 2008
CS 3343: Analysis of Algorithms
The Theory of NP-Completeness
CHAPTER 7 Time complexity
Presentation transcript:

NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA

OVERVIEW  Introduction.  Examples of exponential-time algorithms.  NPC Class of algorithms.  Approaches to tackle NPC problems.  Polynomial Reductions.  Examples of NPC Problems.

Introduction  Most of the algorithms, we came across so far takes either logarithmic time (O(logn)), linear time (O(n)) or polynomial time (O(n k ), k=2,3,4…).  But there are some problems, for which we do not have polynomial algorithm. Such problems falls under the Super polynomial category (taking exponential time).  The following graph shows a clear distinction between the various categories under which the algorithm falls according to the running time they require -

Introduction (1) 2n2n n 10 n3n3 n2n2 n Polynomial-time Exponential-time n F(n)

Examples of problem falling under the Exponential time category  Some of the simple problems, which are very similar to problems that requires polynomial time falling under the exponential time category are: 1.Longest simple path problem (similar to Shortest path problem, which requires polynomial time) suspected to require exponential time, since there is no known polynomial algorithm. 2.Hamiltonian tour – visiting all the vertices in a graph exactly once, by passing through edges more than once, requires exponential time (similar to Euler tour problem – visiting all the vertices in a graph, by passing through each edge exactly once, requires polynomial time).

Examples of problem falling under the Exponential time category (1) 3.A good example of a problem which cannot be solved in polynomial time is Satisfiability problem.  Satisfiability problem (SAT problem)  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 containing ‘n’ boolean variables, can you assign some values to these variables so that it can be true?????

Examples of problem falling under the Exponential time category (2)  We generally deal with SAT problems having 2 or 3 boolean variables in a clause. They are called as 2SAT and 3SAT problems respectively. Ex: 2SAT problem – (x or y) and (y or z) 3SAT problem – (x or y or z) and (~x or y or ~z) where x, y, z, ~x (complement of x) and ~z (complement of z) (…………….) denotes a clause. In the above example for 2SAT problem, the clauses are (x or y) and (y or z).  2SAT problems can be solved in polynomial time.  But 3SAT problems doesn’t have any known polynomial time algorithm and it is historically found as the first problem which requires exponential time.

Various classes of problems  The problems generally falls into one of the three classes – Polynomial (P), Non-deterministic Polynomial (NP) and NP Completeness (NPC).  The figure following represents these classes: Polynomial Class Non-Polynomial Class Exponential Class Non-Polynomial Complete

Various classes of problems (1)  P = the class of problems that can be solved in polynomial time.  NP = the class of problems whose solutions can be verified in polynomial time.  NPC = the class of problems which belongs to NP and atleast as hard as all other problems in NP.

Approaches to tackle NPC problems  There are three approaches to tackle NPC problems. They are  Decision problems – Easy to solve when compare to other problems. Decision problems output the results as boolean value (Yes or No) Hence we convert all the problems into decision problems. Problem Yes No Decision version of problem

Approaches to tackle NPC problems (1)  Reduction Problems – A means of comparing two problems. Suppose A and B are two problems, given that B is difficult. We suspect A is difficult. To confirm, we try to solve B using A as subroutine. For example: We know that the Longest Path Problem (LPP) is hard and we can solve Hamiltonian path problem using LPP as subroutine. So we can conclude HPP is harder than LPP.

Approaches to tackle NPC problems (2)  Encodings – Encoding is a process of converting a problem into a language is called as encoding. Strings are defined as sequence of alphabets (∑). Languages are set of strings (i.e. we are interested in languages with unlimited set of strings. Some examples – 3SAT equivalent to { set of all formulas such that each formula is in correct syntax and it is satisfiable. Suppose we have 20 variables, so we can use 0,1 to represent these 20 variables, # to represent OR and $ to represent AND. Thus we can encode these formulas using set of the above characters { all strings over = { 0,1,#,$}} Now the problem of solving 3SAT (any decision problem can be reduced to language recognition problem). ∑

Polynomial Reductions  Given two problems P 1 and P 2, if all strings in P1 can be mapped to strings in P2 using a mapping algorithm in polynomial time. we can say that P2 is polynomially harder than P1. P 1 <= p P 2  Formal definition of NP- complete – A problem P belongs to NP- complete if it belongs to the class NP and P 1 belongs to NP, P1 <= p P2

Polynomial Reductions (1) Polynomial-time Matching-algorithm P1P1 P2P2 Σ*Σ* Σ*Σ* P1P1 P2P2 =<

Cook’s Theorem  Stephen Cook founded the first NP- complete problem (3SAT).  3SAT problem was proved to be the most difficult problem in the class of NP- complete problems.  To prove a new problem p is NP- complete, we need to 1. prove p is in NP 2. Any known NP- complete problem p ≤p≤p

Examples of NPC problems  3SAT – We will prove that it is a NPC problem. Suppose we have ‘m’ clauses with ‘n’ variables (3 in each clause), so we need to try all possible sets of solutions. Thus we have 2 n sets of possible solutions. So it is a NPC problem.  Clique – It is a subgraph of a graph which contains all possible edges between each pair of vertices in the subgraph. To prove clique is a NPC problem, we compare with 3SAT problem. It can be reduced to decision problem, where input : G,K output: Yes, if clique with atleast ‘K’ nodes exists, No, otherwise

Examples of NPC problems (1)  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. Graph showing Clique

Examples of NPC problems (2) X1 X3 X1 X2 X3 X2 X3 X2 X1 Note :Red nodes denotes negation.

Examples of NPC problems (3)  For 3SAT problem to be satisfiable, 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).

Examples of NPC problems (4)  Maximum Independent Set Problem – It is defined as a set of vertices with no edges in between. Its equivalent decision problem is, given a graph G and some number ‘t’. Thus there exists an independent set of size >= K?  A clique problem can be reduced to maximum independent set problem. Given a problem to find a clique of size ‘K’ in a graph G is equivalent to finding a maximum independent set in G’ (complement of G).

Examples of NPC problems (5) Graph G has a clique of size 4 (2,3,4,5) Graph G’ has a maximum independent set of size 4 (2,3,4,5)