hamilton graphs section 6.3 6.3 hamilton graphs 2 east granby suffield 7 810 5 12 8 granby windsor...
Post on 21-Dec-2015
216 views
TRANSCRIPT
6.3 Hamilton Graphs 3
The “Traveling Salesman Problem” (TSP)
Hamilton Circuit – End where you started (Fed Ex)
Hamilton Path – End somewhere else (Printing Problem)
6.3 Hamilton Graphs 4
You solve it(Start and end at
Boston)
1. 650 miles
2. 700 miles
3. 750 miles
4. 850 miles
5. None of the above
Boston
NYC
DC
Philadelphia
150
250
150
200
300
100
6.3 Hamilton Graphs 5
How many routes must be checked to be sure to get the right answer?
1. 3
2. 4
3. 5
4. 6
Boston
NYC
DC
Philadelphia
150
250
150
200
300
100
6.3 Hamilton Graphs 6
But suppose this were the problem?
92
94 80 7
7
100
9097
75100
6775
82 85
98
88
85
98
82
85
98
95
6.3 Hamilton Graphs 7
Solution Method 1
“Brute Force”
• Calculate possible circuits (paths) that visit each location once and only once
• Then choose the circuit (path)
6.3 Hamilton Graphs 9
Solution Method 2
“Nearest Neighbor”(Start and end at A)
A “ ” algorithm
A B
D C
7
8
639
5
6.3 Hamilton Graphs 11
Use Brute ForceStart and end at A
(Draw a tree)
0% 0%0%
100%
B
22
A
C
14
9
8
5
3
D
1. 31
2. 34
3. 39
4. 49
6.3 Hamilton Graphs 12
Use Nearest Neighbor
Start and end at A
1. 31
2. 34
3. 39
4. 49
B
22
A
C
14
9
8
5
3
D
6.3 Hamilton Graphs 13
Nearest Neighbor
(Start and end at Granby)
42
mile
s
46
mile
s
51
mile
s
53
mile
s
None
of the
abo
ve
0% 0% 0%0%
100%
1. 42 miles
2. 46 miles
3. 51 miles
4. 53 miles
5. None of the above
Granby
Suffield
E. Granby
Windsor Locks
Bloomfield
8
10
12
4
129
6
14
14
10
6.3 Hamilton Graphs 14
Brute Force (Start and end at
Granby)
Granby
Suffield
E. Granby
Windsor Locks
Bloomfield
8
10
12
4
129
6
14
14
10
6.3 Hamilton Graphs 15
“Printing Jobs”
20
min
utes
22
min
utes
27
min
utes
29
min
utes
30
min
utes
0%
100%
0%0%0%
1. 20 minutes
2. 22 minutes
3. 27 minutes
4. 29 minutes
5. 30 minutes
Printing job A must be done first. The numbers are “down-times”. After doing job A it takes 7 minutes to set up job B, 8 minutes to set up C, and 10 minutes to set up D.
In what order should the jobs be scheduled so that the down-time is kept to a minimum?
A
B C
D
5
7 8
15
7 10
6.3 Hamilton Graphs 20Granby East Granby
Suffield
0 miles
7
8 10
5
12
8
12 miles20 miles28 miles38 miles
Windsor Locks
6.3 Hamilton Graphs 21East Granby
Suffield
0 miles
7
8 10
5
12
8
12 miles17 miles25 miles32 miles
Windsor Locks
Granby
6.3 Hamilton Graphs 22Granby East Granby
Suffield
0 miles7 miles
7
8 10
5
12
8
15 miles20 miles30 miles
Windsor Locks
6.3 Hamilton Graphs 24
Earth Simulator
In 2004, the Japanese developed a super computer known as “Earth Simulator” to study long-range global warming.
The $350 million computer performs 35.6 trillion calculations a second, more computations than there are stars in our galaxy
6.3 Hamilton Graphs 25
Computational Complexity
Computer 1 : A Toshiba laptop can check 10 Million paths each second
Computer 2: “Earth Simulator” can check 35.6 Trillion paths each second
6.3 Hamilton Graphs 26
Vertices Paths Toshiba laptop Earth Simulator 10 million/second
35.6 trillion/second5 4! = 24 < 1 second < 1 second
10 9! = 181,440 < 1 second < 1 second
15 14! = 87.2 billion 2.4 hours 0.24 secondBill Gates’ net worth
16 15! = 1.3 trillion 36.3 hours 3.1 seconds
17 16! = 21 trillion 24.2 days 58.8 seconds3 times the national debt / 21 cubes 300 foot sides (football field)
filled with pennies18 17! = 3.55x1014 13.7 months 16.6 minutes
19 18! = 1.2x1015 20.3 years 5 hours
20 19! = 1.2x1017 385.7 years 4 days
21 20! = 2.4x1018 7,714 years 11.3 weeksGrains of sand on all beaches in world
22 21! = 5.1x1019 162,000 years 4.6 years
25 24! = 1.5x1025 19.7 billion years 55,264.9 yearsYankees Payroll