190 likes | 354 Views
More Computational Complexity. Shirley Moore CS4390/5390 Fall 2013 http://svmoore.pbworks.com/ August 29, 2013. Agenda. Announcements (3 min) Recap previous class (6 min) Discuss Fortnow article (6 min) Reducibility (20 min) Proving NP-completeness (20 min)
E N D
More Computational Complexity Shirley Moore CS4390/5390 Fall 2013 http://svmoore.pbworks.com/ August 29, 2013
Agenda • Announcements (3 min) • Recap previous class (6 min) • Discuss Fortnow article (6 min) • Reducibility (20 min) • Proving NP-completeness (20 min) • Average-case complexity (20 min) • Wrap-up and homework assignment (5 min)
Announcements • Change in class location • Pre-course survey now available
Recap from Tuesday • Explain in your own words • what it means for a problem to be NP-complete • how one can show that a problem is NP-complete
Discussion of Status of P vs NP • Much of cryptography depends on integer factorization being hard. • true • false • If P = NP, then integer factorization is in P. • true • false • If integer factorization is in P, then P = NP. • true • false • We don’t know, but unlikely • If SAT3 is in P, then integer factorization is in P. • true • false • We don’t know
Status of P vs. NP (cont.) • Do you think P = NP? (no wrong answer!) • Yes • No • Do you think the P vs. NP problem will • never be solved? • be solved soon (i.e., in a few years)? • be solved in your lifetime? • be solved 100 years or more from now? • What else did you find of interest in the Fortnow article?
Learning Outcomes from August 27 • After completing this lesson, you should be able to • Define the complexity classes P and NP • Define NP-complete • Discuss implications of computational complexity for cryptography • Apply logical proof techniques in the context of computational complexity
Learning Outcomes • After completing today’s lesson successfully, you will be able to • Define reducibility • Devise polynomial time reductions from one problem to another • Explain how to use polynomial reduction as a strategy to prove a problem is NP-complete • Explain the difference between worst-case and average-case time complexity • Explain and give an example of a randomized algorithm • Discuss the relevance of average-case complexity analysis to cryptography
Reducibility • A reduction is a way of converting one problem to a second problem, so that the solution to the second problem can be used to solve the first. • If problem A is reducible to problem B, then solving problem A cannot be “harder” than solving problem B. • A is polynomial time reducible to B if A can be converted to B in polynomial time. • If B is in NP and an NP-complete problem A is polynomial time reducible to B, then B is NP-complete.
Class Exercise 1 • Show that the Hamilton cycle problem and the Hamiltonian path problem for an undirected graph are polynomial time reducible to each other.
SAT Problem • Satisfiability Problem (SAT): Given a set of clauses, is there an assignment of truth values to the variable such that the set is satisfiable? • (v1, v2’, v3), (v2), (v1’, v3) Yes • (v1, v2’, v3), (v2), (v2’, v3’), (v1’, v3) No • Recall definition of NP-complete: A problem L is NP-complete if and only if 1) L is in NP, and 2) every other problem in NP can be reduced to L in polynomial time. • How can you show that SAT is NP-complete by working from the definition of NP-complete? • After proving SAT is NP-complete, how can you show that another problem B is NP-complete? Then how can you show another problem C is NP-complete (Hint: you have a choice of two ways)?
NP-Completeness of Hamiltonian Cycle • Show that Hamiltonian Cycle is in NP. • Reduce a known NP-complete problem to Hamiltonian Cycle in polynomial time.
Class Exercise 2: NP-Completeness of Traveling Salesman Problem (TSP) • Traveling Salesman Problem (TSP): Given n cities and distances d(i,j) between each pair of cities, does there exist a tour of length ≤ k that visits each city and returns to the starting point? • Given that Hamiltonian Cycle is NP-complete, show that TSP is NP-complete. • See www.math.uwaterloo.ca/tsp for more about TSP if you’re interested.
Does guessing help? • Can “guessing” a solution to a “hard” problem be a good strategy for finding a solution in a reasonable amount of time? • Consider the following randomized algorithm for solving the Hamiltonian path problem: • Start from a random vertex and continue to pick the next vertex randomly if there is a neighbor not yet visited. If there are no more unvisited neighbors, and then path isn’t Hamiltonian, pick a neighbor of the current vertex at random and rotate using that neighbor as a pivot (i.e., add an edge to that neighbor to the path and remove one of the existing path edges from the neighbor so as not for form a loop). Continue from the new end of the path. • Example: Graph with nodes ABCDE and edges AD, DC, DE, CE, BC.
Average-case Runtime for Randomized Hamiltonian Path Algorithm • Gurevich and Shelah, “Expected computation time for Hamiltonian path problem”, SIAM J. Computing 16(3), June 1987. • For fixed p, the expected runtime of the algorithm on a graph with n vertices and edge probability p is O(n).
Average-case Complexity • Average-case polynomial time: Algorithm for solving problem L on input distribution μ is always correct but may take superpolynomial time on some inputs. • Heuristic polynomial time: Algorithm for solving problem L on input distribution μ always runs in polynomial time but may give incorrect answers on some inputs. • Which of the above two types is the randomized Hamiltonian Cycle algorithm? • All of cryptography is predicated on the existence of average-case intractable problems in NP. • Need an average-case analog of the theory of NP-completeness.
An Easy-to-Break NP-complete Cipher • Abraham Lempel, “Crytology in Transition”, ACM Computing Surveys 11(4), Dec. 1979 • Demonstrated a cipher for which the problem of breaking its key is NP-complete even under chosen plaintext attack. • However, given enough plaintext, the problem of breaking the key reduces, with probably approaching unity, to that of solving a linear system of n equations in n unknowns, where n is the number of key bits.
Homework • Prove: If B is NP-complete, C is in NP, and B is polynomial time reducible to C, then C is NP-complete. • Consider the 3SAT problem, where the input size is the number of variables. • Devise an algorithm that solves the 3SAT problem correctly for all inputs. What is the complexity class of your algorithm? • Devise a randomized algorithm with polynomial runtime for the 3SAT problem. Your algorithm may produce incorrect results for some inputs. (Extra credit challenge: Can you bound the error for your algorithm?)
Reflective Writing • Summarize in one to two sentences the main learning objectives we attempted to accomplish this week. • What did you learn this week that surprised you? • What was your muddiest point – i.e., what did you least understand?