Chapter 10 NP-Complete Problems.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

NP-Hard Nattee Niparnan.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
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.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
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:
CSCE350 Algorithms and Data Structure
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.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
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.
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.
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.
Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
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.
NPC.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
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 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.
Advanced Algorithms NP-hard and NP-Complete Problems Instructor: Saeid Abrishami Ferdowsi University of Mashhad.
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
Limitation of Computation Power – P, NP, and NP-complete
The NP class. NP-completeness
P & NP.
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
Chapter 34: NP-Completeness
CS 3343: Analysis of Algorithms
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
P, NP and NP-Complete Problems
The Theory of NP-Completeness
CSE 589 Applied Algorithms Spring 1999
P, NP and NP-Complete Problems
Our old list of problems
RAIK 283 Data Structures & Algorithms
Lecture 23 NP-Hard Problems
Presentation transcript:

Chapter 10 NP-Complete Problems

Running times vs Input sizes

Decision and optimization Decision problem: its solution has only two outcomes: yes or no Optimization problem: concern with the minimization or maximization of a certain quantity How to formulate a problem as a decision problem and an optimization problem?

Decision problem: ELEMENT UNIQUENESS Input: A sequence S of integers Question: Are there two elements in S that are equal? Optimization problem: ELEMENT COUNT Output: An element in S with highest frequency

Decision problem: COLORING Input: An undirected graph G=(V,E) and a positive integer k1 Question: Is G k-colorable?, i.e., can G be colored using at most k colors in such a way that no two adjacent vertices have the same color? Optimization problem: CHROMATIC NUMBER Input: An undirected graph G=(V,E) Output: The chromatic number (G) of G

Decision problem: CLIQUE Input: An undirected graph graph G=(V,E) and a positive integer k Question: Does G have a clique of size k? Optimization problem: MAX-CLIQUE Input: An undirected graph G=(V,E) Output: A positive integer k, which is the maximum clique size in G

Decision and optimization We usually can cast a given optimization problem as a related decision problem by imposing a bound on the value to be optimized. If an optimization problem is easy, its related decision problem is easy as well. If we can provide evidence that a decision problem is hard, we also provide evidence that its related optimization problem is hard. In the study of NP-complete problems, and computational complexity or even computability in general, it is easier to restrict one’s attention to decision problems

The class P Definition 10.1: Let A be an algorithm to solve a problem . We say that A is deterministic if, when presented with an instance of the problem , it has only one choice in each step throughout its execution. Thus, if A is run again and again on the same input instance, its output never changes. Definition 10.2: The class of decision problems P consists of those decision problems whose yes/no solution can be obtained using a deterministic algorithm that runs in polynomial number of steps, i.e., in O(n^k) steps, for some nonnegative integer k, where n is the input size.

Some decision problems in the class P SORTING SET DISJOINTNESS SHORTEST PATH 2-COLORING 2-SAT

Closed under complementation A class of problems C is closed under complementation if for any problem C the complementation of  is also in C. Example: 2-COLORING and NOT-2-COLORING Theorem 10.1: The class P is closed under complementation

Nondeterministic algorithm On input x, a nondeterministic algorithm consists of two phases: a) The guessing phase: An arbitrary string of character y is generated. It may correspond to a solution to the input instance or not. It may not even be in the proper format of the desired solution. It may differ from one run to another of the nondeterministic algorithm. It is only required that this string be generated in a polynomial number of steps. b) The verification phase: A deterministic algorithm verifies two things. First, it checks whether the generated solution string y is in the proper format. If it is not, the algorithm halts with the answer no. If y is on the proper format, the algorithm continues to check if it is a solution to the instance x of the problem, If it is indeed a solution to the instance x, it halts and answer yes; otherwise it halts and answer no. It is also required that this phase be completed in a polynomial number of steps.

The class NP Definition 10.3: The class of decision problems NP consists of those decision problems for which there exists a nondeterminstic algorithm that runs in polynomial time P is the class of decision problems that we can decide or solve using a deterministic algorithm that runs in polynomial time NP is the class of decision problems that we can check or verify their solution using a deterministic algorithm that runs in polynomial time Any problem in P is also in NP.

Reduce Definition 10.4: Let  and ’ be two decision problems. We say that  reduces to ’ in polynomial time, symbolized as poly’, if there exists a deterministic algorithm A that behaves as follows. When A is presented with an instance I of problem , it transforms it into an instance I’ of problem ’ such that the answer to I is yes iff the answer to I’ is yes. Moreover, this transformation must be achieved in polynomial time.

NP-hard and NP-complete Definition 10.5: A decision problem  is said to be NP-hard if for every problem ’ in NP, ’poly Definition 10.6: A decision problem  is said to be NP-complete if 1)  is in NP, and 2) for every problem ’ in NP, ’poly Theorem: If any NP-complete problem is polynomial-time solvable, then P=NP. Equivalently, if any problem in NP is not polynomial-time solvable, then no NP-complete problem is polynomial-time solvable.

The satisfiability problem Given a boolean formula f, we say that it is in conjunctive normal form (CNF) if it is the conjunction of clauses. A clause is the disjunction of literals, where a literal is a boolean variable or its negation. A formula is said to be satisfiable if there is a truth assignment to its variables that makes it true. Decision problem: SATISFIABILITY Input: A CNF boolean formula f Question: Is f satisfiable? Theorem 10.2: SATISFIABILITY is NP-complete

How to prove NP-completeness Theorem 10.3: Let , ’ and ” be three decision problems such that poly’ and ’poly”, then poly” Corollary 10.1: If  and ’ are two problems in NP such that ’poly and ’ is NP-complete, then  is NP-complete

How to prove NP-completeness Theorem 10.3: Let , ’ and ” be three decision problems such that poly’ and ’poly”, then poly” Corollary 10.1: If  and ’ are two problems in NP such that ’poly and ’ is NP-complete, then  is NP-complete To prove a problem  is NP-complete, we need to show 1) NP 2) there is an NP-complete problem ’ such that ’poly

More NP-complete problems CLIQUE VERTEX COVER INDEPENDENT SET 3-SAT 3-COLORING 3-dimensional matching HAMILTONIAN PATH PARTITION KNAPSACK BIN PACKING SET COVER MULTIPROCESSOR SCHEDULING LONGEST PATH

The class co-NP The class co-NP consists of those problems whose complements are in NP Definition 10.7: A problem  is complete for the class co-NP if 1)  is in co-NP, and 2) for every problem ’ in co-NP, ’poly Theorem 10.5: A problem  is NP-complete iff its complement is complete for the class co-NP Theorem 10.6: The problem TAUTOLOGY is complete for the class co-NP TAUTOLOGY is in P iff co-NP=P TAUTOLOGY is in NP iff co-NP=NP

The class NPI Theorem 10.7: If a problem  and its complement are NP-complete, then co-NP=NP NPI: NP-Intermediate Theorem (Ladner): If P≠NP then there is a set A in NP such that A is not in P and A is not NP-complete.

The relationships between 4 classes

Why we learn these To become a good algorithm designer, you must understand the rudiments of the theory of NP-completeness. If you can establish a problem as NP-complete, you provide good evidence for its intractability. As an engineer, you would then do better spending your time developing an approximation algorithm or solving a tractable special case, rather than searching for a fast algorithm that solve the problem exactly. Many natural and interesting problems that on the surface seem easy are in fact NP-complete. It is important to become familiar with this class of problems