1 / 24

Complexity

Complexity. Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings. Decidability. A language is decidable (aka Turing decidable) if a TM decides it, meaning it halts in an accepting or a non-accepting state. It does not loop. Non-determinism.

Download Presentation

Complexity

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. Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.

  2. Decidability • A language is decidable (aka Turing decidable) if a TM decides it, meaning it halts in an accepting or a non-accepting state. • It does not loop.

  3. Non-determinism • Concept that can be applied to FSA, PDA, and TM • Start with FSA • NDFSA has choices at each state • So a NDFSA has finite set of states, finite alphabet, start state, set of accepting states and rules of the form State x (Alphabet + empty string) =>subset of states. • Think of it as choices

  4. Non-determinism • extend to PDA and TM • In terms of computation power, for every NDFSA there is a (standard) FSA and the same holds for PDAs and TMs. • increase states to be set of all subsets of the states. • This is an exponential increase in number of states.

  5. Consider • Consider original set of states, the the Power set is the set of all subsets: • For {a,b}, the is the empty set, {a},{b} and {a,b} • for {a,b,c} ? • for {a,b,c,d} ? • Generalize?

  6. Back to complexity • So adding the non-determinism option (may think of it as guessing a solution), doesn't effect the programming power but does effect the complexity.

  7. Fact • If T is a non-deterministic TM that computes in O(f(n)), then there is a deterministic TM that computes in 2 O(f(n)) . • The proof (look it up!) does not mean there isn't a faster deterministic TM.

  8. The class P • consists of all languages that are decidable in polynomial time by a deterministic TM. • P = UNION TIME(nk) • These correspond to all problems that are realistically solvable • though there is a big difference between problems solvable in linear time and problems solvable only in n2 or n3 or higher

  9. Examples of languages in P • Every regular language • Every context free language

  10. Question • If the requirement was to sort a set of 10000 records, then what would be the difference between using a bubble sort and a heap sort?

  11. The class NP • consists of all languages that are decidable in polynomial time by a nondeterministic TM. • NP = UNION NTIME(nk)

  12. Examples of NP • clique = {<G,k< | G is an undirected graph with a k-clique (subgraph with every pair of nodes connected) • …

  13. The class NP • alternate definition: verifier • Informal idea: if we had some information, called a certificate or proof and a way of using this certificate, then we have a verifier. • Formal, a verifier for a language A is an algorithm V, whereA = {w | V accepts <w,c> for some c} • NP is the set of languages that have polynomial time verifiers.

  14. Generic Example • Problem is: does there exist a path • Verifier could be the path which can be checked in polynomial time.

  15. P versus NP • P is the class of languages for which membership can be decided quickly. • NP is the class of languages for which membership can be verified quickly. • where quickly means polynomial time.

  16. Does P = NP? • It is known how to produce a deterministic TM that does the job, but much slower involving a exponential increase in the number of states. • But perhaps there is something better?

  17. NP-completeness • A large and growing number of NP problems that can be converted into each other in polynomial time. • … MEANING that if one can be solved in polynomial time, they all can be.

  18. Example: Satisfiability • A Boolean formula is an expression consisting of Boolean (true/false) variables and AND and OR and NOT operators. • A formula is satisfiable if there is an assignment to its variables that makes the formula true. • x AND NOT x is NOT satisfiable • SAT = {<w> | w is satisfiable } • SAT is in NP. Is it in P?

  19. Travelling salesman • Different versions • Given a directed, weighted graph (edges have direction and values), • what is the shortest path to visit all nodes and return to start • Is there a path of length less than some value L that visits all nodes • This is NP-complete, meaning it can be converted to others in the set, including satisfiability

  20. NP-hard • A problem is NP-hard if solving it in polynomial tiam would mean that NP complete problems can be solved in polynomial time. • It is at least as difficult as the NP-complete problems • but maybe harder…

  21. Note • Repeat: NP complete problems and NP-hard problems are solvable, but take a lot of time. • Note: the Travelling Salesman problem can be solved: try every path and pick the shortest. • Intuitively: adding non-determinism is making a guess. • perhaps over a small set of possibilities

  22. Origami example • Fold and cut to make any polygon shape: http://erikdemaine.org/foldcut/ • Inspiration may have been: http://www.ushistory.org/betsy/flagstar.html • Extra credit opportunity: what is the complexity of either or both of the algorithms that solve this problem?

  23. Origami problem • Creating a crease pattern to match a stick figure is NP-hard: http://www.technologyreview.com/view/420198/origami-crease-pattern-design-proved-np-hard/ • Others: http://erikdemaine.org/folding/

  24. Homework • [Can count as this week's posting, though you are welcome to give another one] • Find a unique problem (unique with respect to what has been posted) of an NP complete problem. • explain problem and • give two sources

More Related