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(n k ) for some constant k O(n 2 ), O(n 3 ), O(1), O(n lg n), O(2 n ), O(n n ), O(n!) Polynomial time: O(n 2 ), O(n 3 ), O(1), O(n lg n) Not in polynomial time: O(2 n ), O(n n ), 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(n 2 )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 i = 23 2
NP-Complete “NP-Complete” comes from: – Nondeterministic Polynomial – Complete - “Solve one, Solve them all” There are more NP-Complete problems than provably intractable problems.