SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
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

Más contenido relacionado

Más de HsuChi Chen

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

Más de 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
 
期末專題報告書
期末專題報告書期末專題報告書
期末專題報告書
 
單晶片期末專題-報告二
單晶片期末專題-報告二單晶片期末專題-報告二
單晶片期末專題-報告二
 
單晶片期末專題-報告一
單晶片期末專題-報告一單晶片期末專題-報告一
單晶片期末專題-報告一
 
模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告
 
單晶片期末專題-初步想法
單晶片期末專題-初步想法單晶片期末專題-初步想法
單晶片期末專題-初步想法
 

Último

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Último (20)

Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

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