The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could...
Transcript of The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could...
![Page 1: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/1.jpg)
The Traveling Salesman Problem
Definition: A complete graph KN is a graph with Nvertices and an edge between every two vertices.
Definition: A weighted graph is a graph in which eachedge is assigned a weight (representing the time, distance, orcost of traversing that edge).
Definition: A Hamilton circuit is a circuit that uses everyvertex of a graph once.
Definition: The Traveling Salesman Problem (TSP) isthe problem of finding a minimum-weight Hamilton circuitin KN .
![Page 2: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/2.jpg)
The Traveling Salesman Problem
Example: Willy decides to visit every Australian cityimportant enough to be listed on this Wikipedia page.
To avoid rental-car fees, he must finish the tour in the samecity he starts it in.
What route minimizes the total distance he has to travel?
I.e., in this weighted K16, which Hamilton circuit has thesmallest total weight?
![Page 3: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/3.jpg)
The Traveling Salesman Problem
Example: Willy decides to visit every Australian cityimportant enough to be listed on this Wikipedia page.
To avoid rental-car fees, he must finish the tour in the samecity he starts it in.
What route minimizes the total distance he has to travel?
I.e., in this weighted K16, which Hamilton circuit has thesmallest total weight?
![Page 4: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/4.jpg)
The Traveling Salesman Problem
Example: Willy decides to visit every Australian cityimportant enough to be listed on this Wikipedia page.
To avoid rental-car fees, he must finish the tour in the samecity he starts it in.
What route minimizes the total distance he has to travel?
I.e., in this weighted K16, which Hamilton circuit has thesmallest total weight?
![Page 5: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/5.jpg)
The Traveling Salesman Problem
Example: Willy decides to visit every Australian cityimportant enough to be listed on this Wikipedia page.
To avoid rental-car fees, he must finish the tour in the samecity he starts it in.
What route minimizes the total distance he has to travel?
I.e., in this weighted K16, which Hamilton circuit has thesmallest total weight?
![Page 6: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/6.jpg)
The Brute-Force Algorithm
Willy could solve the problem by brute force:
I Make a list of all possible Hamilton circuits.
I Calculate the weight of each Hamilton circuit by addingup the weights of its edges.
I Pick the Hamilton circuit with the smallest total weight.
BIG PROBLEM: There are 16 vertices, so there are
(16− 1)! = 15! = 1, 307, 674, 368, 000
Hamilton circuits that each need to be checked.
![Page 7: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/7.jpg)
The Brute-Force Algorithm
Willy could solve the problem by brute force:
I Make a list of all possible Hamilton circuits.
I Calculate the weight of each Hamilton circuit by addingup the weights of its edges.
I Pick the Hamilton circuit with the smallest total weight.
BIG PROBLEM: There are 16 vertices, so there are
(16− 1)! = 15! = 1, 307, 674, 368, 000
Hamilton circuits that each need to be checked.
![Page 8: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/8.jpg)
The Brute-Force Algorithm
Willy could solve the problem by brute force:
I Make a list of all possible Hamilton circuits.
I Calculate the weight of each Hamilton circuit by addingup the weights of its edges.
I Pick the Hamilton circuit with the smallest total weight.
BIG PROBLEM: There are 16 vertices, so there are
(16− 1)! = 15! = 1, 307, 674, 368, 000
Hamilton circuits that each need to be checked.
![Page 9: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/9.jpg)
The Brute-Force Algorithm
Willy could solve the problem by brute force:
I Make a list of all possible Hamilton circuits.
I Calculate the weight of each Hamilton circuit by addingup the weights of its edges.
I Pick the Hamilton circuit with the smallest total weight.
BIG PROBLEM:
There are 16 vertices, so there are
(16− 1)! = 15! = 1, 307, 674, 368, 000
Hamilton circuits that each need to be checked.
![Page 10: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/10.jpg)
The Brute-Force Algorithm
Willy could solve the problem by brute force:
I Make a list of all possible Hamilton circuits.
I Calculate the weight of each Hamilton circuit by addingup the weights of its edges.
I Pick the Hamilton circuit with the smallest total weight.
BIG PROBLEM: There are 16 vertices, so there are
(16− 1)! = 15! = 1, 307, 674, 368, 000
Hamilton circuits that each need to be checked.
![Page 11: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/11.jpg)
Solving the TSP Without Brute Force
Idea: At each stage in your tour, choose the closest vertexthat you have not visited yet.
This is called the Nearest-Neighbor Algorithm (NNA).
This spreadsheet shows what happens when Willy uses theNNA to construct a Hamilton circuit (with Sydney as thereference vertex).
![Page 12: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/12.jpg)
The Nearest-Neighbor Algorithm
The result: The Nearest-Neighbor algorithm, using Sydney asthe reference vertex, yields the Hamilton circuit
SY → CN → ML → HO → AD → AS → UL → BM → KU→ DA → MI → CS → MK → BR → AL → PE → SY
whose total weight is 21,049 km.
A randomly chosen Hamilton circuit would have averaged40,680 km, so this is pretty good.
But can Willy do better?
![Page 13: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/13.jpg)
The Nearest-Neighbor Algorithm
The result: The Nearest-Neighbor algorithm, using Sydney asthe reference vertex, yields the Hamilton circuit
SY → CN → ML → HO → AD → AS → UL → BM → KU→ DA → MI → CS → MK → BR → AL → PE → SY
whose total weight is 21,049 km.
A randomly chosen Hamilton circuit would have averaged40,680 km, so this is pretty good.
But can Willy do better?
![Page 14: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/14.jpg)
The Repetitive Nearest-Neighbor Algorithm
Observation: Willy can use any city as the reference vertex!
That is, Willy can execute the Nearest-Neighbor Algorithmsixteen times, using each city once as the reference vertex.
Then, he can pick the Hamilton circuit with the lowest totalweight of these sixteen.
This is called the Repetitive Nearest-Neighbor Algorithm(RNNA).
![Page 15: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/15.jpg)
The Repetitive Nearest-Neighbor Algorithm
Ref. vertex Hamilton circuit WeightAD AD,ML,HO,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,PE,AL,AD 18543AL AL,PE,BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,AL 19795AS AS,UL,BM,KU,DA,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,AS 18459BR BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,ML,HO,CN,SY,AL,PE,BR 22113BM BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,PE,AL,BM 19148CS CS,MK,BR,SY,CN,ML,HO,AD,AS,UL,BM,KU,DA,MI,PE,AL,CS 22936CN CN,SY,ML,HO,AD,AS,UL,BM,KU,DA,MI,CS,MK,BR,AL,PE,CN 21149DA DA,KU,BM,UL,AS,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,DA 18543HO HO,ML,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,AL,PE,HO 20141KU KU,DA,AS,UL,BM,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,KU 18785MK MK,CS,MI,AS,UL,BM,KU,DA,AD,ML,HO,CN,SY,BR,AL,PE,MK 23255ML ML,HO,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,AL,PE,ML 20141MI MI,AS,UL,BM,KU,DA,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,MI 20877PE PE,AL,BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,PE 19148SY SY,CN,ML,HO,AD,AS,UL,BM,KU,DA,MI,CS,MK,BR,AL,PE,SY 21049 (NNA)UL UL,AS,MI,CS,MK,BR,SY,CN,ML,HO,AD,BM,KU,DA,PE,AL,UL 20763
![Page 16: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/16.jpg)
The Repetitive Nearest-Neighbor Algorithm
Ref. vertex Hamilton circuit WeightAD AD,ML,HO,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,PE,AL,AD 18543AL AL,PE,BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,AL 19795AS AS,UL,BM,KU,DA,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,AS 18459 (best)BR BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,ML,HO,CN,SY,AL,PE,BR 22113BM BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,PE,AL,BM 19148CS CS,MK,BR,SY,CN,ML,HO,AD,AS,UL,BM,KU,DA,MI,PE,AL,CS 22936CN CN,SY,ML,HO,AD,AS,UL,BM,KU,DA,MI,CS,MK,BR,AL,PE,CN 21149DA DA,KU,BM,UL,AS,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,DA 18543HO HO,ML,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,AL,PE,HO 20141KU KU,DA,AS,UL,BM,MI,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,KU 18785MK MK,CS,MI,AS,UL,BM,KU,DA,AD,ML,HO,CN,SY,BR,AL,PE,MK 23255ML ML,HO,CN,SY,BR,MK,CS,MI,AS,UL,BM,KU,DA,AD,AL,PE,ML 20141MI MI,AS,UL,BM,KU,DA,CS,MK,BR,SY,CN,ML,HO,AD,AL,PE,MI 20877PE PE,AL,BM,KU,DA,AS,UL,AD,ML,HO,CN,SY,BR,MK,CS,MI,PE 19148SY SY,CN,ML,HO,AD,AS,UL,BM,KU,DA,MI,CS,MK,BR,AL,PE,SY 21049 (NNA)UL UL,AS,MI,CS,MK,BR,SY,CN,ML,HO,AD,BM,KU,DA,PE,AL,UL 20763
![Page 17: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/17.jpg)
The Repetitive Nearest-Neighbor Algorithm
Apparently, using Alice Springs (AS) as the reference vertexyields the best Hamilton circuit so far, namely
AS → UL → BM → KU → DA → MI → CS → MK → BR→ SY → CN → ML → HO → AD → AL → PE → AS
Remember: Willy can still start anywhere he wants!For instance,
SY → CN → ML → HO → AD → AL → PE → AS→ UL→ BM→ KU→ DA→ MI→ CS→ MK→ BR→ SY
represents the same Hamilton circuit.
![Page 18: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/18.jpg)
The Repetitive Nearest-Neighbor Algorithm
Apparently, using Alice Springs (AS) as the reference vertexyields the best Hamilton circuit so far, namely
AS → UL → BM → KU → DA → MI → CS → MK → BR→ SY → CN → ML → HO → AD → AL → PE → AS
Remember: Willy can still start anywhere he wants!For instance,
SY → CN → ML → HO → AD → AL → PE → AS→ UL→ BM→ KU→ DA→ MI→ CS→ MK→ BR→ SY
represents the same Hamilton circuit.
![Page 19: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/19.jpg)
The Repetitive Nearest-Neighbor Algorithm
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 km
I In general, there’s no way of knowing in advance whichreference vertex will yield the best result.
I This algorithm is still efficient, but . . .
I Is it optimal? That is, Can Willy do even better?
![Page 20: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/20.jpg)
The Repetitive Nearest-Neighbor Algorithm
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 km
I In general, there’s no way of knowing in advance whichreference vertex will yield the best result.
I This algorithm is still efficient, but . . .
I Is it optimal? That is, Can Willy do even better?
![Page 21: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/21.jpg)
The Repetitive Nearest-Neighbor Algorithm
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 km
I In general, there’s no way of knowing in advance whichreference vertex will yield the best result.
I This algorithm is still efficient, but . . .
I Is it optimal? That is, Can Willy do even better?
![Page 22: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/22.jpg)
The Repetitive Nearest-Neighbor Algorithm
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 km
I In general, there’s no way of knowing in advance whichreference vertex will yield the best result.
I This algorithm is still efficient, but . . .
I Is it optimal? That is, Can Willy do even better?
![Page 23: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/23.jpg)
The Repetitive Nearest-Neighbor Algorithm
If we look at the map (warning: not quite to scale!) itbecomes clear that the RNNA has not produced an optimalHamilton circuit.
![Page 24: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/24.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 25: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/25.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 26: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/26.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 27: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/27.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 28: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/28.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 29: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/29.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 30: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/30.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 31: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/31.jpg)
Oops.
![Page 32: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/32.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 33: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/33.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 34: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/34.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 35: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/35.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 36: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/36.jpg)
Now the algorithm is stuck — some very expensive edges arerequired to complete the Hamilton circuit.
![Page 37: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/37.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 38: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/38.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 39: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/39.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 40: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/40.jpg)
The Repetitive Nearest-Neighbor Algorithm
Starting from Uluru would have created a different problem.
![Page 41: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/41.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 42: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/42.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 43: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/43.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 44: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/44.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 45: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/45.jpg)
The Repetitive Nearest-Neighbor Algorithm
Starting from Alice Springs would have created a differentproblem (but a less harmful one).
![Page 46: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/46.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 47: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/47.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 48: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/48.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 49: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/49.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 50: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/50.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 51: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/51.jpg)
It is easy for a human to look at this Hamilton circuit and finda way to improve it.
![Page 52: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/52.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 53: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/53.jpg)
It is easy for a human to look at this Hamilton circuit and finda way to improve it.
But how do you make such improvements part of thealgorithm?
![Page 54: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/54.jpg)
Does starting How about
![Page 55: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/55.jpg)
The Cheapest-Link Algorithm
Idea: Start in the middle.
I Find the single edge that would be cheapest to add.
I Keep doing this until you have a Hamilton circuit.
I Make sure you add exactly two edges at each vertex.
This is called the Cheapest-Link Algorithm, or CLA.Here is an example.
![Page 56: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/56.jpg)
The Cheapest-Link Algorithm
Idea: Start in the middle.
I Find the single edge that would be cheapest to add.
I Keep doing this until you have a Hamilton circuit.
I Make sure you add exactly two edges at each vertex.
This is called the Cheapest-Link Algorithm, or CLA.Here is an example.
![Page 57: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/57.jpg)
The Cheapest-Link Algorithm
Idea: Start in the middle.
I Find the single edge that would be cheapest to add.
I Keep doing this until you have a Hamilton circuit.
I Make sure you add exactly two edges at each vertex.
This is called the Cheapest-Link Algorithm, or CLA.Here is an example.
![Page 58: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/58.jpg)
The Cheapest-Link Algorithm
Idea: Start in the middle.
I Find the single edge that would be cheapest to add.
I Keep doing this until you have a Hamilton circuit.
I Make sure you add exactly two edges at each vertex.
This is called the Cheapest-Link Algorithm, or CLA.Here is an example.
![Page 59: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/59.jpg)
The Cheapest-Link Algorithm
Idea: Start in the middle.
I Find the single edge that would be cheapest to add.
I Keep doing this until you have a Hamilton circuit.
I Make sure you add exactly two edges at each vertex.
This is called the Cheapest-Link Algorithm, or CLA.Here is an example.
![Page 60: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/60.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 61: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/61.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 62: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/62.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 63: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/63.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 64: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/64.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 65: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/65.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 66: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/66.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 67: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/67.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 68: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/68.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 69: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/69.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 70: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/70.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 71: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/71.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 72: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/72.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 73: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/73.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 74: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/74.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 75: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/75.jpg)
Hobart
Canberra
Sydney
Brisbane
Mackay
Cairns
Mount Isa
Alice Springs
Kununurra
Darwin
Perth
Albany
(SY)(PE)
(MI)
(CN)
(HO)
(KU)
(MK)
(DA)
(AL)
(AS)
(CS)
(BR)
(BM)Broome
Melbourne (ML)
Adelaide (AD)
Uluru(UL)
![Page 76: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/76.jpg)
Comparing Algorithms
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 kmHamilton circuit using CLA: 18,543 km
This didn’t help in this case. But it might help in a differentexample (next time).
Can Willy do even better?
![Page 77: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/77.jpg)
Comparing Algorithms
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 kmHamilton circuit using CLA: 18,543 km
This didn’t help in this case. But it might help in a differentexample (next time).
Can Willy do even better?
![Page 78: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/78.jpg)
Comparing Algorithms
Randomly chosen Hamilton circuit: 40,680 kmHamilton circuit using NNA/Sydney: 21,049 kmHamilton circuit using RNNA: 18,459 kmHamilton circuit using CLA: 18,543 km
This didn’t help in this case. But it might help in a differentexample (next time).
Can Willy do even better?
![Page 79: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/79.jpg)
The Bad News
There is no known algorithm to solve theTSP that is both optimal and efficient.
I Brute-force is optimal but not efficient.
I NNA, RNNA, and CLA are efficient but not optimal.
![Page 80: The Traveling Salesman Problemjlmartin/courses/math105... · The Brute-Force Algorithm Willy could solve the problem by brute force: I Make a list of all possible Hamilton circuits.](https://reader033.fdocuments.us/reader033/viewer/2022051410/602cc0a08806f032c6103abe/html5/thumbnails/80.jpg)
The Bad News
There is no known algorithm to solve theTSP that is both optimal and efficient.
I Brute-force is optimal but not efficient.
I NNA, RNNA, and CLA are efficient but not optimal.