-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with coordinates < 1 #29
Comments
Hmm, I have not encountered this, can you post an example problem where this manifests itself? |
Sure. Here's a code snippet that I was using. There is an optimal tour, but optimal value == 0 in this case.
|
Bumping on this issue, is it because of the type of |
I think it may be related to some rounding occurring somewhere. This demonstrates the problem:
Very different answers are returned even though the nodes are only scaled. In my case, I got Using |
Distances are represented by integers in the TSPLIB format Every instance I've seen (e.g. CVRP) has integer node coordinates. |
Thanks for spotting that! From that documentation, seems like they have an R implementation of Scaling the nodes to get an integral coordinate is fine, but the problem is also the returned distance; if it's integral, it always gets truncated unnecessarily. |
I think the precision is specific to the R implementation, so the files that actually get written are integer-valued (i.e. when you load the file you need to remember what precision you wrote it with). Concorde reads the TSPLIB files, so it isn't aware of the precision and the truncation will always happen. |
That's really odd though, if you look at the Concorde implementation itself, their variables are of type |
According to TSPLIB-DOC, all distance functions return integer values. Coordinates can be floating, but distances are integral. |
Thanks for checking that out! So it's weird then, if I input floating point coordinates and receive a distance of 0. |
@legohyl When you input floating point coordinates, if the distance between two point is less than 0.5, then the distance is computed as zero. So, it is possible the shortest TSP tour can be of zero length. If your coordinates are pretty small numbers (say less than 100) then multiply some number, and then after solving it, divide the distance by the same number. |
Maybe they do this because rounding the distance to an integer makes the problem NP-complete (https://en.wikipedia.org/wiki/Travelling_salesman_problem#Euclidean) 🤷 |
Hello there, was wondering if anyone faces a similar issue whereby if the x and y coordinates given to the solver are >=0 and <=1, the returned optimal value is always 0.
The text was updated successfully, but these errors were encountered: