Chapter 11: Limitations of Algorithmic Power

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

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.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
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 Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
1 CSC 421: Algorithm Design & Analysis Spring 2013 Complexity & Computability  lower bounds on problems brute force, decision trees, adversary arguments,
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
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 11 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
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.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
P and NP.
CSC 413/513: Intro to Algorithms NP Completeness.
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.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
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.
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.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
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.
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.
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
CS 3813: Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
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.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
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.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
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
Chapter 10 NP-Complete Problems.
Lower Bound Theory.
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
How Hard Can It Be?.
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
CSC 380: Design and Analysis of 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
CSE 589 Applied Algorithms Spring 1999
P, NP and NP-Complete Problems
Our old list of problems
Presentation transcript:

Chapter 11: Limitations of Algorithmic Power The Design and Analysis of Algorithms Chapter 11: Limitations of Algorithmic Power P, NP and harder problems

Limitations of Algorithmic Power Introduction Lower Bounds P, NP, NP-complete and NP-hard Problems

Introduction Algorithm efficiency: Logarithmic Linear Polynomial with a lower bound Exponential Some problems cannot be solved by any algorithm Question: how to compare algorithms and their efficiency

Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Lower bound can be an exact count an efficiency class () Tight lower bound: there exists an algorithm with the same efficiency as the lower bound

Example Problem Lower bound Tightness sorting (nlog n) yes searching in a sorted array (log n) yes element uniqueness (nlog n) yes n-digit integer multiplication (n) unknown multiplication of n-by-n matrices (n2) unknown

Methods for Establishing Lower Bounds trivial lower bounds information-theoretic arguments (decision trees) adversary arguments problem reduction

Trivial Lower Bounds Based on counting the number of items that must be processed in input and generated as output Examples finding max element sorting element uniqueness Not always useful

Decision Trees A convenient model of algorithms involving comparisons in which: internal nodes represent comparisons leaves represent outcomes

Decision tree for 3-element insertion sort

Decision Trees and Sorting Algorithms Any comparison-based sorting algorithm can be represented by a decision tree Number of leaves (outcomes)  n! Height of binary tree with n! leaves  log2n! Minimum number of comparisons in the worst case  log2n! for any comparison-based sorting algorithm log2n!  n log2n This lower bound is tight (mergesort)

Adversary Arguments Adversary argument: a method of proving a lower bound by playing role of adversary that makes algorithm work the hardest by adjusting input Example: “Guessing” a number between 1 and n with yes/no questions Adversary: Puts the number in a larger of the two subsets generated by last question

Lower Bounds by Problem Reduction Idea: If problem P is at least as hard as problem Q, then a lower bound for Q is also a lower bound for P. Hence, find problem Q with a known lower bound that can be reduced to problem P in question. Then any algorithm that solves P will also solve Q.

Example of Reduction Problem Q: Given a sequence of boolean values, does at least one of them have the value “true”? Problem P: Given a sequence of integers, is the maximum of integers positive? f(x1, x2, … xn) = y1, y2, … yn where yi = 0 if xi = false, yi = 1 if xi = true

P, NP, NP-complete, and NP-hard Problems Decision and Optimization problems Decidable, semi-decidable and undecidable problems Class P, NP, NP-complete and NP-hard problems

Decision and Optimization Problems Optimization problem: find a solution that maximizes or minimizes some objective function Decision problem: a question that has two possible answers yes or no. The question is about some input.

Decision Problems: Examples Given a graph G and a set of vertices K, is K a clique? Given a graph G and a set of edges M, is M a spanning tree? Given a set of axioms (boolean expressions) and an expression, is the expression provable under the axioms?

Decidability of Decision Problems A problem is decidable if there is an algorithm that says yes if the answer is yes, and no otherwise A problem is semi-decidable if there is an algorithm that says yes if the answer is yes, however it may loop infinitely if the answer is no. A problem is undecidable if we can prove that there is no algorithm that will deliver an answer.

Example of semi-decidable problem Given a set of axioms, prove that an expression is true. Problem 1: Let the axioms be: A v B A v C ~B Prove A. To prove A we add ~A to the axioms. If A is true then ~A will be false and this will cause a contradiction - the conjunction of all axioms plus ~A will result in False (A v B)  ~A = B B  (A v C) = (B  A) v (B  C) B  ~ B = False

