A tour that may revisit needs shortest distances
transcript
A van must call at every depot. Depots 1, 2 and 3 hang off depot 0. Roads run only to depot 0.
Outer depots have no road between them. The outer depots are one unit from depot 0. A table over raw roads finds no tour. Shortest distances let the van pass depot 0. The tour costs four units.
First fill a table of shortest distances. Then run the mask table on top of it. Floyd-Warshall fills the first table. The state is the mask and the last depot.
Fourteen depots give 229,376 states. Each state tries up to fourteen next depots. That is 3,211,264 steps, which is fast.
When revisits are allowed, raw roads mislead. Replace roads with shortest distances. Now every depot is visited exactly once. The mask table is then correct.
A walk may pass a depot twice. Fill shortest distances first. Full breakdown in the lecture.