SlideShare a Scribd company logo
Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f

More Related Content

More from HsuChi Chen

algorithm_1introdunction.pdf
algorithm_1introdunction.pdfalgorithm_1introdunction.pdf
algorithm_1introdunction.pdf
HsuChi Chen
 
algorithm_9linear_programming.pdf
algorithm_9linear_programming.pdfalgorithm_9linear_programming.pdf
algorithm_9linear_programming.pdf
HsuChi Chen
 
algorithm_4greedy_algorithms.pdf
algorithm_4greedy_algorithms.pdfalgorithm_4greedy_algorithms.pdf
algorithm_4greedy_algorithms.pdf
HsuChi Chen
 
algorithm_3graphs.pdf
algorithm_3graphs.pdfalgorithm_3graphs.pdf
algorithm_3graphs.pdf
HsuChi Chen
 
algorithm_7network_flow.pdf
algorithm_7network_flow.pdfalgorithm_7network_flow.pdf
algorithm_7network_flow.pdf
HsuChi Chen
 
algorithm_2algorithm_analysis.pdf
algorithm_2algorithm_analysis.pdfalgorithm_2algorithm_analysis.pdf
algorithm_2algorithm_analysis.pdf
HsuChi Chen
 
algorithm_5divide_and_conquer.pdf
algorithm_5divide_and_conquer.pdfalgorithm_5divide_and_conquer.pdf
algorithm_5divide_and_conquer.pdf
HsuChi Chen
 
algorithm_0introdunction.pdf
algorithm_0introdunction.pdfalgorithm_0introdunction.pdf
algorithm_0introdunction.pdf
HsuChi Chen
 
期末專題報告書
期末專題報告書期末專題報告書
期末專題報告書
HsuChi Chen
 
單晶片期末專題-報告二
單晶片期末專題-報告二單晶片期末專題-報告二
單晶片期末專題-報告二
HsuChi Chen
 
單晶片期末專題-報告一
單晶片期末專題-報告一單晶片期末專題-報告一
單晶片期末專題-報告一
HsuChi Chen
 
模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告
HsuChi Chen
 
單晶片期末專題-初步想法
單晶片期末專題-初步想法單晶片期末專題-初步想法
單晶片期末專題-初步想法
HsuChi Chen
 

More from HsuChi Chen (13)

algorithm_1introdunction.pdf
algorithm_1introdunction.pdfalgorithm_1introdunction.pdf
algorithm_1introdunction.pdf
 
algorithm_9linear_programming.pdf
algorithm_9linear_programming.pdfalgorithm_9linear_programming.pdf
algorithm_9linear_programming.pdf
 
algorithm_4greedy_algorithms.pdf
algorithm_4greedy_algorithms.pdfalgorithm_4greedy_algorithms.pdf
algorithm_4greedy_algorithms.pdf
 
algorithm_3graphs.pdf
algorithm_3graphs.pdfalgorithm_3graphs.pdf
algorithm_3graphs.pdf
 
algorithm_7network_flow.pdf
algorithm_7network_flow.pdfalgorithm_7network_flow.pdf
algorithm_7network_flow.pdf
 
algorithm_2algorithm_analysis.pdf
algorithm_2algorithm_analysis.pdfalgorithm_2algorithm_analysis.pdf
algorithm_2algorithm_analysis.pdf
 
algorithm_5divide_and_conquer.pdf
algorithm_5divide_and_conquer.pdfalgorithm_5divide_and_conquer.pdf
algorithm_5divide_and_conquer.pdf
 
algorithm_0introdunction.pdf
algorithm_0introdunction.pdfalgorithm_0introdunction.pdf
algorithm_0introdunction.pdf
 
期末專題報告書
期末專題報告書期末專題報告書
期末專題報告書
 
單晶片期末專題-報告二
單晶片期末專題-報告二單晶片期末專題-報告二
單晶片期末專題-報告二
 
單晶片期末專題-報告一
單晶片期末專題-報告一單晶片期末專題-報告一
單晶片期末專題-報告一
 
模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告
 
單晶片期末專題-初步想法
單晶片期末專題-初步想法單晶片期末專題-初步想法
單晶片期末專題-初步想法
 

Recently uploaded

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
ICS
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
Zycus
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
michniczscribd
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Vince Scalabrino
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
OnePlan Solutions
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
kalichargn70th171
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
Alina Yurenko
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 

Recently uploaded (20)

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 

