Easy, Hard, and Impossible - PowerPoint PPT Presentation

1 / 99
About This Presentation
Title:

Easy, Hard, and Impossible

Description:

The Good King and the Evil King. The good king wants to build exactly one new bridge so that: ... bb. abb. 2. bab. ba. 1. List 2. List 1. The Post ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 100
Provided by: Elaine3
Category:
Tags: bb | easy | hard | impossible | king

less

Transcript and Presenter's Notes

Title: Easy, Hard, and Impossible


1
Easy, Hard, and Impossible
  • Elaine Rich

2
Easy
3
Tic Tac Toe
4
Hard
5
Chess
6
The Turk
Unveiled in 1770.
7
Searching for the Best Move
A B C D
E F G H I
J K L M (8)
(-6) (0) (0) (2) (5)
(-4) (10) (5)
8
How Much Computation Does it Take?
  • Middle game branching factor ? 35
  • Lookahead required to play master level chess ?
    8
  • 358 ?

9
How Much Computation Does it Take?
  • Middle game branching factor ? 35
  • Lookahead required to play master level chess ?
    8
  • 358 ? 2,000,000,000,000
  • Seconds in a year ?

10
How Much Computation Does it Take?
  • Middle game branching factor ? 35
  • Lookahead required to play master level chess ?
    8
  • 358 ? 2,000,000,000,000
  • Seconds in a year ?
    31,536,000
  • Seconds since Big Bang ? 300,000,000,000,000,00
    0

11
The Turk
Still fascinates people.
12
How Did It Work?
13
A Modern Reconstruction
Built by John Gaughan. First displayed in 1989.
Controlled by a computer. Uses the Turks
original chess board.
14
Chess Today
In 1997, Deep Blue beat Garry Kasparov.
15
Seems Hard But Really Easy
16
Nim
At your turn, you must choose a pile, then remove
as many sticks from the pile as you like.
                                          
                     
The player who takes the last stick(s) wins.
17
Nim
Now lets try
                                          
                     
18
Nim
Now lets try
                                          
                     
Oops, now there are a lot of possibilities to try.
19
Decimal Numbers
20
Decimal Numbers
21
Decimal Numbers
22
Decimal Numbers
23
Binary Numbers
24
Binary Numbers
25
Binary Numbers
26
Binary Numbers
27
Binary Numbers
28
Binary Numbers
29
Nim
My turn
                                          
                     
10 (2) 10 (2) 11 (3) 11
  • For the current player
  • Guaranteed loss if last row is all 0s.
  • Guaranteed win otherwise.

30
Nim
My turn
                                          
                     
100 (4) 010 (2) 101 (5) 011
  • For the current player
  • Guaranteed loss if last row is all 0s.
  • Guaranteed win otherwise.

31
Nim
Your turn
                                          
                     
100 (4) 001 (1) 101 (5) 000
  • For the current player
  • Guaranteed loss if last row is all 0s.
  • Guaranteed win otherwise.

32
Or You Could Use Your Toothpicks for
33
Or You Could Use Your Toothpicks for
34
Or You Could Use Your Toothpicks for
35
Following Paths
36
Seven Bridges of Königsberg
37
Seven Bridges of Königsberg
Seven Bridges of Königsberg
1
3
4
2
As a graph
38
For Any Graph
  • An Eulerian path Cross every edge exactly once.
  • All these people care
  • ? Bridge inspectors
  • ? Road cleaners
  • ? Network analysists

39
A Simpler Example
40
Eulers Observation
Define the degree of a vertex to be the number
of edges with it as an endpoint.
41
Eulers Observation
Define the degree of a vertex to be the number
of edges with it as an endpoint. Euler
observed that ? A connected graph
possesses an Eulerian path that is not a
circuit iff it contains exactly two vertices of
odd degree. ? A connected graph possess an
Eulerian circuit iff all its vertices
have even degree.
42
Does the Required Path Exist?
1
3
4
2
As a graph
43
The Good King and the Evil King
The good king wants to build exactly one new
bridge so that
  • Theres an Eulerian path from the pub to his
    castle.
  • But there isnt one from the pub to the castle
    of his evil brother on the other bank of the
    river.

