180 likes | 589 Views
Optimization/Decision Problems. Optimization Problems An optimization problem is one which asks, “What is the optimal solution to problem X?” Examples: Minimum Spanning Tree Decision Problems An decision problem is one with yes/no answer Examples: Does a graph G have a MST of weight W?.
E N D
Optimization/Decision Problems • Optimization Problems • An optimization problem is one which asks, “What is the optimal solution to problem X?” • Examples: • Minimum Spanning Tree • Decision Problems • An decision problem is one with yes/no answer • Examples: • Does a graph G have a MST of weight W?
Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What reasonable time? Standard working definition: polynomial time On an input of size n the worst-case running time is O(nk) for some constant k O(n2), O(n3), O(1), O(n lg n), O(2n), O(nn), O(n!) Polynomial time: O(n2), O(n3), O(1), O(n lg n) Not in polynomial time: O(2n), O(nn), O(n!)
Determinism vs. Nondeterminism • Nondeterministic algorithms produce an answer by a series of “correct guesses” • Deterministic algorithms (like those that a computer executes) make decisions based on information.
Complexity Class P • Deterministic in nature • Solved by conventional computers in polynomial time • O(1) Constant • O(log n) Sub-linear • O(n) Linear • O(n log n) Nearly Linear • O(n2) Quadratic • Polynomial upper and lower bounds
Complexity Class NP • Two Properties: non-deterministic method to generate possible solutions, deterministic method to verify in polynomial time that the solution is correct.
Relation of P and NP • P is a subset of NP • “P = NP”? • Language L is in NP, complement of L is in co-NP • co-NP ≠ NP • P ≠ co-NP
TSP • For each two cities, an integer cost is given to travel from one of the two cities to the other. The salesperson wants to make a minimum cost circuit visiting each city exactly once. 2 i = 23 2 1 1 3 4 1 3 4 5 4 2 1 2 2 2 2 1 1 1
NP-Complete “NP-Complete” comes from: • Nondeterministic Polynomial • Complete - “Solve one, Solve them all” There are more NP-Complete problems than provably intractable problems.