Is solving harder than checking? - PowerPoint PPT Presentation

About This Presentation
Title:

Is solving harder than checking?

Description:

Is solving harder than checking? Oded Goldreich Weizmann Institute of Science – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 23
Provided by: danar152
Category:

less

Transcript and Presenter's Notes

Title: Is solving harder than checking?


1
Is solving harder than checking?
  • Oded Goldreich
  • Weizmann Institute of Science

2
Intuition about Solving Problems
Example 1 Sudoku
3
Intuition about Solving Problems
Example 2 Labyrinth (maze)
4
Intuition about Solving Problems
Example 3 Jigsaw puzzle
5
Math Problems
Example 1 Factoring integers
5561
67 ? 83
787 ? 811
638257
6917 ? 8893
61512881
6
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
7
Math Problems
Example 3 Coloring a Map (with 3 colors)
8
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.
Eilat Beer Sheba Tiberias Haifa Tel-Aviv Jerusalem Location
309 81 152 151 58 -- Jerusalem
346 105 134 95 -- 58 Tel-Aviv
438 197 69 -- 95 151 Haifa
405 233 -- 69 134 152 Tiberias
241 -- 233 197 105 81 Beer Sheba
-- 241 405 438 346 309 Eilat
Example 5 Knapsack
Given a sequence of 20 integers and a target T,
find a subset of the integers that sums-up to T.
9
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.
10
Exhaustive search an obvious (but slow) way of
finding solutions to all problems
Trying all potential solutions, we find a correct
one once it is tried.
Example 1 Sudoku (with 50/81 entries missing).
950 possibilities.
Example 2 Labyrinth (with 20 junction/choices).
220 possibilities.
Example 3 3-coloring a map (with 20 countries).
320 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.
11
Are there better ways to find solutions?
(That is, faster than by exhaustive search)
Example 1 Solving systems of linear equations.
YES!
Example 2 Solving systems of quadratic
equations. (prob.) NO!
Example 3 3-coloring a (3-colorable) map.
(prob.) NO!
Example 4 2-coloring a (2-colorable) map. YES!
Example 5 TSP (traveling salesperson). (prob.)
NO!
Example 6 Factoring integers. (prob.) NO.
12
Formulation what do we mean by a search problem?
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
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.
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
13
Formulation search problems (more examples)
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.
Example 5 (Factoring) An instance is a composite
number N, and a valid solution is a pair of
numbers (P,Q) such that NP?Q.
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 ?i?INi T).
14
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.
15
Decision problems (a formulation)
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).
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 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
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).
16
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.
17
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.
18
Showing that an NP-problem is not in P
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.
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.
Assuming that P?NP (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., conded on P?NP). 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. P?NP ?
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.)
19
Universal problems (NP-completeness)
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 P?NP ? 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.
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.
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.
20
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.
21
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).
YES
YES
D
C
NO
NO
(e.g.,Factor)
(e.g.,3Color)
22
The End
  • The slides of this talk are available at
    http//www.wisdom.weizmann.ac.il/oded/T/p-vs-np.
    ppt
  • A related textbook is available at
  • http//www.wisdom.weizmann.ac.il/oded/bc-book
    .html
Write a Comment
User Comments (0)
About PowerShow.com