Introduction to Algorithms NP-Complete

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

P, NP, NP-Complete Problems
NP-Hard Nattee Niparnan.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Theory of NP-Completeness
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
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.
P, NP, and NP-Complete Suzan Köknar-Tezel.
Ref: Pfleeger96, Ch.31 NP-Complete Problems Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
NP and NP- Completeness Bryan Pearsaul. Outline Decision and Optimization Problems Decision and Optimization Problems P and NP P and NP Polynomial-Time.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
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.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
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.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
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.
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.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
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.
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.
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
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-Complete and NP-hard Problems
NP-completeness Ch.34.
P & NP.
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
Computability and Complexity
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
Richard Anderson Lecture 30 NP-Completeness
Chapter 11 Limitations of Algorithm Power
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
The Theory of NP-Completeness
What is Computer Science About? Part 2: Algorithms
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

Introduction to Algorithms NP-Complete CSE 680 Prof. Roger Crawfis

Polynomial Time Most (but not all) of the algorithms we have studied so far are easy, in that they can be solved in polynomial time, be it linear, quadratic, cubic, etc. Cubic may not sound very fast, and isn’t when compared to linear, but compared to exponential we have seen that it has a much better asymptotic behavior. There are many algorithms which are not polynomial. In general, if the space of possible solutions grows exponentially as n increases, then we should not hope for a polynomial time algorithm. These are the exception rather than the rule.

Hard Problems Problems with no known polynomial solution are called Hard problems. Another class of problems (NP) seem like they should be easy. They have the following property: A solution can be verified in polynomial time. Consider the following very common example called Satisfiability: (SAT) Input: A Boolean expression, F, over n variables (x1,. ..,xn) Output: 1 if the variables of F can be fixed to values which make F equal true; 0 otherwise.

NP Problems NP stands for non-deterministic polynomial time. The basic premise is we could guess at a solution and then test whether we guessed right or not easily. Guessing is of course non-deterministic! So, think of this as guessing in polynomial time. No guarantee that you will ever guess correctly though.

Polynomial Time Reductions The SAT problem is a circuit, so it is very useful and interesting. Can we write a program to do X? This and many other problems have been studied at length. There are many mappings (called reductions) that have been discovered that map one problem to the other, so if we solve one we can solve the other. Moreover, these mappings are polynomial time mappings.

NP-Complete The set of NP problems that can be mapped to each other in polynomial time is called NP-Complete. It is difficult to prove that something can not be done. Let me repeat that, it is difficult to prove that something can not be done. So, while we know how to solve many of these algorithms in exponential time, whose to say that one of you bright students won’t come up with a clever polynomial time algorithm! NP-Complete is useful from that standpoint, if any of them turns out to have a polynomial time algorithm, they all do (hence P=NP). Of course, us old professors feel that these problems have been looked at from every angle and no such solution will ever be found (hence, P ≠ NP).

NP-Complete It is also useful to know these algorithms, as they occur frequently in real applications and tackling them in a brute force fashion may be disastrous. SAT problem Traveling Salesman problem Knapsack Problem Longest Path Graph Clique

TSP 2 i = 23 2 1 1 3 4 1 3 4 5 4 2 1 2 2 2 2 1 1 1 For each two cities, an integer cost is given to travel from one of the two cities to the other. The salesperson wants to make a minimum cost circuit visiting each city exactly once.

Circuit-SAT Logic Gates 1 1 1 NOT 1 1 OR 1 1 1 AND Take a Boolean circuit with a single output node and ask whether there is an assignment of values to the circuit’s inputs so that the output is “1”

Knapsack 5 6 2 3 4 7 1 L s Given s and w can we translate a subset of rectangles to have their bottom edges on L so that the total area of the rectangles touching L is at least w?

Unweighted Bipartite Matching

Definitions Matching Free Vertex

Definitions Maximum Matching: matching with the largest number of edges

Definition Note that maximum matching is not unique.

Intuition Let the top set of vertices be men Let the bottom set of vertices be women Suppose each edge represents a pair of man and woman who like each other Maximum matching tries to maximize the number of couples!

Graph Clique Set of vertices such that they all connect to each other.

K-Cliques A K-clique is a set of K nodes with all K(K-1)/2 possible edges between them This graph contains a 4-clique

K-Cliques Given: (G, k) Question: Does G contain a k-clique? BRUTE FORCE: Try out all {n choose k} possible locations for the k clique

NP-Complete It is also interesting to look at the relationship between some easy problems and hard ones: Hard Problems (NP-Complete) Easy Problems (in P) SAT, 3SAT 2SAT Traveling Salesman Problem Minimum Spanning Tree 3D Matching Bipartite Matching Knapsack Fractional Knapsack