Is solving harder than checking? Oded Goldreich Weizmann Institute of Science.
-
date post
20-Dec-2015 -
Category
Documents
-
view
219 -
download
1
Transcript of Is solving harder than checking? Oded Goldreich Weizmann Institute of Science.
Math Problems
Example 2: Solving a system of linear (or quadratic) equations
2x + 3y z = 9
x y + 3z = 4
3x + 2y + z = 0
x = 1
y = 2
z = 1
2x2 + 3xy z = 0
x y2 + 3yz = 5
3x + 2xy +2xz = 3
x = 1
y = 1
z = 1
Math Problems
Example 4: Traveling Salesperson Problem (TSP)Given the pair-wise distances between 12 cities and a total distance bound, find a tour that visits all 12 cities and covers a total distance that does not exceed the bound.
Example 5: Knapsack
Given a sequence of 20 integers and a target T, find a subset of the integers that sums-up to T.
LocationJerusalem
Tel-Aviv
Haifa Tiberi
as Beer
Sheba Eilat
Jerusalem -- 58 151 152 81 309
Tel-Aviv 58 -- 95 134 105 346
Haifa 151 95 -- 69 197 438
Tiberias 152 134 69 -- 233 405
Beer Sheba 81 105 197 233 -- 241
Eilat 309 346 438 405 241 --
A common feature: Easy to check correctness
The fact that it is easy to check correctness of candidate solutions yields an obvious (but slow) way of finding solutions to all problems, called exhaustive search: Just try all potential solutions and check the correctness of each of them, halting with a correct solution once it is found.
Exhaustive search: an obvious (but slow) way of finding solutions to all problems
Example 3: 3-coloring a map (with 20 countries). 320
possibilities.
Trying all potential solutions, we find a correct one once it is tried.
Example 2: Labyrinth (with 20 junction/choices). 220
possibilities.
Example 1: Sudoku (with 50/81 entries missing). 950
possibilities.
Example 4: Factoring 8-digit integers. 10000 possibilities.
(When factoring 200-digit integers, there are 10100 possibilities!)
Example 5: TSP (with 12 cities). 11! = 39,916,800 possibilities.
Are there better ways to find solutions?
Example 3: 3-coloring a (3-colorable) map. (prob.) NO!
(That is, faster than by exhaustive search)
Example 1: Solving systems of linear equations.
YES!
Example 4: 2-coloring a (2-colorable) map. YES!
Example 5: TSP (traveling salesperson). (prob.) NO!
Example 2: Solving systems of quadratic equations.
(prob.) NO!
Example 6: Factoring integers. (prob.) NO.
Formulation: what do we mean by a search problem?
Example 3 (solving systems of equations): An instance is any system of (linear or quadratic) equations, and a solution is an assignment of numbers to the variables such that …
Example 2 (coloring maps): An instance is a 3-colorable map, and a valid solution is a 3-coloring of the areas such that no two adjacent areas are assigned the same color.
A problem is not a specific instance (e.g.,a specific Sudoko puzzle), but rather the general form/class/type (e.g., Sudoku).
A search problem consists of an infinite (or huge) set of instances and a concise/simple specification of valid solutions.Example 1 (Sudoku): An instance is any 9-by-9
rectangle partially filled with single digits, and a valid solution is an assignment of digits to the empty cells such that …
Formulation: search problems (more examples)
Example 6 (Knapsack): An instance is any sequence of numbers N1,N2,…,Nn,T, and a solution is a subset of the n first numbers that sums-up to T (i.e., a set I such that ∑iINi = T).
Example 5 (Factoring): An instance is a composite number N, and a valid solution is a pair of numbers (P,Q) such that N=PQ.
A search problem consists of an infinite (or huge) set of instances and a concise/simple specification of valid solutions.
Example 4 (TSP): An instance is any n-by-n matrix of distances among n cities and a bound L, and a valid solution is a tour that passes all n cities and has total length at most L.
The P-vs-NP Question (version 1: search problems)
“P” = All search problems that can be solved efficiently; that is, there exists an efficient procedure that, when given an instance of the problem, finds a valid solution to that instance (or indicates that none exists).
“NP” = All search problems for which valid solutions can be efficiently recognized; that is, there exists an efficient procedure that, when given an instance-solution pair, determines whether or not the solution is valid.
It is widely believed that there are problems in NP P.
For example: 3-Coloring, TSP, Knapsack, Solve-Quad-Equations,
and also Factoring.
Decision problems (a formulation)
A generic example (having solutions w.r.t a search problem): An instance is an instance of a search problem, and the question is whether this instance has a solution.
Example 2 (coloring maps): An instance is a map, and the question is whether it is 3-colrable (i.e., whether there exists a 3-coloring of the areas such that no two adjacent areas are assigned the same color).
Again, a problem is not a specific instance (e.g.,a specific Sudoko puzzle), but rather the general form/class/type (e.g., Sudoku).
A decision problem consists of an infinite (or huge) set of instances and a concise/simple specification of YES-instnaces (a set of instances having a “desired” property).
Example 1 (Sudoku): An instance is any 9-by-9 rectangle partially filled with single digits, and the question is whether it can be augmented such that …
Focus on the problem of 3-colorability
Coloring a Map with 3 colors such that no two adjacent areas are assigned the same color.
THM: Every map can be colored with four colors.
Some maps can be colored with three colors, this one not (e.g., Belarus is surrounded by five neighbors).
The decision problem: Given a map, determine whether it is 3-colorable.
The P-vs-NP Question (version 2: decision problems)
P = All decision problems that can be solved efficiently; that is, there exists an efficient procedure that, when given an instance of the problem, determines whether it is a YES-instance.
NP = All decision problems for which each YES-instance has an efficiently verifiable certificate; that is, there exists an efficient procedure that, when given an instance-certificate pair, determines whether or not the certificate is valid.
It is widely believed that there are problems in NP P.
For example: 3-Coloring, TSP, Knapsack, Solve-Quad-Equations.
Showing that an NP-problem is not in P
P = All decision problems that can be solved efficiently; that is, there exists an efficient procedure that, when given an instance of the problem, determines whether it is a YES-instance.
NP = All decision problems for which each YES-instance has an efficiently verifiable certificate; that is, there exists an efficient procedure that, when given an instance-certificate pair, determines whether or not the certificate is valid.
Assuming that PNP (but not knowing it for a fact), can we tell whether a specific problem is in NP-P?
We can only hope for a conditional result (i.e., cond’ed on PNP). We say that an NP-problem is NP-complete if the ability to efficiently solve it implies the ability to efficiently solve any problem in NP.
PNP NP-complete problems are hard to solve.
Thus, showing that a problem is NP-complete will do.
(For example: 3-Coloring, TSP, Knapsack, Solve-Quad-Equations.)
Universal problems (NP-completeness)
P = All decision problems that can be solved efficiently; that is, there exists an efficient procedure that, when given an instance of the problem, determines whether it is a YES-instance.
NP = All decision problems for which each YES-instance has an efficiently verifiable certificate; that is, there exists an efficient procedure that, when given an instance-certificate pair, determines whether or not the certificate is valid.
A problem in NP is called NP-complete if the ability to efficiently solve it implies the ability to efficiently solve any problem in NP.
Recall: PNP NP-complete problems are hard to solve.How can NP-complete problems possibly
exist? (Let alone how can we prove that they exist?)
Indeed, a good question to be answered next.
Still, let us state (as a fact/theorem) that 3-Coloring, TSP, Knapsack, Solve-Quad-Equations are all NP-complete.
Universal problems (NP-completeness) [continued]
A (decision) problem C in NP is called NP-complete if the ability to efficiently solve it implies the ability to efficiently solve any (decision) problem D in NP.
How can NP-complete problems possibly exist? (Let alone how can we prove that they exist?)
Idea: An efficient transformation of instances of
(any NP) problem D into instances of problem C such that YES-instances are mapped to YES-instances (and NO-instances are mapped to NO-instances).
For example: 3-Coloring, TSP, Knapsack, Solve-Quad-Equations are all NP-complete. Instances, say, of FACTORING (in NP) can be mapped to any of them.
Universal problems (NP-completeness) [2nd cont.]
A (decision) problem C in NP is called NP-complete if the ability to efficiently solve it implies the ability to efficiently solve any (decision) problem D in NP.
Shown via an efficient transformation of instances of (any NP) problem D into instances of problem C such that YES-instances are mapped to YES-instances (and NO-instances are mapped to NO-instances).
NONO
YESYESD
C
(e.g.,3Color)
(e.g.,Factor)