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 • 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) O(log n) O(n) O(n log n) O(n2) Constant Sub-linear Linear Nearly Linear Quadratic Polynomial upper and lower bounds Complexity Class NP 1. 2. 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 2 1 3 4 2 1 1 5 4 1 2 2 2 1 i = 23 3 4 2 2 1 1 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. NP-Complete “NP-Complete” comes from: Nondeterministic Polynomial Complete - “Solve one, Solve them all” There are more NP-Complete problems than provably intractable problems.