44
Heres What He Starts With
1
3
4
2
As a graph
45
Heres What He Ends Up With
1
3
4
2
As a graph
46
Unfortuntately, There Isnt Always a Trick
Suppose we need to visit every vertex exactly
once.
47
The Traveling Salesman Problem
15
25
10
28
20
4
8
40
9
7
3
23
Given n cities and the distances between each
pair of them, find the shortest tour that returns
to its starting point and visits each other city
exactly once along the way.
48
Visting Vertices Rather Than Edges
  • ? A Hamiltonian path visit every vertex exactly
    once.
  • ? A Hamiltonian circuit visit every vertex
    exactly once and end up where you started.
  • All these people care
  • Salesmen,
  • Farm inspectors,
  • Network analysts

49
The Traveling Salesman Problem
15
25
10
28
20
4
8
40
9
7
3
23
Given n cities Choose a first city n Choose
a second n-1 Choose a third n-2 n!
50
The Traveling Salesman Problem
Can we do better than n! ? First city
doesnt matter. ? Order doesnt matter. So
we get (n-1!)/2.
51
The Growth Rate of n!
52
Putting it into Perspective
53
Getting Close Enough
  • Use a technique that is guaranteed to find an
    optimal solution and likely to do so quickly.
  • Use a technique that is guaranteed to run quickly
    and find a good solution.

The Concorde TSP Solver found an optimal route
that visits 24,978 cities in Sweden.
The World Tour Problem
54
Is This The Best We Can Do?
  • It is generally believed that theres no
    efficient algorithm that finds an exact solution
    to
  • The Travelling Salesman problem
  • The question of whether or not a Hamiltonian
    circuit exists.

Would you like to win 1M?
The Millenium Prize
55
Impossible
56
An Interesting Puzzle
2 List 1 b a b b b List 2 b a
57
An Interesting Puzzle
2 1 List 1 b a b b b
b List 2 b a b b b
58
An Interesting Puzzle
2 1 1 List 1 b a b b
b b b List 2 b a b b b b b b
59
An Interesting Puzzle
2 1 1 3 List 1 b a b
b b b b b a List 2 b a b b b b b b a
60
The Post Correspondence Problem
61
The Post Correspondence Problem
62
The Post Correspondence Problem
63
The Post Correspondence Problem
64
Can A Program Do This?
Can we write a program to answer the following
question
Given a PCP instance P, decide whether or not P
has a solution. Return
True if it does. False if it does not.
65
What is a Program?
66
What is a Program?
A procedure that can be performed by a computer.
67
The Post Correspondence Problem
A program to solve this problem Until a
solution or a dead end is found do If dead end,
halt and report no. Generate the next candidate
solution. Test it. If it is a solution, halt
and report yes. So, if there are say 4 rows in
the table, well try 1 2 3
4 1,1 1,2 1,3
1,4 1,5 2,1 1,1,1 .
68
Will This Work?
  • If there is a solution
  • If there is no solution

69
A Tiling Problem
70
A Tiling Problem
71
A Tiling Problem
72
A Tiling Problem
73
A Tiling Problem
74
A Tiling Problem
75
A Tiling Problem
76
A Tiling Problem
77
A Tiling Problem
78
A Tiling Problem
79
Another Tiling Problem
80
Another Tiling Problem
81
Another Tiling Problem
82
Can A Program Do This?
Can we write a program to answer the following
question
Given a tiling problem T, decide whether or not T
can tile a plane. Return
True if it can. False if it can not.
83
Deciding a Tiling Problem
A program to solve this problem Until the
answer is clearly yes or a dead end is found
do If dead end, halt and report no. Generate
the next candidate solution. Test it. If it is
a solution, halt and report yes.
84
Will This Work?
  • If T can tile a plane
  • If T can not tile a plane