Example of semi-decidable problem Problem 2: Let the axioms be: A v B A v C ~B Prove ~A. We add A and obtain: (A v C)  A = A (A v B)  A = A A  ~B = A  ~B (A  ~B)  (A v B) = A  ~ B ….. This process will never stop, because the expressions we obtain will always be different from False

Example of undecidable problem The halting problem   Let LOOP be a program that checks other programs for infinite loops: LOOP(P) stops and prints "yes" if P loops infinitely LOOP(P) enters an infinite loop if P stops  What about LOOP(LOOP)? http://www.cgl.uwaterloo.ca/~csk/washington/halt.html

Decision and Optimization Problems The classes P, and NP are defined for decidable decision problems Definition of Algorithm : a formal abstract device (Turing machine) that given an input (an instance of a problem) will process it in a finite number of steps

Turing Machines Turing machines are defined formally as a language recognition devices A string in a language may cause one of three things to happen – the machine may stop in a halting state 'yes', the machine may stop in a halting state 'no', the machine may loop infinitely. a) and b) - the language is decidable - i.e. the machine accepts a string if it is in the language (halts at 'yes') or rejects it if it is not in the language (halts at 'no').

Decidable and semi-decidable languages Decidable language: the machine accepts a string if it is in the language (halts at 'yes') or rejects it if it is not in the language (halts at 'no'). Semi-decidable language: the machine accepts a string if it is in the language (halts at 'yes') or may loop infinitely if it is not in the language

Problem Instances and Languages Problem instances can be treated as strings in some language. Example: the set of problem instances of all graphs that have a clique of size K. We can build a machine that will stop at 'yes' for each element in the set. The machine will stop at 'no' for any instance of a graph that does not have a clique of size K. The number of the steps determines the complexity class (P or NP) of the problem.

Decision Versions of Optimization Problems Optimization problems are not stated as "yes/no' questions. An optimization problem can be transformed to a decision problem using a bound on the solution Example: TSP Optimization: Find the shortest path that visits all cities TSP Decision: Is there a path of length smaller than B?

Class P P: the class of decision problems that are solvable in O(p(n)) time, where p(n) is a polynomial of problem’s input size n. Problems in this class are called tractable Examples: searching graph connectivity

Class NP NP (nondeterministic polynomial): class of decision problems whose proposed solutions can be verified in polynomial time = solvable by a nondeterministic polynomial algorithm. Problems in this class are called intractable

Nondeterministic Polynomial Algorithms An abstract two-stage procedure that: generates a random string purported to solve the problem checks whether this solution is correct in polynomial time By definition, it solves the problem if it is capable of generating and verifying a solution on one of its tries

Example: CNF Satisfiability I Problem: Is a boolean expression in its conjunctive normal form (CNF) satisfiable, i.e., are there values of its variables that makes it true? This problem is in NP. Nondeterministic algorithm: Guess truth assignment Substitute the values into the CNF formula to see if it evaluates to true

Example: CNF Satisfiability II (A | ¬B | ¬C) & (A | B) & (¬B | ¬D | E) & (¬D | ¬E) Truth assignments: A B C D E 0 0 0 0 0 . . . 1 1 1 1 1 Checking phase: O(n)

Problems in NP Hamiltonian circuit existence Partition problem: Is it possible to partition a set of n integers into two disjoint subsets with the same sum? Decision versions of TSP, knapsack problem, graph coloring, and many other combinatorial optimization problems. (Few exceptions include: MST, shortest paths)

P and NP All the problems in P can also be solved in this manner (but no guessing is necessary), so we have: P  NP Big question: P = NP ?

NP-Complete Problems I Definition: Problem A reduces to problem B, A ≤ p B if there is a function f that can be computed by an algorithm in polynomial time such that for all instances x, x A  f(x) B If we have a solution for B, then we have a solution for A. B is at least as hard as A.

NP-Complete Problems II Definition: 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

NP-Complete Problems III

Cook’s Theorem (1971) CNF-sat is NP-complete http://www.cs.toronto.edu/DCS/People/Faculty/sacook.html Other NP-complete problems can be 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 ? 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

NP-Hard Problems NP-hard problems are NP-complete but not necessarily in NP. Examples – the optimization versions of the NP problems