gecode icon indicating copy to clipboard operation
gecode copied to clipboard

Wrong optimal solution in Travelling Salesman example

Open iPapatsoris opened this issue 3 years ago • 1 comments

Describe the bug

Running tsp.cpp in the examples directory, the third hardcoded problem instance (br17 from TSPLIB) returns a solution of supposed optimal cost of 87, while the optimal solution reported by TSPLIB is 39. By copy and pasting the hardcoded input into a custom model that uses the cost-less version of the circuit constraint, I was able to get the 39, suggesting that it isn't a typo between the hardcoded data inside tsp.cpp and the one posted by TSPLIB.

To Reproduce

Compile /examples/tsp.cpp and run with argument 2.

Gecode and Platform Configuration

Gecode version commit bbefcea214fec798a0f5acc442581984555acd21 Ubuntu 18.04.1 LTS g++ 7.5.0

iPapatsoris avatar Jun 13 '22 15:06 iPapatsoris

Looking closer, this seems to be beacuse the TSP example is written with the assumption that 0 represents an invalid part, while br17 has 0-cost segments that are valid. This should be fixed, but requires checking all the examples to make sure that they are all as they should be.

zayenz avatar Jun 13 '22 15:06 zayenz