85
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
read name if name Elaine then print
You win!! else print You lose ?
86
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
read number set result to 1 set counter to
2 until counter gt number do set result to result
counter add 1 to counter print result
87
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
read number set result to 1 set counter to
2 until counter gt number do set result to result
counter add 1 to counter print result
Suppose number 5 result number
counter 1 5 2 2 5 3 6 5 4
24 5 5 120 5 6
88
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
read number set result to 1 set counter to
2 until counter gt number do set number to number
counter add 1 to counter print result
Suppose number 5 result number
counter 1 5 2 1 10 3 1
30 4 1 120 5 1 600 6
89
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
The 3x 1 Problem
read number until number 1 do if
number is even then set number to number/2
if number is odd then set number to 3?number
1
Suppose number is 7
90
Programs Debug Programs
Given an arbitrary program, can it be guaranteed
to halt?
read number until number 1 do if
number is even then set number to number/2
if number is odd then set number to 3?number
1
Collatz Conjecture This program always
halts. We can try it on big numbers
http//math.carleton.ca/7Eamingare/mathzone/3n1.
html
91
The Impossible
The halting problem cannot be solved.
We can prove that no program can ever be written
that can look at arbitrary other programs and
decide whether or not they always halt.
92
The Halting Problem is Not Solvable
  • Consider the following program
  • Trouble(string)
  • If Halts(string, string) then loop forever
  • else halt.
  • Now we invoke Trouble(ltTroublegt).
  • What should Halts(ltTroublegt, ltTroublegt) say? If
    it
  • Returns True (Trouble will halt)
    Trouble ______
  • Returns False (Trouble will not halt)

93
The Halting Problem is Not Solvable
  • Consider the following program
  • Trouble(string)
  • If Halts(string, string) then loop forever
  • else halt.
  • Now we invoke Trouble(ltTroublegt).
  • What should Halts(ltTroublegt, ltTroublegt) say? If
    it
  • Returns True (Trouble will halt)
    Trouble loops
  • Returns False (Trouble will not halt) Trouble
    ______

94
The Halting Problem is Not Solvable
  • Consider the following program
  • Trouble(string)
  • If Halts(string, string) then loop forever
  • else halt.
  • Now we invoke Trouble(ltTroublegt).
  • What should Halts(ltTroublegt, ltTroublegt) say? If
    it
  • Returns True (Trouble will halt)
    Trouble loops
  • Returns False (Trouble will not halt) Trouble
    halts
  • So there is no answer that Halts can give that
    does not lead to a contradiction.

95
Other Unsolvable Problems
  • Tiling
  • We can encode a ltprogramgt,ltinputgt pair as an
    instance of a tiling problem so that there is an
    infinite tiling iff ltprogramgt halts on ltinputgt.
  • 00010000111000000111110000000000000
    00010000111010000111110000000000000
  • 00010000111011000111110000000000000
  • So if the tiling problem were solvable then
    Halting would be.
  • But Halting isnt. So neither is the tiling
    problem.

96
Other Unsolvable Problems
  • PCP
  • We can encode a ltprogramgt,ltinputgt pair as an
    instance of PCP so that the PCP problem has a
    solution iff ltprogramgt halts on ltinputgt.

2 1 1 List 1 b a b b
b b b List 2 b a b b b b b b
  • So if PCP were solvable then Halting would be.
  • But Halting isnt. So neither is PCP.

97
Which is Amazing
Given the things programs can do.
98
Which is Amazing
Given the things programs can do.
http//www.bdi.com/content/sec.php?sectionBigDog
99
Which is Amazing
Given the things programs can do.
http//pc.watch.impress.co.jp/docs/2003/1218/sony_
06.wmv
Write a Comment
User Comments (0)
About PowerShow.com