0

Travelling Salesman with latitude/longitude coordinates?

I am reading about many heuristics for the TSP and many use Euclidian x/y coordinates. But I have my data as latitude and longitude, so how do I use those heuristics? That is, is there a meaningful way to go from latitude/longitude to x/y coordinates?

Thanks

user2381422
  • 5,645
  • 14
  • 42
  • 56

1 Answers1

1

For the score function, you can just use Pythagoras directly on the latitude and longitude to calculate the distance between 2 points.

To visualize it in a panel with a specific width and height, take a look at my LatitudeLongitudeTranslator (java, open source, ASL 2.0) which is used in this TSP GUI.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • It's a little bit dangerous to use degrees directly in the Pythagoras theorem as its mapping to meters is not linear. I could agree that for some problems it's a (very fast) good-enough approach, but if you need precision, that's certainly not the way to go. – psousa Aug 13 '13 at 15:10
  • @psousa Agreed that the curving of the earth has an effect. However, many TSP datasets specify `EDGE_WEIGHT_TYPE : EUC_2D` which means you *must* ignore the curving and use Pythagoras. So it depends on the dataset. – Geoffrey De Smet Aug 14 '13 at 18:36