MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
-
Upload
meljun-cortes-mbampa -
Category
Documents
-
view
220 -
download
0
Transcript of MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
1/21
CSC 3130: Automata theory and formal languages
Andrej Bogdanov
http://www.cse.cuhk.edu.hk/~andrejb/csc3130
Efficient computation
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
2/21
Why do we care about undecidability?
decidableundecidable
... pretty much everything else
L= {0n1n: n> 0}
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
3/21
Decidable problems
L
= {0
n
1
n
:n
> 0}On input x:n:= |x|
ifnis odd reject
fori:= 0 to n/2:
ifxi 0 orxn-i 1 rejectotherwise accept
IsP
a valid java program?
Can you get from pointA
to point B in 100 steps?
Option 1: Try all derivations
Option 2: CYK algorithm
Option 3: LR(1) algorithm
8
6 10 14
14
3
3
9
8 4
25
5
9A
B
For all paths out of pointA
of length at most 100:Try this pathIf path reaches B, accept
Otherwise, reject
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
4/21
Scheduling
Can you schedule final examsso that there are no conflicts?
Say we have nexams, k slots(maybe n= 200, k = 10)
Exams vertices
Slots colors
Conflicts edges
CSC 3230 CSC 2110
CSC 3160CSC 3130
...
Task: Assign one ofk colors to the vertices
so that no edge has both endpoints of same color
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
5/21
Scheduling algorithm
For every possible assignment
of colors to vertices:
Try this assignment
If every edge has endpoints
of different colors, accept
If all colorings failed, reject
Task: Assign one ofk colors to the verticesso that no edge has both endpoints of same color
CSC 3230 CSC 2110
CSC 3160CSC 3130
...
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
6/21
Matching
Can you pair up people sothat every pair is happy?
People vertices
Happy together edgesPairing matching
For every possible pairing:
If each pair is happy, acceptIf all pairings failed, reject
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
7/21
Shades of decidability
L= {0n
1n
: n> 0}
Sure, we can write a computer program...
...but what happens when we run it?
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
8/21
How fast?
L
= {0
n
1
n
:n
> 0}On input x:n:= |x|
ifnis odd reject
fori:= 0 to n/2:
ifxi 0 orxn-i 1 rejectotherwise accept
Is Pa valid java program?
Can you get from pointA
to point B in 100 steps?
Option 1: Try all derivations
Option 2: CYK algorithm
Option 3: LR(1) algorithm
8
6 10 14
14
3
3
9
8 4
25
5
9
A
B
For all paths out of pointA
of length at most 100:Try this pathIf path reaches B, accept
Otherwise, reject
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
9/21
How fast?
the lifetime of the universe
P= 100 line java programIs Pa valid java program?
Option 1: Try all derivations
Option 2: CYK algorithm
Option 3: LR(1) algorithm
1 week
a few milliseconds
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
10/21
Finding paths
Can you get from pointA
to point B in 1000 steps?
8
610 14
14
3
3
9
8 4
25
5
9
A
B
For all paths out of pointA
of length at most 1000:
Try this pathIf path reaches B, accept
Otherwise, reject
Is there a better wayto do this?
Yes! Dijkstras algorithm
Edsger Dijkstra(1930-2002)
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
11/21
Matching
For every possible pairing:If each pair is happy, accept
If all pairings failed, reject
Can we do better?
Yes! Edmonds algorithm
Jack Edmonds
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
12/21
Scheduling algorithm
Forevery possible assignment
of colors to vertices:
Try this assignment
If every edge has endpoints
of different colors, accept
If all colorings failed, reject
Task: Assign one ofk colors to the verticesso that no edge has both endpoints of same color
CSC 3230 CSC 2110
CSC 3160CSC 3130
100 vertices, 10 colors
10100 assignmentsCan we do better?
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
13/21
Some history
first electronic computer
UNIVAC
1950s
integrated circuits
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
14/21
The need for optimization
routing problems
how to route calls throughthe phone network?
packing problems
how many trucks do youneed to fit all the boxes?
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
15/21
The need for optimization
scheduling problems
how do you schedule jobsto complete them
as soon as possible?
constraint satisfaction
can you satisfy a systemof local constraints?
30 min
40 min
45 min
50 min
50 min
0 min
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
16/21
Fast algorithms
shortest
paths1956
matchings
1965and a few more
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
17/21
Proving theorems
Kurt Gdel
J. von Neumann
Princeton, 20 March 1956
Dear Mr. von Neumann:
With the greatest sorrow I have learned of your
illness. []
Since you now, as I hear, are feeling stronger, I
would like to allow myself to write you about a
mathematical problem: [] This would haveconsequences of the greatest importance. It
would obviously mean that in spite of the
undecidability of the Entscheidungsproblem,the mental work of a mathematician concerning
Yes-or-No questions could be completely
replaced by a machine.
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
18/21
Proving theorems
We know some true statements are not provable
But lets forget about those.
Can you get a computerto find the
proof reasonably quickly?
Better than try all possible proofs?
52 years later, we still dont know!
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
19/21
Optimization versus proofs
If we can find proofs quickly, then we can alsooptimize quickly!
Question: Can we colorGwith so there are no
conflicts?
Proof: We can, set
v1 v2
v3 v4
v1 v2 v3 v4
(v1,R), (v2,Y), (v3,R), (v4,Y)
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
20/21
The Cook-Levin Theorem
However,
Constraint satisfaction is no harderthanfinding proofs quickly
It is no easier, either
Stephen Cook Leonid Levin
Cook 1971, Levin 1973
-
7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 20
21/21
Equivalence of optimization problems
constraint
satisfaction
scheduling packing
coveringrouting
are all as hard as one another!
theorem-proving
Richard Karp
Q: So are they all easy orall hard?
A: We dont know, but we suspect
all hard
(1972)