1 / 26

Lecture 22

Lecture 22. Hard Problems Introduction to NP. Key Words. Decision problem Optimization problem Non-deterministic algorithm NP-hard problem NP-complete problem Intractable problems Inherently difficult problems. Traveling Salesman Problem. Given : weighted complete graph G=(V,E,W)

grayc
Download Presentation

Lecture 22

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 22 Hard Problems Introduction to NP

  2. Key Words • Decision problem • Optimization problem • Non-deterministic algorithm • NP-hard problem • NP-complete problem • Intractable problems • Inherently difficult problems

  3. Traveling Salesman Problem • Given: weighted complete graph G=(V,E,W) • Tour: visits all vertices exactly once • Cost of the tour: sum of weights of traversed edges • Optimization Problem: Find Optimal (Min Cost) Tour • Decision Problem: given a value w. Is there a tour of weight < w?

  4. 0-1 Knapsack Problem • Given: n items weighting w1, w2, …, wn lbs valued at p1, p2, …, pn $’s a knapsack of capacity W • Optimization Problem: Find maximum total of profit of items that can be placed in the knapsack • Decision Problem: Given also a profit P Find if there is a set of items of total weight <W with profit >P

  5. Can associate a DECISION PROBLEMto anyOPTIMIZATION PROBLEM

  6. Graph Coloring Problem • Given: a graph G=(V,E) • Coloring of G: coloring of vertices so that adjacent vertices get different colors • Optimization Problem: Find a coloring of G with minimum number of colors • Decision Problem: given a number k of colors. Is there a coloring with < k colors?

  7. Clique Problem • Given: a graph G=(V,E) • Clique: complete subgraph • Optimization Problem: Find the largest clique • Decision Problem: given a number k. Is there a clique of size >= k colors?

  8. Hamilton Cycle Problem • Given: a graph G=(V,E) • Hamilton Cycle: a cycle visiting every vertex exactly once (without repetitions) • Decision Problem: Is there a Hamilton cycle?

  9. Traveling Salesman Problem • Given: weighted complete graph G=(V,E,W) • Tour: visits all vertices exactly once • Cost of the tour: sum of weights of traversed edges • Optimization Problem: Find Optimal (Min Cost) Tour • Decision Problem: given a value w. Is there a tour of weight < w?

  10. Circuit Satisfiability • Logic gates: AND, OR, NOT • See how they operate: http://www.thefrog.com/javascript/boxes/ • Given: a circuit built up with logic gates, with n inputs x1, x2, … , xn and one output • The circuit is satisfied for some input values of 0/1 associated to x1, x2, … , xn if output of the circuit is 1. • Decision Problem: is there an assignment of 0/1 values to x1, x2, … , xn so that the circuit is satisfied?

  11. Formula Satisfiability • Logic operators: AND, OR, NOT • Variables: x1, x2, … , xn • Boolean formula: ((x1 AND x2) OR (NOT x3 )) • Given: a boolean formula F with n variables x1, x2, … , xn • The formula is satisfied for some input values of 0/1 associated to x1, x2, … , xn if it evaluates to 1. • Decision Problem: is there an assignment of 0/1 values to x1, x2, … , xn so that the formula F is satisfied?

  12. CNF Formula Satisfiability • CNF= Conjunctive Normal Form: conjunction of disjunctions ((.. OR..) AND (.. OR..) AND (..)) • AND: conjunction • OR: disjunction • Boolean formula: ((x1 AND x2) OR (NOT x3 )) • Given: a boolean formula F in CNF with n variables x1, x2, … , xn • Decision Problem: is there an assignment of 0/1 values to x1, x2, … , xn so that the CNF formula F is satisfied?

  13. 3SAT: Satisfiability of CNF Formulas with 3 literals per disjunction • Instance of 3SAT: ( (NOT x1) AND x2 AND x3) OR (x1 AND x3 AND x4) ) • Given: a boolean formula F in CNF with n variables x1, x2, … , xn, with 3 literacls per clause • Decision Problem: is there an assignment of 0/1 values to x1, x2, … , xn so that the formula F is satisfied?

  14. Hardness of these Problems • None of the problems presented before is known to have a polynomial time algorithm • But they all have a common property: that if a solution is given, it is easy to verify it

  15. Verification Problems • Given a decision problem: Does there exist x such that a property holds? • Verification Problem: given an object y, claimed to be a solution to the decision problem, verify that it is indeed the case

  16. Examples • Verify that a tour is a TSP tour of weight < w • Verify that a given coloring with k colors is valid • Verify that a given complete subset of k vertices is a clique of G • Verify that a certain assignment of 0/1 values satisfies a boolean circuit/formula • Verify that a certain subset of items fits into a knapsack and has profit larger than P

  17. Can associate a VERIFICATION PROBLEMto anyDECISION PROBLEM

  18. It is easy to see that the VERIFICATION PROBLEM for • Traveling Salesman Problem • 0-1Knapsack • Graph Coloring • Clique • Circuit Satisfiability • Hamilton Tour is in P (can be done in polynomial time)

  19. General “algorithm” for such problems: • Guess a candidate for a solution • Verify if it is a solution • If you are lucky, you’re done • Else you might have to generate all possible candidate solutions to find one, or say that none exists

  20. Relating the Decision Problem to the Verification Problem TSP: is there …. so that … “a tour”: object can be described in polynomial space “it has a weight < w”: property can be verified in polynomial time

  21. Complexity Class NP Class of all decision problems that can be described as: is there ….(a candidate solution describable in polynomial space) so that … (property that can be verified in polynomial time holds)? NP= nondeterministic polynomial time

  22. MOST FAMOUS OPEN PROBLEMin THEORETICAL COMPUTER SCIENCE

  23. P = NP?

  24. What if ? • TRUE: then all the previously listed problems would have polynomial time algorithms • FALSE: one should stop looking for polynomial time algorithms for these problems, since none would exist (deep theorem, due to S. Cook – done in 353 Complexity Theory). This would imply a lower bound on the complexity of all of these problems.

  25. NP-complete problems • If you proved that there is no polynomial time algorithm for any of them, you proved that there is no polynomial time algorithm for all the problems in NP • If you proved there exists a polynomial time algorithm for any of them, then you proved there is a polynomial time algorithm for all of the problems in NP.

  26. NP-Complete Problems • TSP • Hamilton Cycle • Graph Coloring • 0-1 Knapsack • CNF Formula Satisfiability, etc are as HARD as any other problem in NP

More Related