Covered Bridge 54

Shortest Path

Yes, we are here! I have a shortest path between the 53 covered bridges in New Hampshire. (And if you’re just join now, yes, I know there are 54 bridges, it just that two of them share the same parking coordinates.)

How did I find it? I reset to square one. I don’t have the computer science chops to understand why the pthon-mip solution wasn’t working for me, so I googled. And yes, I started off googling. But this time I hit something new. I don’t know if I missed it before or if it is new code, but I found a new open source package that would perfect for solving this sort of problem and better yet, since the TSP is a classic computer science problem, there was sample code for it. I’m taking about Google’s OR-Tools.

OR-Tools is an open source software suite for optimization, tuned for tackling the world’s toughest problems in vehicle routing, flows, integer and linear programming, and constraint programming.

I quickly plugged my data into their sample code, ran it, and it pretty much instantly told me the solution. But, it was something like 1 -> 4 -> 13, giving me the path based upon the indices of the bridges. It was a quick bit of programming to print out both the names and the coordinates so I could plot them. Of course, I’ve uploaded cb-or.py to GitHub. But I know what you want to see. And there you have it. The path!

Am I done? No, you need to know the list of bridges, in order!

  1. Ashuelot Bridge, Winchester
  2. Coombs Bridge, Winchester,
  3. Slate Bridge, Swanzey
  4. Denman Thompson Bridge, Swanzey
  5. Sawyer’s Crossing, Swanzey
  6. Carleton Bridge, Swanzey
  7. County Bridge, Hancock
  8. Heniker Bridge, Heniker
  9. Rowell’s Bridge, Hopkinton
  10. Railroad Bridge, Hopkinton
  11. Dalton Bridge, Warner
  12. Waterloo Bridge, Warner
  13. Bement Bridge, Bradford
  14. Cilleyville Bridge, Andover
  15. Keniston Bridge, Andover
  16. Sulphite Bridge, Franklin
  17. Smith Bridge, Plymouth
  18. Blair Bridge, Campton
  19. Turkey Jim’s Bridge, Campton
  20. Bump Bridge, Campton
  21. Squam Bridge, Ashland
  22. Durgin Bridge, Sandwich
  23. Whittier Bridge, Ossipee
  24. Albany Bridge, Albany
  25. Saco River Bridge
  26. Swift River Bridge
  27. Bartlett Bridge, Bartlett
  28. Honeymoon Bridge, Jackson
  29. Stark Bridge, Stark
  30. Groveton Bridge, Northumberland
  31. Columbia Bridge, Columbia
  32. Pittsburg-Clarksville Bridge, Pittsburg
  33. Happy Corner Bridge, Pittsburg
  34. River Road Bridge, Pittsburg
  35. Mechanic Street Bridge, Lancaster
  36. Mt.Orne Bridge, Lancaster
  37. Sentinel Pine Bridge, Lincoln
  38. Clark’s Bridge, North Woodstock
  39. Swiftwater Bridge, Bath
  40. Bath Bridge, Bath
  41. Bath-Haverhill Bridge, Bath
  42. Edgell Bridge, Lyme
  43. Packard Hill Bridge, Lebanon
  44. Meriden Bridge, Plainfield
  45. Blow-Me-Down Bridge, Cornish
  46. Cornish-Windsor Bridge, Cornish
  47. Dingleton Hill Bridge, Cornish
  48. Blacksmith Shop Bridge, Cornish
  49. Wright’s Bridge, Newport
  50. Pier Bridge, Newport
  51. Corbin Bridge, Newport
  52. Mcdermott Bridge, Langdon
  53. Prentiss Bridge, Langdon

Am I done?

No…

There’s still the trip planning but also, the disturbing part. I don’t know if this is correct.

You see, this route is 1,018,296 meters, or 632.7 miles. And remember the wrong solution from python-mip, it was 961,591 meters, or 597.5 miles. That’s a really big difference. Both are less than the “by hand” version of 676 miles. But wow.

And I’m not sure how to proceed from here. The map looks good, it looks believable. But there’s a potential 35 mile gap. I need to look into this some more.

Leave a Reply