Presentation is loading. Please wait.

Presentation is loading. Please wait.

“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”

Similar presentations


Presentation on theme: "“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”"— Presentation transcript:

1 “One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”

2 NP Complexity The class NP consists of all problems that can be solved in polynomial time by nondeterministic algorithms Nondeterministic algorithms are done in two phases: Phase I: algorithm that makes a guess (solutions must be included among the possible guesses) Phase II: algorithm that checks if the guess is an actual solution or not

3 The Traveling Salesperson Problem (TSP) Given the cities and cost to travel between cities, obtain a route R such that: 1.All cities are in R 2.Every city is visited only once in R 3.R has the minimum cost. That is, for any other route R’ meeting 1-2, cost(R’)  cost(R).

4 Example: Traveling Salesman Problem (TSP) is in NP A C B D F G E H 10 20 16 4 6 8 24 20 6 9 13 12

5 Proof We can show that Traveling Salesman Problem (TSP) is in NP phaseI(G: Graph) //input: G a graph with n nodes //output: C a guess for TSP v  randomNode(G) C  () While random(0,1) = 1 and |C| < n do { w  PickNeighbourRandomly(v) C  C + (v,w) v  w } return C phaseII(C: path, min: int ) //input: C a guessed solution //output: true iff C is a TSP If |C| < n then return false Visited  {} for i =1 to n do { (u,v) = C[i] if v in Visited then return false else Visited  Visited + {v} } return cost(C) = min

6 Why do We Care About NP Problems? Network Problems Traveling Salesperson Longest path Graph coloring Data Storage Minimum Bin Packing Scheduling Minimum Job Scheduling Minimum Multiprocessor Scheduling Mathematical Programming Knapsack

7 Why do We Care About NP Problems? (II) Automata Theory (computing) Longest computation Shortest computation All of these problems have 4 things in common: Planning Find a Universal Problem Solver They are important for a group of people No knows (for sure) if they are in P or not All of them are in NP They all are in a special category of NP problems: NP- Complete problems

8 NP-Complete A problem npc is NP-complete if: npc is in NP Every other problem prob in NP can be transformed in polynomial time into npc. (NP-Hard) Reduction: npc prob Polynomial transformation solution

9 NP-Complete npc MSTTSP Shortest Path Sorting … Knapsack 1.If we can find one NP-complete problem the can be solved in polynomial time then P = NP 2.If we can show for one NP-complete problem that it cannot be solved in polynomial time then no other NP-complete problem can be solved in polynomial time (and P ≠NP) “my preciousss…”

10 Fine, But How Do one Proof that a Problem is NP-Complete? First problem was hard to proof: Conjunctive Normal Form (Cook, 1971) Every problem q afterwards is “easier”:  Show that q is in NP  Find a problem, npc, that is NP-complete and show that npc can be transformed in polynomial time into q npc MSTTSP Shortest Path Sorting … Knapsack q

11 Conjunctive Normal Form A conjunctive normal form (CNF) is a Boolean expression consisting of one or more disjunctive formulas connected by an AND symbol (  ). A disjunctive formula is a collection of one or more (positive and negative) literals connected by an OR symbol (  ). Example: (a)  (¬ a  ¬b  c  d)  (¬c  ¬d)  (¬d) Problem (CNF-satisfaction): Give an algorithm that receives as input a CNF form and returns Boolean assignments for each literal in form such that form is true Example (above): a  true, b  false, c  true, d  false

12 Cook Theorem (1971) The CNF-satisfaction satisfaction is NP-complete


Download ppt "“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”"

Similar presentations


Ads by Google