Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.

Similar presentations


Presentation on theme: "Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations."— Presentation transcript:

1 Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.

2 Recall graph coloring problem Given a graph G and an integer k, is there away to color the vertices of G with the k colors such that no adjacent edges have the same color? Easy to show this is in NP. Just guess colors and then check. Can reduce 3SAT to this problem in polynomial time. http://www.cs.uky.edu/~lewis/cs- heuristic/text/class/more-np.htmlhttp://www.cs.uky.edu/~lewis/cs- heuristic/text/class/more-np.html

3 Exam scheduling Given a set of classes, information on students taking classes, and k possible dates, is there a way to set the final exam schedule so there are no conflicts. Model this as the coloring problem. –classes are vertices. Put an edge between two nodes if any student takes both classes. –color vertices according to the assigned date. Subtle point: this is not a reduction, but more direct modeling (representing) exam problem as the color problem.

4 Decision problem variant of Traveling Salesman problem Closed tour: given n cites and an integer k, is there a tour (path) of the cities which starts and stops at one city that has length less than k. –Model as a graph in which edges represent the distance. –np complete

5 Traveling Salesman Problem Why do I call this a variant? TSP calls for the minimum. TSP is NP-hard. Problems in NP are reducible to it, but it may not be in NP. –How do you check that something is the least? –You can check that something is less than a specific amount. http://www.tsp.gatech.edu/ Let's play a game: http://www.tsp.gatech.edu/games/index.html http://www.tsp.gatech.edu/games/index.html

6 Knapsack problem Informal: have an upper bound on weight and a lower bound on value, what should you take along on trip? Formal, given set of n items, each with a weight and a value, and integers (bound) k and m, is there a collection of items such that the total weight is less than k and the total value at least m? –np complete. http://www.cs.uky.edu/~lewis/cs- heuristic/text/class/more-np.htmlhttp://www.cs.uky.edu/~lewis/cs- heuristic/text/class/more-np.html

7 Bin packing Related to knapsack Given a set of objects, each of specified length, and an unlimited number of bins of a fixed size: what is the minimum number of bins to hold the objects or can set be stored using k bins? Variations –basic 1-dimensional –2 dimensional –3 dimensional: bins are real 3-D bins! –4 dimensional: bins are real 3-D bins and have weight limit.

8 Packing groceries, clothes, etc. How would you do it?

9 First fit versus ordering… It has been proven the a first fit approach can differ from optimal by 70% Ordering the items from largest to smallest (is that how you pack?) can differ from optimal by at most 22% –Proof that an efficient (?, maybe linear) can't be guaranteed to be better than this.

10 See also linear programming dynamic programming integer programming optimization …

11 Comment Optimization problems are subject of serious, practical study. pretty good may be good enough –don't need to produce and verify the best. Presentation topic –narrow it down….

12 Space complexity Let M be a deterministic TM that halts on all inputs. The space complexity of M is the function f:N  N when f(n) is the maximum number of tape cells that M scans on any input of length n. Let M be a non-deterministic TM that halts on all inputs. space complexity of M, f(n) is the maximum number of tape cells scanned on any branch of the computation, on input of length n.

13 Back to complexity Theoretical topic but… space considerations are/were an issue. Memory/storage cheaper now, but still can be critical in really large problems. However, cloud computing, faster transmissions, may lesson practical concerns.

14 Informally Space complexity is the amount of space taken by a program/algorithm on input of size n. Recall sorting, shuffling and searching algorithms.

15 Note: space is different from time! Can re-use space. –SAT problem can check all assignments of variables and reuse the same space. Make use of space equal to the number of variables to work through all assignments. –Total space is linear in size of problem (representation of formula plus representation of all the variables).

16 Savitch's Theorem A non-deterministic TM that uses f(n) space can be converted to a deterministic TM that uses f 2 (n) space. –if f(n) is polynomial than so is f 2 (n) !!!! More formal definition restricted to f(n)>=log(n).

17 PSPACE is the class of languages (or problems, algorithms) that are decidable in polynomial space on a deterministic Turing machine (or other equivalent model of computation) Note: we can define NSPACE for non- deterministic TMs, but PSPACE = NSPACE because if f(n) is a polynomial (bounded by a polynomial) then so is f 2 (n)

18 PSPACE completeness A language B is PSPACE complete if it is in PSPACE and every A in PSPACE is polynomial time reducible to B. –note: the reduction is specified as being polynomial TIME reducible. We make the reduction (translation) more constrained than the definition of the class.

19 Hierarchy: smallest to largest P NP PSPACE = NPSPACE EXPTIME It is known that P does not equal (strict / proper containment) in EXPTIME. Nothing else proven.

20 Homework Post presentation proposal Find and come prepared to describe PSPACE problems.


Download ppt "Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations."

Similar presentations


Ads by Google