Understanding NP-Completeness and Beyond in Computer Science

http 1 bp blogspot com 0y ayb z8bw s chjjh0ji n.w
1 / 30
Embed
Share

Dive into the world of NP-Completeness and beyond with a focus on algorithms and complexity. Explore topics such as NP-Completeness proofs, reducibility among combinatorial problems, populating the NP-Completeness universe, coping strategies for NP-Completeness, and more. Get ready for the Final Exam and enhance your knowledge in this fascinating area of computer science.

  • Computer Science
  • Algorithms
  • NP-Completeness
  • Complexity
  • Final Exam

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. http://1.bp.blogspot.com/_0Y-AYb-z8Bw/S--chJjH0JI/AAAAAAAAATU/QngzjH9rMa0/s1600/dr-seuss-on-beyond-zebra.jpghttp://1.bp.blogspot.com/_0Y-AYb-z8Bw/S--chJjH0JI/AAAAAAAAATU/QngzjH9rMa0/s1600/dr-seuss-on-beyond-zebra.jpg NP- Complete P CSE 417 Algorithms and Complexity Autumn 2024 Lecture 29 NP-Completeness and Beyond

  2. Announcements Exam practice problems on course homepage Final Exam: Monday, December 9, 8:30 AM Mon, Dec 2 Wed, Dec 4 Fri, Dec 6 Mon, Dec 9 NP-Completeness NP-Completeness NP-Completeness and Beyond Final Exam This is my last lecture 2

  3. NP-Completeness Proofs Prove that problem X is NP-Complete Show that X is in NP (usually easy) Pick a known NP complete problem Y Show Y <P X 3

  4. Reducibility Among Combinatorial Problems 4

  5. Populating the NP-Completeness Universe NP-Complete Circuit Sat <P 3-SAT 3-SAT <P Independent Set 3-SAT <P Vertex Cover Independent Set <P Clique 3-SAT <P Hamiltonian Circuit Hamiltonian Circuit <P Traveling Salesman 3-SAT <P Integer Linear Programming 3-SAT <P Graph Coloring 3-SAT <P Subset Sum Subset Sum <P Scheduling with Release times and deadlines NP P 5

  6. Coping with NP-Completeness Approximation Algorithms Exact solution via Branch and Bound Local Search http://inf421.files.wordpress.com/2011/10/gj3.gif 6 I can t find an efficient algorithm, but neither can all these famous people.

  7. Multiprocessor Scheduling Unit execution tasks Precedence graph K-Processors Polynomial time for k=2 Open for k = constant NP-complete is k is part of the problem 7

  8. Highest level first is 2-Optimal Choose k items on the highest level Claim: number of rounds is at least twice the optimal. 8

  9. Christofides TSP Algorithm Undirected graph satisfying triangle inequality 1. Find MST 2. Add additional edges so that all vertices have even degree 3. Build Eulerian Tour 3 4 4 1 2 5 3/2 Approximation 5 3 6 4 3 3 4 2 6 5 9

  10. Christofides Algorithm 3 4 3 4 4 1 4 1 2 2 5 5 5 3 5 3 6 6 4 4 3 3 3 4 3 2 4 2 6 5 6 5 3 4 1 2 5 3 4 3 4 2 6 10

  11. Branch and Bound Brute force search tree of all possible solutions Branch and bound compute a lower bound on all possible extensions Prune sub-trees that cannot be better than optimal 11

  12. Branch and Bound for TSP Enumerate all possible paths Lower bound, Current path cost plus MST of remaining points Euclidean TSP Points on the plane with Euclidean Distance Sample data set: State Capitals 12

  13. Local Optimization Improve an optimization problem by local improvement Neighborhood structure on solutions Travelling Salesman 2-Opt (or K-Opt) Independent Set Local Replacement 13

  14. What we dont know P vs. NP P = NP NP-Complete P 14

  15. If P NP, is there anything in between Yes, Ladner [1975] Problems not known to be in P or NP Complete Factorization Discrete Log Graph Isomorphism Solve gk = b over a finite group 15

  16. Complexity Theory Computational requirements to recognize languages Models of Computation Resources Hierarchies //complexityzoo.net 16

  17. Time complexity P: (Deterministic) Polynomial Time NP: Non-deterministic Polynomial Time EXP: Exponential Time 17

  18. Space Complexity Amount of Space (Exclusive of Input) L: Logspace, problems that can be solved in O(log n) space for input of size n Related to Parallel Complexity PSPACE, problems that can be required in a polynomial amount of space 18

  19. Other types of computation Randomization Can you solve problems faster with a random number generator? Quantum Computers Can you solve problems faster if you have quantum bits which allow superposition? Probably yes: Shor s Integer Factoring algorithm 19

  20. So what is beyond NP? http://1.bp.blogspot.com/_0Y-AYb-z8Bw/S--chJjH0JI/AAAAAAAAATU/QngzjH9rMa0/s1600/dr-seuss-on-beyond-zebra.jpg 20

  21. NP vs. Co-NP Given a Boolean formula, is it true for some choice of inputs Given a Boolean formula, is it true for all choices of inputs 21

  22. Problems beyond NP Exact TSP, Given a graph with edge lengths and an integer K, does the minimum tour have length K Minimum circuit, Given a circuit C, is it true that there is no smaller circuit that computes the same function a C 22

  23. Polynomial Hierarchy Level 1 X1 (X1), X1 (X1) Level 2 X1 X2 (X1,X2), X1 X2 (X1,X2) Level 3 X1 X2 X3 (X1,X2,X3), X1 X2 X3 (X1,X2,X3) 23

  24. Polynomial Space Quantified Boolean Expressions X1 X2 X3... Xn-1 Xn (X1,X2,X3 Xn-1Xn) Space bounded games Competitive Facility Location Problem N x N Chess PSpace- Complete Counting problems The number of Hamiltonian Circuits Log Space P 24

  25. N X N Chess 25

  26. Even Harder Problems public int[] RecolorSwap(int[] coloring) { int k = maxColor(coloring); for (int v = 0; v < nVertices; v++) { if (coloring[v] == k) { int[] nbdColorCount = ColorCount(v, k, coloring); List<Edge> edges1 = vertices[v].Edges; foreach (Edge e1 in edges1) { int w = e1.Head; if (nbdColorCount[coloring[w]] == 1) if (RecolorSwap(v, w, k, coloring)) break; } } } return coloring; } Is this code correct? 26

  27. Halting Problem Given a program P that does not take any inputs, does P eventually exit? 27

  28. Impossibility of solving the Halting Problem Suppose Halt(P) returns true if P halts, and false otherwise bool G { if (Halt(G)){ while (true) ; } else { return true; } } Consider the program G: What is Halt(G)? 28

  29. Undecidable Problems The Halting Problem is undecidable Impossible problems are hard . . . 29

  30. 30

Related


More Related Content