Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.

Slides:



Advertisements
Similar presentations
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
Advertisements

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.
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
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.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Computational problems, algorithms, runtime, hardness
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
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
NP-Completeness NP-Completeness Graphs 4/17/2017 4:10 AM x x x x x x x
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.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
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.
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:
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
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.
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.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
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.
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.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete Problems Algorithm : Design & Analysis [23]
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.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
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.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
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.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
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
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
ICS 353: Design and Analysis of Algorithms
NP-Complete Problems.
P, NP and NP-Complete Problems
The Theory of NP-Completeness
P, NP and NP-Complete Problems
Presentation transcript:

Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics for Managers using Excel by Levine (2) Computer Algorithms: Introduction to Design & Analysis by Baase and Gelder (slides by Ben Choi to accompany the Sara Baase’s text). (3) Discrete Mathematics by Richard Johnsonbaugh 1 Conceptual Foundations (MATH21001) Lecture Week 11 Reading: Textbook, Chapter 11: NP-Complete Problems

2 Learning Objectives In this lecture, you will learn:  Class NP  NP-complete problem  NP-completeness proofs  Traveling salesperson problem

3 Abstract Problems  a formal notion of what a “problem” is  high-level description of a problem  We define an abstract problem Q to be  a binary relation on  a set I of problem instances, and  a set S of problem solutions.  Q  I  S  Three Kinds of Problems  Decision Problem  e.g. Is there a solution better than some given bound?  Optimal Value  e.g. What is the value of a best possible solution?  Optimal Solution  e.g. Find a solution that achieves the optimal value.

4 Encodings  // Data Structure  describing abstract problems (for solving by computers)  in terms of data structure or binary strings  An encoding of a set S of abstract objects is  a mapping e from S to the set of binary strings.  Encoding for Decision problems  Problem instances, e : I  {0, 1}*  Solution, e : S  {0, 1}  “Standard” encoding  computing time may be a function of encoding  // The size of the input (the number of bit to represent one input)  polynomially related encodings  assume encoding in a reasonable concise fashion

5 Concrete Problem  problem instances and solutions are represented in data structure or binary strings  // Language (in formal-language framework)  We call a problem whose instance set (and solution set) is the set of binary strings a concrete problem.  Computer algorithm solves concrete problems!  solves a concrete problem in time O(T(n))  if provided a problem instance i of length n = |i|,  the algorithm can produce the solution  in a most O(T(n)) time.  A concrete problem is polynomial-time solvable  if there exists an algorithm to solve it in time O(n k )  for some constant k. (also called polynomially bounded)

6 Class of Problems  // What makes a problem hard?  // Make simple: classify decision problems  Definition: The class P  P is the class of decision problems that are polynomially bounded.  // there exist a deterministic algorithm  Definition: The class NP  NP is the class of decision problems for which there is a polynomially bounded non-deterministic algorithm.  The name NP comes from “Non-deterministic Polynomially bounded.”  // there exist a non-deterministic algorithm  Theorem: P  NP

7 The Class NP  NP is a class of decision problems for which  a given proposed solution (called certificate) for  a given input  can be checked quickly (in polynomial time)  to see if it really is a solution.  A non-deterministic algorithm  The non-deterministic “guessing” phase.  Some completely arbitrary string s, “proposed solution”  each time the algorithm is run the string may differ  The deterministic “verifying” phase.  a deterministic algorithm takes the input of the problem and the proposed solution s, and  return value true or false  The output step.  If the verifying phase returned true, the algorithm outputs yes. Otherwise, there is no output.

8 The Class NP-Complete  A problem Q is NP-complete  if it is in NP and  it is NP-hard.  A problem Q is NP-hard  if every problem in NP  is reducible to Q.  A problem P is reducible to a problem Q if  there exists a polynomial reduction function T such that  For every string x,  if x is a yes input for P, then T(x) is a yes input for Q  if x is a no input for P, then T(x) is a no input for Q.  T can be computed in polynomially bounded time.

9 Polynomial Reductions  Problem P is reducible to Q  P  p Q  Transforming inputs of P  to inputs of Q  Reducibility relation is transitive.

10 Circuit-satisfiability problem is NP- Complete  Circuit-satisfiability problem  belongs to the class NP, and  is NP-hard, i.e.  every problem in NP is reducible to circuit-satisfiability problem!  Circuit-satisfiablity problem  we say that a one-output Boolean combinational circuit is satisfiable  if it has a satisfying assignment,  a truth assignment (a set of Boolean input values) that  causes the output of the circuit to be 1  Proof…

11 NP-Completeness Proofs  Once we proved a NP-complete problem  To show that the problem Q is NP-complete,  choose a know NP-complete problem P  reduce P to Q  The logic is as follows:  since P is NP-complete,  all problems R in NP are reducible to P, R  p P.  show P  p Q  then all problem R in NP satisfy R  p Q,  by transitivity of reductions  therefore Q is NP-complete

12 Solving hard problems: Approximation Algorithms  an algorithm that returns near-optimal solutions  may use heuristic methods  e.g. greedy heuristics  Definition:Approximation algorithm  An approximation algorithm for a problem is  a polynomial-time algorithm that,  when given input I, outputs an element of FS(I).  Definition: Feasible solution set  A feasible solution is  an object of the right type but not necessarily an optimal one.  FS(I) is the set of feasible solutions for I.

13 Approximation Algorithm e.g. Bin Packing  How to pack or store objects of various sizes and shapes  with a minimum of wasted space  Bin Packing  Let S = (s 1, …, s n )  where 0 < s i <= 1 for 1 <= i <= n  pack s 1, …, s n into as few bin as possible  where each bin has capacity one  Optimal solution for Bin Packing  considering all ways to  partition S into n or fewer subsets  there are more than  (n/2) n/2 possible partitions

14 Bin Packing: First fit decreasing strategy  places an object in the first bin in which it fits  W(n) in  (n 2 )

15 Algorithm: Bin Packing (first fit decreasing)  Input: A sequence S=(s 1,…., s n ) of type float, where 0<s i <1 for 1<=i<=n. S represents the sizes of objects {1,...,n} to be placed in bins of capacity 1.0 each.  Output: An array bin where for 1<=i<=n, bin[i] is the number of the bin into which object i is placed.For simplicity,objects are indexed after being sorted in the algorithm.The array is passed in and the algorithm fills it.  binpackFFd(S,n,bin)  float[] used=new float[n+1];  //used[j] is the amount of space in bin j already used up.  int i,j;  Initialize all used entries to 0.0  Sort S into descending(nonincreasing)order,giving the sequence s 1 >=S 2 >=…>=S n.  for(i=1;i<=n;i++)  //Look for a bin in which s[i] fits.  for(j=1;j<=n;j++)  if(used[j]+s i <+1.0)  bin[i]=j;  used[j] += s i ;  break; //exit for(j)  //continue for(i).

16 The Traveling Salesperson Problem  given a complete, weighted graph  find a tour (a cycle through all the vertices) of  minimum weight  e.g.

17 Approximation algorithm for TSP  The Nearest-Neighbor Strategy  as in Prim’s algorithm …  NearestTSP(V, E, W)  Select an arbitrary vertex s to start the cycle C.  v = s;  While there are vertices not yet in C:  Select an edge vw of minimum weight, where w is not in C.  Add edge vw to C;  v = w;  Add the edge vs to C.  return C;  W(n) in O(n 2 )  where n is the number of vertices

18 Summary  Introduced combinatorial optimization problems  Discussed NP-complete problems  Discussed approximation algorithms  Discussed traveling salesperson problem In this lecture, we have