algorithm_8beyond_polynomial_running_times.pdf

  • 1. Iris Hui-Ru Jiang Fall 2014 CHAPTER 8 BEYOND POLYNOMIAL RUNNING TIMES IRIS H.-R. JIANG Outline ¨ Content: ¤ Polynomial-time reduction ¤ NP-completeness ¨ Reading: ¤ Chapter 8 Hard problems 2 The Status of the P Versus NP Problem http://cacm.acm.org/magazines/2009/9/38904-the-status- of-the-p-versus-np-problem/fulltext IRIS H.-R. JIANG Easy vs. Hard ¨ Q: Which problems will we be able to solve in practice? ¨ A working definition. ¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with polynomial-time algorithms. ¨ Desiderata: Classify problems according to those that can be solved in polynomial-time and those that cannot. ¨ Provably requires exponential-time. ¨ Frustrating news: Huge number of fundamental problems have defined classification for decades. ¨ Chapter 8: Show that these fundamental problems are computationally equivalent and appear to be different manifestations of one really hard problem. Hard problems 3 IRIS H.-R. JIANG Decision & Optimization Problems ¨ Decision problems: those having yes/no answers. ¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning tree with a cost at most K? ¤ TSP: Given a set of cities, distance between each pair of cities, and a bound B, is there a route that starts and ends at a given city, visits every city exactly once, and has total distance at most B? ¨ Optimization problems: those finding a legal configuration such that its cost is minimum (or maximum). ¤ MST: Given a graph G=(V, E), find the cost of a minimum spanning tree of G. ¤ TSP: Given a set of cities and that distance between each pair of cities, find the distance of a “minimum route” starts and ends at a given city and visits every city exactly once. ¨ Could apply binary search on a decision problem to obtain solutions to its optimization problem. ¨ Class NP is associated with decision problems. Hard problems 4
  • 2. Iris Hui-Ru Jiang Fall 2014 CHAPTER 8 BEYOND POLYNOMIAL RUNNING TIMES IRIS H.-R. JIANG Outline ¨ Content: ¤ Polynomial-time reduction ¤ NP-completeness ¨ Reading: ¤ Chapter 8 Hard problems 2 The Status of the P Versus NP Problem http://cacm.acm.org/magazines/2009/9/38904-the-status- of-the-p-versus-np-problem/fulltext IRIS H.-R. JIANG Easy vs. Hard ¨ Q: Which problems will we be able to solve in practice? ¨ A working definition. ¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with polynomial-time algorithms. ¨ Desiderata: Classify problems according to those that can be solved in polynomial-time and those that cannot. ¨ Provably requires exponential-time. ¨ Frustrating news: Huge number of fundamental problems have defined classification for decades. ¨ Chapter 8: Show that these fundamental problems are computationally equivalent and appear to be different manifestations of one really hard problem. Hard problems 3 IRIS H.-R. JIANG Decision & Optimization Problems ¨ Decision problems: those having yes/no answers. ¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning tree with a cost at most K? ¤ TSP: Given a set of cities, distance between each pair of cities, and a bound B, is there a route that starts and ends at a given city, visits every city exactly once, and has total distance at most B? ¨ Optimization problems: those finding a legal configuration such that its cost is minimum (or maximum). ¤ MST: Given a graph G=(V, E), find the cost of a minimum spanning tree of G. ¤ TSP: Given a set of cities and that distance between each pair of cities, find the distance of a “minimum route” starts and ends at a given city and visits every city exactly once. ¨ Could apply binary search on a decision problem to obtain solutions to its optimization problem. ¨ Class NP is associated with decision problems. Hard problems 4
  • 3. Iris Hui-Ru Jiang Fall 2014 CHAPTER 8 BEYOND POLYNOMIAL RUNNING TIMES IRIS H.-R. JIANG Outline ¨ Content: ¤ Polynomial-time reduction ¤ NP-completeness ¨ Reading: ¤ Chapter 8 Hard problems 2 The Status of the P Versus NP Problem http://cacm.acm.org/magazines/2009/9/38904-the-status- of-the-p-versus-np-problem/fulltext IRIS H.-R. JIANG Easy vs. Hard ¨ Q: Which problems will we be able to solve in practice? ¨ A working definition. ¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with polynomial-time algorithms. ¨ Desiderata: Classify problems according to those that can be solved in polynomial-time and those that cannot. ¨ Provably requires exponential-time. ¨ Frustrating news: Huge number of fundamental problems have defined classification for decades. ¨ Chapter 8: Show that these fundamental problems are computationally equivalent and appear to be different manifestations of one really hard problem. Hard problems 3 IRIS H.-R. JIANG Decision & Optimization Problems ¨ Decision problems: those having yes/no answers. ¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning tree with a cost at most K? ¤ TSP: Given a set of cities, distance between each pair of cities, and a bound B, is there a route that starts and ends at a given city, visits every city exactly once, and has total distance at most B? ¨ Optimization problems: those finding a legal configuration such that its cost is minimum (or maximum). ¤ MST: Given a graph G=(V, E), find the cost of a minimum spanning tree of G. ¤ TSP: Given a set of cities and that distance between each pair of cities, find the distance of a “minimum route” starts and ends at a given city and visits every city exactly once. ¨ Could apply binary search on a decision problem to obtain solutions to its optimization problem. ¨ Class NP is associated with decision problems. Hard problems 4
  • 4. Iris Hui-Ru Jiang Fall 2014 CHAPTER 8 BEYOND POLYNOMIAL RUNNING TIMES IRIS H.-R. JIANG Outline ¨ Content: ¤ Polynomial-time reduction ¤ NP-completeness ¨ Reading: ¤ Chapter 8 Hard problems 2 The Status of the P Versus NP Problem http://cacm.acm.org/magazines/2009/9/38904-the-status- of-the-p-versus-np-problem/fulltext IRIS H.-R. JIANG Easy vs. Hard ¨ Q: Which problems will we be able to solve in practice? ¨ A working definition. ¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with polynomial-time algorithms. ¨ Desiderata: Classify problems according to those that can be solved in polynomial-time and those that cannot. ¨ Provably requires exponential-time. ¨ Frustrating news: Huge number of fundamental problems have defined classification for decades. ¨ Chapter 8: Show that these fundamental problems are computationally equivalent and appear to be different manifestations of one really hard problem. Hard problems 3 IRIS H.-R. JIANG Decision & Optimization Problems ¨ Decision problems: those having yes/no answers. ¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning tree with a cost at most K? ¤ TSP: Given a set of cities, distance between each pair of cities, and a bound B, is there a route that starts and ends at a given city, visits every city exactly once, and has total distance at most B? ¨ Optimization problems: those finding a legal configuration such that its cost is minimum (or maximum). ¤ MST: Given a graph G=(V, E), find the cost of a minimum spanning tree of G. ¤ TSP: Given a set of cities and that distance between each pair of cities, find the distance of a “minimum route” starts and ends at a given city and visits every city exactly once. ¨ Could apply binary search on a decision problem to obtain solutions to its optimization problem. ¨ Class NP is associated with decision problems. Hard problems 4
  • 5. IRIS H.-R. JIANG Traveling Salesman Problem (TSP) Hard problems 5 Optimal TSP tour http://www.tsp.gatech.edu All 13,509 cities in US with a population of at least 500 IRIS H.-R. JIANG Complexity Classes ¨ Developed by S. Cook and R. Karp in early 1970. ¨ The class P: class of problems that can be solved in polynomial time in the size of input. ¨ The class NP (Nondeterministic Polynomial): class of problems that can be verified in polynomial time in the size of input. ¤ P = NP? ¨ The class NP-complete (NPC): A problem Y in NP with the property that for every problem X in NP, X £p Y. ¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time iff P = NP. ¤ Any NPC problem can be solved in polynomial time Þ All problems in NP can be solved in polynomial time. ¨ Fundamental question: Do there exist “natural” NPC problems? Hard problems 6 IRIS H.-R. JIANG Verification Algorithm and Class NP ¨ Verification algorithm: a 2-argument algorithm A, where one argument is an input string x and the other is a binary string y (called a certificate). A verifies x if there exists y s.t. A answers “yes.” ¨ Ex: The Traveling Salesman Problem (TSP) ¤ Instance: a set of n cities, distance between each pair of cities, and a bound B. ¤ Question: is there a route that starts and ends at a given city, visits every city exactly once, and has total distance £ B? ¨ Is TSP Î NP? ¨ Need to check a solution in polynomial time. ¤ Guess a tour (certificate). ¤ Check if the tour visits every city exactly once. ¤ Check if the tour returns to the start. ¤ Check if total distance £ B. ¨ All can be done in O(n) time, so TSP Î NP. Hard problems 7 IRIS H.-R. JIANG The First Proved NPC: Circuit Satisfiability ¨ CIRCUIT-SAT: ¤ Q: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1? ¤ A: Yes: 1 0 1 Hard problems 8 Ù Ø Ù Ú Ù Ú 1 0 ? ? ? output inputs hard-coded inputs
  • 6. IRIS H.-R. JIANG Traveling Salesman Problem (TSP) Hard problems 5 Optimal TSP tour http://www.tsp.gatech.edu All 13,509 cities in US with a population of at least 500 IRIS H.-R. JIANG Complexity Classes ¨ Developed by S. Cook and R. Karp in early 1970. ¨ The class P: class of problems that can be solved in polynomial time in the size of input. ¨ The class NP (Nondeterministic Polynomial): class of problems that can be verified in polynomial time in the size of input. ¤ P = NP? ¨ The class NP-complete (NPC): A problem Y in NP with the property that for every problem X in NP, X £p Y. ¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time iff P = NP. ¤ Any NPC problem can be solved in polynomial time Þ All problems in NP can be solved in polynomial time. ¨ Fundamental question: Do there exist “natural” NPC problems? Hard problems 6 IRIS H.-R. JIANG Verification Algorithm and Class NP ¨ Verification algorithm: a 2-argument algorithm A, where one argument is an input string x and the other is a binary string y (called a certificate). A verifies x if there exists y s.t. A answers “yes.” ¨ Ex: The Traveling Salesman Problem (TSP) ¤ Instance: a set of n cities, distance between each pair of cities, and a bound B. ¤ Question: is there a route that starts and ends at a given city, visits every city exactly once, and has total distance £ B? ¨ Is TSP Î NP? ¨ Need to check a solution in polynomial time. ¤ Guess a tour (certificate). ¤ Check if the tour visits every city exactly once. ¤ Check if the tour returns to the start. ¤ Check if total distance £ B. ¨ All can be done in O(n) time, so TSP Î NP. Hard problems 7 IRIS H.-R. JIANG The First Proved NPC: Circuit Satisfiability ¨ CIRCUIT-SAT: ¤ Q: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1? ¤ A: Yes: 1 0 1 Hard problems 8 Ù Ø Ù Ú Ù Ú 1 0 ? ? ? output inputs hard-coded inputs
  • 7. IRIS H.-R. JIANG Traveling Salesman Problem (TSP) Hard problems 5 Optimal TSP tour http://www.tsp.gatech.edu All 13,509 cities in US with a population of at least 500 IRIS H.-R. JIANG Complexity Classes ¨ Developed by S. Cook and R. Karp in early 1970. ¨ The class P: class of problems that can be solved in polynomial time in the size of input. ¨ The class NP (Nondeterministic Polynomial): class of problems that can be verified in polynomial time in the size of input. ¤ P = NP? ¨ The class NP-complete (NPC): A problem Y in NP with the property that for every problem X in NP, X £p Y. ¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time iff P = NP. ¤ Any NPC problem can be solved in polynomial time Þ All problems in NP can be solved in polynomial time. ¨ Fundamental question: Do there exist “natural” NPC problems? Hard problems 6 IRIS H.-R. JIANG Verification Algorithm and Class NP ¨ Verification algorithm: a 2-argument algorithm A, where one argument is an input string x and the other is a binary string y (called a certificate). A verifies x if there exists y s.t. A answers “yes.” ¨ Ex: The Traveling Salesman Problem (TSP) ¤ Instance: a set of n cities, distance between each pair of cities, and a bound B. ¤ Question: is there a route that starts and ends at a given city, visits every city exactly once, and has total distance £ B? ¨ Is TSP Î NP? ¨ Need to check a solution in polynomial time. ¤ Guess a tour (certificate). ¤ Check if the tour visits every city exactly once. ¤ Check if the tour returns to the start. ¤ Check if total distance £ B. ¨ All can be done in O(n) time, so TSP Î NP. Hard problems 7 IRIS H.-R. JIANG The First Proved NPC: Circuit Satisfiability ¨ CIRCUIT-SAT: ¤ Q: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1? ¤ A: Yes: 1 0 1 Hard problems 8 Ù Ø Ù Ú Ù Ú 1 0 ? ? ? output inputs hard-coded inputs
  • 8. IRIS H.-R. JIANG Traveling Salesman Problem (TSP) Hard problems 5 Optimal TSP tour http://www.tsp.gatech.edu All 13,509 cities in US with a population of at least 500 IRIS H.-R. JIANG Complexity Classes ¨ Developed by S. Cook and R. Karp in early 1970. ¨ The class P: class of problems that can be solved in polynomial time in the size of input. ¨ The class NP (Nondeterministic Polynomial): class of problems that can be verified in polynomial time in the size of input. ¤ P = NP? ¨ The class NP-complete (NPC): A problem Y in NP with the property that for every problem X in NP, X £p Y. ¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time iff P = NP. ¤ Any NPC problem can be solved in polynomial time Þ All problems in NP can be solved in polynomial time. ¨ Fundamental question: Do there exist “natural” NPC problems? Hard problems 6 IRIS H.-R. JIANG Verification Algorithm and Class NP ¨ Verification algorithm: a 2-argument algorithm A, where one argument is an input string x and the other is a binary string y (called a certificate). A verifies x if there exists y s.t. A answers “yes.” ¨ Ex: The Traveling Salesman Problem (TSP) ¤ Instance: a set of n cities, distance between each pair of cities, and a bound B. ¤ Question: is there a route that starts and ends at a given city, visits every city exactly once, and has total distance £ B? ¨ Is TSP Î NP? ¨ Need to check a solution in polynomial time. ¤ Guess a tour (certificate). ¤ Check if the tour visits every city exactly once. ¤ Check if the tour returns to the start. ¤ Check if total distance £ B. ¨ All can be done in O(n) time, so TSP Î NP. Hard problems 7 IRIS H.-R. JIANG The First Proved NPC: Circuit Satisfiability ¨ CIRCUIT-SAT: ¤ Q: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1? ¤ A: Yes: 1 0 1 Hard problems 8 Ù Ø Ù Ú Ù Ú 1 0 ? ? ? output inputs hard-coded inputs
  • 9. IRIS H.-R. JIANG More Hard Computational Problems ¨ Aerospace engineering: optimal mesh partitioning for finite elements. ¨ Biology: protein folding. ¨ Chemical engineering: heat exchanger network synthesis. ¨ Civil engineering: equilibrium of urban traffic flow. ¨ Economics: computation of arbitrage in financial markets with friction. ¨ Electrical engineering: VLSI layout. ¨ Environmental engineering: optimal placement of contaminant sensors. ¨ Financial engineering: find minimum risk portfolio of given return. ¨ Game theory: find Nash equilibrium that maximizes social welfare. ¨ Genomics: phylogeny reconstruction. ¨ Mechanical engineering: structure of turbulence in sheared flows. ¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram. ¨ Operations research: optimal resource allocation. ¨ Physics: partition function of 3-D Ising model in statistical mechanics. ¨ Politics: Shapley-Shubik voting power. ¨ Pop culture: Minesweeper consistency. ¨ Statistics: optimal experimental design. Hard problems 9 IRIS H.-R. JIANG Polynomial-Time Reduction (1/2) ¨ Desiderata: Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? ¨ Reduction: Problem X polynomial reduces to problem Y if given an arbitrary instance x of problem X, we can construct an input y to problem Y in polynomial time such that x is a yes instance to X iff y is a yes instance of Y. ¤ Notation: X £P Y. ¨ Remarks: ¤ The algorithm for Y is viewed as a black box. ¤ We pay for polynomial time to write down instances sent to this black box Hard problems 10 IRIS H.-R. JIANG Polynomial-Time Reduction (2/2) ¨ Purpose: Classify problems according to relative difficulty. 1. Design algorithms: If X £P Y and Y can be solved in polynomial-time, then X can also be solved in polynomial time. ¤ Bipartite matching £P Network flow 2. Establish intractability: If X £P Y and X cannot be solved in polynomial-time, then Y cannot be solved in polynomial time. ¤ Hamiltonian cycle £P Travelling salesman 3. Establish equivalence: If X £P Y and Y £P X, X ºP Y. ¤ Up to cost of reduction Hard problems 11 IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy I Hard problems 12 ĩI can’t find an efficient algorithm. I guess I’m just too dumb.” Courtesy of Prof. Y.-W. Chang
  • 10. IRIS H.-R. JIANG More Hard Computational Problems ¨ Aerospace engineering: optimal mesh partitioning for finite elements. ¨ Biology: protein folding. ¨ Chemical engineering: heat exchanger network synthesis. ¨ Civil engineering: equilibrium of urban traffic flow. ¨ Economics: computation of arbitrage in financial markets with friction. ¨ Electrical engineering: VLSI layout. ¨ Environmental engineering: optimal placement of contaminant sensors. ¨ Financial engineering: find minimum risk portfolio of given return. ¨ Game theory: find Nash equilibrium that maximizes social welfare. ¨ Genomics: phylogeny reconstruction. ¨ Mechanical engineering: structure of turbulence in sheared flows. ¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram. ¨ Operations research: optimal resource allocation. ¨ Physics: partition function of 3-D Ising model in statistical mechanics. ¨ Politics: Shapley-Shubik voting power. ¨ Pop culture: Minesweeper consistency. ¨ Statistics: optimal experimental design. Hard problems 9 IRIS H.-R. JIANG Polynomial-Time Reduction (1/2) ¨ Desiderata: Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? ¨ Reduction: Problem X polynomial reduces to problem Y if given an arbitrary instance x of problem X, we can construct an input y to problem Y in polynomial time such that x is a yes instance to X iff y is a yes instance of Y. ¤ Notation: X £P Y. ¨ Remarks: ¤ The algorithm for Y is viewed as a black box. ¤ We pay for polynomial time to write down instances sent to this black box Hard problems 10 IRIS H.-R. JIANG Polynomial-Time Reduction (2/2) ¨ Purpose: Classify problems according to relative difficulty. 1. Design algorithms: If X £P Y and Y can be solved in polynomial-time, then X can also be solved in polynomial time. ¤ Bipartite matching £P Network flow 2. Establish intractability: If X £P Y and X cannot be solved in polynomial-time, then Y cannot be solved in polynomial time. ¤ Hamiltonian cycle £P Travelling salesman 3. Establish equivalence: If X £P Y and Y £P X, X ºP Y. ¤ Up to cost of reduction Hard problems 11 IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy I Hard problems 12 ĩI can’t find an efficient algorithm. I guess I’m just too dumb.” Courtesy of Prof. Y.-W. Chang
  • 11. IRIS H.-R. JIANG More Hard Computational Problems ¨ Aerospace engineering: optimal mesh partitioning for finite elements. ¨ Biology: protein folding. ¨ Chemical engineering: heat exchanger network synthesis. ¨ Civil engineering: equilibrium of urban traffic flow. ¨ Economics: computation of arbitrage in financial markets with friction. ¨ Electrical engineering: VLSI layout. ¨ Environmental engineering: optimal placement of contaminant sensors. ¨ Financial engineering: find minimum risk portfolio of given return. ¨ Game theory: find Nash equilibrium that maximizes social welfare. ¨ Genomics: phylogeny reconstruction. ¨ Mechanical engineering: structure of turbulence in sheared flows. ¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram. ¨ Operations research: optimal resource allocation. ¨ Physics: partition function of 3-D Ising model in statistical mechanics. ¨ Politics: Shapley-Shubik voting power. ¨ Pop culture: Minesweeper consistency. ¨ Statistics: optimal experimental design. Hard problems 9 IRIS H.-R. JIANG Polynomial-Time Reduction (1/2) ¨ Desiderata: Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? ¨ Reduction: Problem X polynomial reduces to problem Y if given an arbitrary instance x of problem X, we can construct an input y to problem Y in polynomial time such that x is a yes instance to X iff y is a yes instance of Y. ¤ Notation: X £P Y. ¨ Remarks: ¤ The algorithm for Y is viewed as a black box. ¤ We pay for polynomial time to write down instances sent to this black box Hard problems 10 IRIS H.-R. JIANG Polynomial-Time Reduction (2/2) ¨ Purpose: Classify problems according to relative difficulty. 1. Design algorithms: If X £P Y and Y can be solved in polynomial-time, then X can also be solved in polynomial time. ¤ Bipartite matching £P Network flow 2. Establish intractability: If X £P Y and X cannot be solved in polynomial-time, then Y cannot be solved in polynomial time. ¤ Hamiltonian cycle £P Travelling salesman 3. Establish equivalence: If X £P Y and Y £P X, X ºP Y. ¤ Up to cost of reduction Hard problems 11 IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy I Hard problems 12 ĩI can’t find an efficient algorithm. I guess I’m just too dumb.” Courtesy of Prof. Y.-W. Chang
  • 12. IRIS H.-R. JIANG More Hard Computational Problems ¨ Aerospace engineering: optimal mesh partitioning for finite elements. ¨ Biology: protein folding. ¨ Chemical engineering: heat exchanger network synthesis. ¨ Civil engineering: equilibrium of urban traffic flow. ¨ Economics: computation of arbitrage in financial markets with friction. ¨ Electrical engineering: VLSI layout. ¨ Environmental engineering: optimal placement of contaminant sensors. ¨ Financial engineering: find minimum risk portfolio of given return. ¨ Game theory: find Nash equilibrium that maximizes social welfare. ¨ Genomics: phylogeny reconstruction. ¨ Mechanical engineering: structure of turbulence in sheared flows. ¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram. ¨ Operations research: optimal resource allocation. ¨ Physics: partition function of 3-D Ising model in statistical mechanics. ¨ Politics: Shapley-Shubik voting power. ¨ Pop culture: Minesweeper consistency. ¨ Statistics: optimal experimental design. Hard problems 9 IRIS H.-R. JIANG Polynomial-Time Reduction (1/2) ¨ Desiderata: Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? ¨ Reduction: Problem X polynomial reduces to problem Y if given an arbitrary instance x of problem X, we can construct an input y to problem Y in polynomial time such that x is a yes instance to X iff y is a yes instance of Y. ¤ Notation: X £P Y. ¨ Remarks: ¤ The algorithm for Y is viewed as a black box. ¤ We pay for polynomial time to write down instances sent to this black box Hard problems 10 IRIS H.-R. JIANG Polynomial-Time Reduction (2/2) ¨ Purpose: Classify problems according to relative difficulty. 1. Design algorithms: If X £P Y and Y can be solved in polynomial-time, then X can also be solved in polynomial time. ¤ Bipartite matching £P Network flow 2. Establish intractability: If X £P Y and X cannot be solved in polynomial-time, then Y cannot be solved in polynomial time. ¤ Hamiltonian cycle £P Travelling salesman 3. Establish equivalence: If X £P Y and Y £P X, X ºP Y. ¤ Up to cost of reduction Hard problems 11 IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy I Hard problems 12 ĩI can’t find an efficient algorithm. I guess I’m just too dumb.” Courtesy of Prof. Y.-W. Chang
  • 13. IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy II Hard problems 13 Courtesy of Prof. Y.-W. Chang ĩI can’t find an efficient algorithm, because no such algorithm is possible!” IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy III Hard problems 14 Courtesy of Prof. Y.-W. Chang ȾI can’t find an efficient algorithm, but neither can all these famous people.” IRIS H.-R. JIANG Polynomial Reduction: HC £P TSP ¨ The Hamiltonian Circuit Problem (HC) ¤ Instance: an undirected graph G = (V, E). ¤ Question: is there a cycle in G that includes every vertex exactly once? ¨ TSP: The Traveling Salesman Problem ¨ Claim: HC £P TSP. 1. Define a function f mapping any HC instance into a TSP instance, and show that f can be computed in polynomial time. 2. Prove that G has an HC iff the reduced instance has a TSP tour with distance £ B (x Î HC Û f(x) Î TSP). Hard problems 15 IRIS H.-R. JIANG HC £P TSP: Step 1 ¨ Define a reduction function f for HC £P TSP. ¤ Given an HC instance G = (V, E) with n vertices n Create a set of n cities labeled with names in V. n Assign distance between u and v n Set bound B = n. ¤ f can be computed in O(V2) time. Hard problems 16
  • 14. IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy II Hard problems 13 Courtesy of Prof. Y.-W. Chang ĩI can’t find an efficient algorithm, because no such algorithm is possible!” IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy III Hard problems 14 Courtesy of Prof. Y.-W. Chang ȾI can’t find an efficient algorithm, but neither can all these famous people.” IRIS H.-R. JIANG Polynomial Reduction: HC £P TSP ¨ The Hamiltonian Circuit Problem (HC) ¤ Instance: an undirected graph G = (V, E). ¤ Question: is there a cycle in G that includes every vertex exactly once? ¨ TSP: The Traveling Salesman Problem ¨ Claim: HC £P TSP. 1. Define a function f mapping any HC instance into a TSP instance, and show that f can be computed in polynomial time. 2. Prove that G has an HC iff the reduced instance has a TSP tour with distance £ B (x Î HC Û f(x) Î TSP). Hard problems 15 IRIS H.-R. JIANG HC £P TSP: Step 1 ¨ Define a reduction function f for HC £P TSP. ¤ Given an HC instance G = (V, E) with n vertices n Create a set of n cities labeled with names in V. n Assign distance between u and v n Set bound B = n. ¤ f can be computed in O(V2) time. Hard problems 16
  • 15. IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy II Hard problems 13 Courtesy of Prof. Y.-W. Chang ĩI can’t find an efficient algorithm, because no such algorithm is possible!” IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy III Hard problems 14 Courtesy of Prof. Y.-W. Chang ȾI can’t find an efficient algorithm, but neither can all these famous people.” IRIS H.-R. JIANG Polynomial Reduction: HC £P TSP ¨ The Hamiltonian Circuit Problem (HC) ¤ Instance: an undirected graph G = (V, E). ¤ Question: is there a cycle in G that includes every vertex exactly once? ¨ TSP: The Traveling Salesman Problem ¨ Claim: HC £P TSP. 1. Define a function f mapping any HC instance into a TSP instance, and show that f can be computed in polynomial time. 2. Prove that G has an HC iff the reduced instance has a TSP tour with distance £ B (x Î HC Û f(x) Î TSP). Hard problems 15 IRIS H.-R. JIANG HC £P TSP: Step 1 ¨ Define a reduction function f for HC £P TSP. ¤ Given an HC instance G = (V, E) with n vertices n Create a set of n cities labeled with names in V. n Assign distance between u and v n Set bound B = n. ¤ f can be computed in O(V2) time. Hard problems 16
  • 16. IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy II Hard problems 13 Courtesy of Prof. Y.-W. Chang ĩI can’t find an efficient algorithm, because no such algorithm is possible!” IRIS H.-R. JIANG Coping with a “Tough” Problem: Trilogy III Hard problems 14 Courtesy of Prof. Y.-W. Chang ȾI can’t find an efficient algorithm, but neither can all these famous people.” IRIS H.-R. JIANG Polynomial Reduction: HC £P TSP ¨ The Hamiltonian Circuit Problem (HC) ¤ Instance: an undirected graph G = (V, E). ¤ Question: is there a cycle in G that includes every vertex exactly once? ¨ TSP: The Traveling Salesman Problem ¨ Claim: HC £P TSP. 1. Define a function f mapping any HC instance into a TSP instance, and show that f can be computed in polynomial time. 2. Prove that G has an HC iff the reduced instance has a TSP tour with distance £ B (x Î HC Û f(x) Î TSP). Hard problems 15 IRIS H.-R. JIANG HC £P TSP: Step 1 ¨ Define a reduction function f for HC £P TSP. ¤ Given an HC instance G = (V, E) with n vertices n Create a set of n cities labeled with names in V. n Assign distance between u and v n Set bound B = n. ¤ f can be computed in O(V2) time. Hard problems 16
  • 17. IRIS H.-R. JIANG HC £P TSP: Step 2 ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ x Î HC Þ f(x) Î TSP. n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a tour in the transformed TSP instance. n The distance of the tour h is n = B since there are n consecutive edges in E, and so has distance 1 in f(x). n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B). Hard problems 17 IRIS H.-R. JIANG HC £P TSP: Step 2 (cont’d) ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ f(x) Î TSP Þ x Î HC. n Suppose there is a TSP tour with distance £ n = B. Let it be <v1, v2, …, vn, v1>. n Since distance of the tour £ n and there are n edges in the TSP tour, the tour contains only edges in E. n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC). Hard problems 18 IRIS H.-R. JIANG NP-complete problems intractable tractable ?? NP-Completeness ¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for every L' Î NP. ¨ NP-hard: If L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. ¨ Suppose L Î NPC. P=NP? ¤ If L Î P, then there exists a polynomial-time algorithm for every L' Î NP (i.e., P = NP). ¤ If L Ï P, then there exists no polynomial-time algorithm for any L' Î NPC (i.e., P ¹ NP). Hard problems 19 IRIS H.-R. JIANG Proving NP-Completeness ¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for an L' Î NPC. ¨ Five steps for proving that L is NP-complete: 1. Prove L Î NP. 2. Select a known NP-complete problem L'. 3. Construct a reduction f transforming every instance of L' to an instance of L. 4. Prove that f is a polynomial-time transformation. 5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*. Hard problems 20 A known NP-complete problem L’ A problem L to be proved NP-complete reduce f
  • 18. IRIS H.-R. JIANG HC £P TSP: Step 2 ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ x Î HC Þ f(x) Î TSP. n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a tour in the transformed TSP instance. n The distance of the tour h is n = B since there are n consecutive edges in E, and so has distance 1 in f(x). n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B). Hard problems 17 IRIS H.-R. JIANG HC £P TSP: Step 2 (cont’d) ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ f(x) Î TSP Þ x Î HC. n Suppose there is a TSP tour with distance £ n = B. Let it be <v1, v2, …, vn, v1>. n Since distance of the tour £ n and there are n edges in the TSP tour, the tour contains only edges in E. n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC). Hard problems 18 IRIS H.-R. JIANG NP-complete problems intractable tractable ?? NP-Completeness ¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for every L' Î NP. ¨ NP-hard: If L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. ¨ Suppose L Î NPC. P=NP? ¤ If L Î P, then there exists a polynomial-time algorithm for every L' Î NP (i.e., P = NP). ¤ If L Ï P, then there exists no polynomial-time algorithm for any L' Î NPC (i.e., P ¹ NP). Hard problems 19 IRIS H.-R. JIANG Proving NP-Completeness ¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for an L' Î NPC. ¨ Five steps for proving that L is NP-complete: 1. Prove L Î NP. 2. Select a known NP-complete problem L'. 3. Construct a reduction f transforming every instance of L' to an instance of L. 4. Prove that f is a polynomial-time transformation. 5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*. Hard problems 20 A known NP-complete problem L’ A problem L to be proved NP-complete reduce f
  • 19. IRIS H.-R. JIANG HC £P TSP: Step 2 ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ x Î HC Þ f(x) Î TSP. n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a tour in the transformed TSP instance. n The distance of the tour h is n = B since there are n consecutive edges in E, and so has distance 1 in f(x). n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B). Hard problems 17 IRIS H.-R. JIANG HC £P TSP: Step 2 (cont’d) ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ f(x) Î TSP Þ x Î HC. n Suppose there is a TSP tour with distance £ n = B. Let it be <v1, v2, …, vn, v1>. n Since distance of the tour £ n and there are n edges in the TSP tour, the tour contains only edges in E. n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC). Hard problems 18 IRIS H.-R. JIANG NP-complete problems intractable tractable ?? NP-Completeness ¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for every L' Î NP. ¨ NP-hard: If L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. ¨ Suppose L Î NPC. P=NP? ¤ If L Î P, then there exists a polynomial-time algorithm for every L' Î NP (i.e., P = NP). ¤ If L Ï P, then there exists no polynomial-time algorithm for any L' Î NPC (i.e., P ¹ NP). Hard problems 19 IRIS H.-R. JIANG Proving NP-Completeness ¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for an L' Î NPC. ¨ Five steps for proving that L is NP-complete: 1. Prove L Î NP. 2. Select a known NP-complete problem L'. 3. Construct a reduction f transforming every instance of L' to an instance of L. 4. Prove that f is a polynomial-time transformation. 5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*. Hard problems 20 A known NP-complete problem L’ A problem L to be proved NP-complete reduce f
  • 20. IRIS H.-R. JIANG HC £P TSP: Step 2 ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ x Î HC Þ f(x) Î TSP. n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a tour in the transformed TSP instance. n The distance of the tour h is n = B since there are n consecutive edges in E, and so has distance 1 in f(x). n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B). Hard problems 17 IRIS H.-R. JIANG HC £P TSP: Step 2 (cont’d) ¨ G has a HC iff the reduced instance has a TSP with distance £ B. ¤ f(x) Î TSP Þ x Î HC. n Suppose there is a TSP tour with distance £ n = B. Let it be <v1, v2, …, vn, v1>. n Since distance of the tour £ n and there are n edges in the TSP tour, the tour contains only edges in E. n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC). Hard problems 18 IRIS H.-R. JIANG NP-complete problems intractable tractable ?? NP-Completeness ¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for every L' Î NP. ¨ NP-hard: If L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. ¨ Suppose L Î NPC. P=NP? ¤ If L Î P, then there exists a polynomial-time algorithm for every L' Î NP (i.e., P = NP). ¤ If L Ï P, then there exists no polynomial-time algorithm for any L' Î NPC (i.e., P ¹ NP). Hard problems 19 IRIS H.-R. JIANG Proving NP-Completeness ¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP- complete (NPC) if 1. L Î NP, and 2. L' £P L for an L' Î NPC. ¨ Five steps for proving that L is NP-complete: 1. Prove L Î NP. 2. Select a known NP-complete problem L'. 3. Construct a reduction f transforming every instance of L' to an instance of L. 4. Prove that f is a polynomial-time transformation. 5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*. Hard problems 20 A known NP-complete problem L’ A problem L to be proved NP-complete reduce f