1 / 43

CSCI 4325 / 6339 Theory of Computation

CSCI 4325 / 6339 Theory of Computation. Zhixiang Chen. Chapter 6 Computational Complexity. NP. NP-complete. P. The New World. Polynomially Bounded TM’s. Definition. A TM M=(K, ∑, δ ,s,H) is said to be polynomially bounded if there is polynomial p(n) such that the following is true:

zeph-nieves
Download Presentation

CSCI 4325 / 6339 Theory of Computation

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. CSCI 4325 / 6339Theory of Computation Zhixiang Chen

  2. Chapter 6 Computational Complexity

  3. NP NP-complete P The New World

  4. Polynomially Bounded TM’s • Definition. A TM M=(K,∑,δ,s,H) is said to be polynomially bounded if there is polynomial p(n) such that the following is true: • For any input x, the computation of M on x ends in no more p(|x|)+1 steps.

  5. Polynomially Decidable Languages • Definition. A language is called polynomially decidable is there is a polynomially bounded TM that decides it.

  6. The Class P • Definition. The class P is the set of all polynomially decidable languages. • Examples. • The set of even integers • The set of connected graphs • Other examples?

  7. Quantitative Refinement of the Church-Turing Thesis • Any problem which is intuitively feasibly solvable is solvable by a polynomially bounded TM. • Any problem which is solvable by a polynomially bounded TM is intuitively feasibly solvable.

  8. Theorem • Theorem 6.1.1. The class P is closed under complement. • Proof. (Prove in class.)

  9. Something not in P • Definition. Define • E={encode(M)encode(w): M accepts w in but steps} • Theorem. • Proof. By contradiction. Consider a special case of E: M accepts encode(M) but steps} Prove

  10. New Notations • For simplicity • We use “M” to denote the encode(M) of a TM M • We also use “w” to denote the encode(w) of a string w.

  11. Some Coments • Comments on polynomial time bounded decidability • Practically feasible? • It’s based on worst-case performance analysis • How about average-case performance analysis?

  12. Problems vs. Languages • Given any TM M and any input w, will M halts on w? • This is a problem. • Define • This is a language. • The fact • The problem and the language are equivalent!

  13. Problems vs. Languages • Given any string w, will w have property P? • This is a problem. • Define • This is a language. • The fact again • The problem and the language are equivalent! • Conclusion: • A problem is a language. • A language is a problem.

  14. Eulerian Graphs • Euler Cycle Problem: Given a graph G, is there a closed path in G that uses each edge exactly once? • A graph that has a Euler cycle is called Eulerian. • Ex’s

  15. Eulerian Graphs • Euler Cycle Problem is in P. That is, is in P. • Proof. By Euler Theorem: • Euler Theorem. A graph G is Eulerian iff the following two conditions are true: • For any pair of nodes u, v in G, there is a path from u to v. • All nodes have equal numbers of incoming and outgoing edges

  16. Hamiltonian Graphs • Hamilton Cycle Problem: Given a graph G, is there a cycle that passes through each node of G exactly once? • A graph with a Hamilton cycle is called Hamiltonian • Is Hamilton Cycle Problem in P? • Do you know the answer? • Do you have an algorithm for solving Hamilton Cycle Problem? • What is the complexity of your algorithm?

  17. Yes/No Problems • A yes/no problem is a problem with a yes or no answer. • Euler Cycle Problem and Hamilton Cycle Problem are yes/no problems.

  18. Optimization Problems • Traveling Salesman Problem. Given a weighted graph G, find a shortest path touring all nodes in a graph. • Translate Optimization Problem to Yes/No Problem: • Given an integer and an distance matrix and an integer find a Hamiltonian cycle with distance • The above optimization problem and the yes/no problem are “equivalent”. • In general, any optimization problem can translated to an “equivalent” yes/no problem.

  19. Independent Set Problem • Given an undirected graph G=(V,E) and an integer is there a subset C of V with such that for all there is no edge between and • Ex’s?

  20. Clique Problem • Given an undirected graph G=(V,E) and an integer is there a subset C of V with such that for all there is an edge between and • Ex’s?

  21. Node Cover Problem • Given an undirected graph G=(V,E) and an integer is there a subset C of V with such that C covers all edges of G? • Note: C covers an edge if it contains at least on endpoint of the edge. • Ex’s?

  22. Integer Partition Problem • Given a set of n nonnegative integers represented in binary, is there a subset such that • Ex’s?

  23. Solution to Integer Partition Problem • Compute • If H is not an integer then stop and say no • Otherwise compute B(i) for • b is the sum of some subset of } • Algorithm for computing B(i): • B(0)={0} • For do • For do • If then add to B(i)

  24. Example • Work on the following set of integers to determine the answer to the partition problem. • H = 151 • B(0) = {0} • B(1) = {0, 38} • B(2) = {0, 17, 38, 55} • B(3) = {0, 17, 38, 52, 55, 69, 90, 107} • B(4) = {0, 17, 38, 52, 55, 61, 69, 78, 90, 107, 113, 116, 130, 151} • … • B(7) = {…, 151} • Answer: yes.

  25. Complexity of the Algorithm for Computing B(i) • The complexity if O(nH) • Outer loop runs n times • Inner loop runs H times • So, it the Partition Problem in P? • Just from O(nH), it seems the problem in P. • What is wrong???????

  26. Boolean Satisfiability Problem • Definition. • Let be a finite set of Boolean variables, and let be the set of negations of variables in X. • Call elements in as literals • Negations of variables are called negative literals.

  27. Boolean Satisfiability Problem • Definition. • Clause: A clause C is a nonempty set of literals, i.e. • Boolean formula in CNF: A Boolean CNF is a set of clauses

  28. Examples • Let • Clauses: • CNF:

  29. Boolean Satisfiability Problem • Truth Assignment: • a map from X to {0,1} • 0 means false • 1 means true • A clause is true under an assignment if that assignment make at least of its literals true. • A CNF is true under an assignment if that assignment makes all clauses true. • A CNF is satisfiable, if there is an assignment making it true. • Ex’s?

  30. Boolean Satisfiability Problem • The SAT Problem: Given a Boolean CNF F, is F satisfiable? • The 2-SAT Problem: Given a Boolean CNF F such that each clause in F has at most two literals, is F satisfiable? • The 3-SAT Problem: Given a Boolean CNF F such that each clause in F has at most three literals, is F satisfiable?

  31. 2-SAT Problem • Theorem. 2-SAT is in P.

  32. 2-SAT Problem • Algorithm solving 2-SAT • Phase 1. Purge Process • Repeat • Scan clause in the input CNF F to find a single literal x • Set x to be true. And remove all clauses with x from F, and remove negative x from these clause containing negative x • Fail if an empty clause is generated, and stop and say no. • Until no more single clause in F. • Phase 2. Try Two Values Process • Repeat • Choose a literal x in the remained F • Set x to be true, and do “Purge Process” • Set x to be false and do “purge Process” • If both processes fail, then stop and say no. • Until no more literal left. • Phase 3. Final Checking • Say true, if no fail occurs in Phase 2.

  33. 2-SAT Problem • The complexity of previous algorithm • Let n be the number of distinct variables in F • Let m be the number of clauses in F • Phase 1 Time • Phase 2 time • Total time • Conclusion. 2-Sat is in P.

  34. Nondeterministic Ploynomially Bounded TM’s • Definition. A NTM M=(K,∑,Δ,s,H) is said to be polynomially bounded is there is polynomial p(n) such that the following is true: • For any input x, all possible computations of M on x ends in no more p(|x|)+1 steps. • In other words, the depth of the computation tree of M on x is no more than p(|x|)+1.

  35. The NP Class • Definition. The class NP is the set of all languages that are decided by ploynomially bounded NTM’s

  36. Tree depth p(|w|) ……………… Poly-Bounded Computation Trees

  37. Problems in NP • Problems in NP: • SAT • Hamilton Cycle Problem • TSP • Independent Set Problem • Clique Problem • Covering Problem • Partition Problem

  38. Proving a Problem in NP • Two steps: • Nondeterministically guess an answer in poly-time • Deterministically verify the guessed answer is indeed an answer in poly-time • Show proof examples in class.

  39. Exponentially Bounded Deterministic TM’s • Definition. A TM M=(K,∑,δ,s,H) is said to be exponentially bounded is there is polynomial p(n) such that the following is true: • For any input x, the computation of M on x ends in no more than steps.

  40. The Class EXP • Definition. The class EXP is the set of all problems that are decidable by exponentially-bounded TM’s.

  41. P, NP, vs. EXP • Theorem. If L is in NP, then L is in EXP. • Proof. A poly-bounded computation tree can be simulated an exponentially bounded computation. • Theorem. • Proof. Consider the exponentially bounded version of H.

  42. NP EXP P The New World

  43. Open Questions

More Related