CSC 380: Design and Analysis of Algorithms

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

P, NP, NP-Complete Problems
NP-Complete Problems CIT 596, Spring Problems that Cross the Line What if a problem has: o An exponential upper bound o A polynomial lower bound.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
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.
P, NP, and NP-Complete Suzan Köknar-Tezel.
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
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:
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
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.
Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.
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 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
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.
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.
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.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
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.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
CSC 413/513: Intro to Algorithms
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.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 23: Intractable Problems (Smiley Puzzles.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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
The NP class. NP-completeness
NP-Complete Problems.
Chapter 10 NP-Complete Problems.
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
Great Theoretical Ideas in Computer Science
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
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
1. for (i=0; i < n; i+=2) if (A[i] > A[i+1]) swap(A[i], A[i+1])
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
Chapter 34: NP-Completeness
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
CSC 380: Design and Analysis of Algorithms
NP-Completeness Yin Tat Lee
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
CSC 380: Design and Analysis of Algorithms
NP-Completeness Lecture for CS 302.
CSE 589 Applied Algorithms Spring 1999
P, NP and NP-Complete Problems
Richard Anderson Lecture 25 NP Completeness
CSC 380: Design and Analysis of Algorithms
CSC 380: Design and Analysis of Algorithms
RAIK 283 Data Structures & Algorithms
Presentation transcript:

CSC 380: Design and Analysis of Algorithms Dr. Curry Guinn

Quick Info Dr. Curry Guinn CIS 2015 guinnc@uncw.edu www.uncw.edu/people/guinnc 962-7937 Office Hours: MWF: 10:00am-11:00m and by appointment

Outline of today Homework due Thursday Night P vs NP

Relations between Problems, Algorithms, and Programs . . . . Algorithm . . . . Program . . . . Program Program Program

P vs NP P = Polynomial NP = Non-deterministic Polynomial What is a non-deterministic algorithm?

Example NP-Complete Problems Path-Finding (Traveling salesman) Map coloring Scheduling and Matching (bin packing) 2-D arrangement problems Planning problems Clique

Traveling Salesman

The Traveling Salesman problem A traveling salesman needs to visit n cities, going to each city exactly once, and return to his starting city. Assume every city is connected to every other city, but the cost of traveling differs for each city pair. What is the sequence of cities that minimizes the overall cost? 8

Solving the TSP No algorithm is known that will guarantee finding the best solution except by examining all possible circuits (or equivalent approaches). For n = 25, (n – 1)! / 2 = 24! / 2 ≈ 3 × 1023. If we take one nanosecond to calculate the cost of each circuit, we still need 3 × 1014 seconds, or about 10 million years. The problem is provably NP-complete. 9

TSP Problems Planning routes Genome sequencing 10

Example tour on circuit board 3,038 points to visit 11

Class Scheduling Problem With N teachers with certain hour restrictions M classes to be scheduled, Can we: Schedule all the classes Make sure that no two teachers teach the same class at the same time No teacher is scheduled to teach two classes at once

Graph Coloring Problem

NP-Complete Problems A decision problem D is NP-complete if it’s as hard as any problem in NP, i.e., D is in NP every problem in NP is polynomial-time reducible to D Cook’s theorem (1971): CNF-sat is NP-complete

NP-Complete Problems (cont.) Other NP-complete problems obtained through polynomial- time reductions from a known NP-complete problem Examples: TSP, knapsack, partition, graph-coloring and hundreds of other problems of combinatorial nature

P = NP ? Dilemma Revisited P = NP would imply that every problem in NP, including all NP-complete problems, could be solved in polynomial time If a polynomial-time algorithm for just one NP- complete problem is discovered, then every problem in NP can be solved in polynomial time, i.e., P = NP Most but not all researchers believe that P  NP , i.e. P is a proper subset of NP

Problems Solvable by Computers … Problems that are ‘NP-hard’ are ‘hard’ in the sense that the answer cannot be found in polynomial time and are ‘NP’. It has been demonstrated that there are certain NP problems to which all other NP problems can be reduced. This means that if one of these problems can be solved in polynomial time, they all can. Such problems are called ‘NP-complete’.

NP-Complete Problems NP-complete problems have: An exponential upper bound A polynomial lower bound We have only found exponential algorithms, so it appears to be intractable. But... we can’t prove that an exponential solution is needed, we can’t prove that a polynomial algorithm cannot be developed, so we can’t say the problem is intractable...

NP-Complete Problems The upper bound suggests the problem is intractable The lower bound suggests the problem is tractable They are all reducible to each other If we find a reasonable algorithm (or prove intractability) for one, then we can do it for all of them!

Classes P and NP Class P collects all problems that are solvable in polynomial time by a deterministic algorithm Class NP is the analogous class for non-deterministic algorithms Note that P  NP Is P = NP ? NP P

Traveling Salesman Problem It is in NP Yes! Is it in P? We have no idea We are unable to exhibit a polynomial time algorithm on a TM We cannot prove that such algorithm does not exist NP P

Which Venn Diagram is Accurate? P=NP PNP NP P (b) P=NP · TSP (a) · TSP NP P (c) · TSP

Become Famous! To get famous in a hurry, for any NP-Complete problem: Raise the lower bound (via a stronger proof) Lower the upper bound (via a better algorithm) The Clay Mathematics Institute has offered a $1 million US prize for the first correct proof.

What Do Computer Scientists Think 2002 Survey 2012 Survey When will this question be resolved? 2002-2029: 11 2030-2059: 33 2060-2100: 28 2100-2200: 9 2200-2900: 6 Never: 5

What Do Computer Scientists Think 2002 Survey 2012 Survey Is P = NP? NO: 83% YES: 12% Obfuscatory or no answer: 5%

The Satisfiability Problem Given a set of propositional logic clauses, find an assignment of truth values to each symbol so that all of the clauses are true. (P -> Q & S) & (~P & ~Q) & (S | ~Q)

3SAT is a special case All clauses contain the disjunction of 3 terms Disjunction means OR Each term is of the form P or ~P. (P | Q | ~S) & (~P | ~Q | ~S) & (P | ~Q | S) It turns out that any SAT case, can be transformed into 3SAT

3SAT is an NP-complete problem Which means that it is map-able to other NP-complete problems such as Traveling salesman Clique Map coloring Knapsack, Etc. What do I mean by “map-able”?

Suppose we want to actually write code to solve this problem How do we do it? Analysis Design Implement Test

Analysis Can we write down the problem?

Write down the problem Find a set of truth assignments for the propositional symbols such that are of the clauses are true. Each clause consist of a disjunction (OR) of three terms. Each term is either a proposition symbol or its negation (i.e., P or ~P). More generally, for a particular problem, we will have n different propositional symbols and m different clauses. Do you want to add anything?

Find the nouns. Why?

For Next Class, Friday Chapter 11: P vs. Np Homework due Tonight