Skip to content

Fix zero-cost edges in the TSP example#229

Draft
zayenz wants to merge 2 commits into
mainfrom
feature/fix-tsp-zero-cost-edges
Draft

Fix zero-cost edges in the TSP example#229
zayenz wants to merge 2 commits into
mainfrom
feature/fix-tsp-zero-cost-edges

Conversation

@zayenz

@zayenz zayenz commented Jul 13, 2026

Copy link
Copy Markdown
Member

The br17 example reports 87 instead of the published optimum of 39 because it treats every zero in the distance matrix as a missing edge. br17 contains valid off-diagonal zero-cost edges.

Remove that extra filtering and let circuit enforce the tour. The example then reaches 39; the two smaller instances retain costs 2276 and 22.

Add a focused CTest regression that runs the real br17 example and requires cost 39. Include it in the Ninja CI test selection so zero-cost edges cannot be filtered again unnoticed.

Checks:

  • configured a Release Ninja build with examples and testing enabled
  • built the tsp target
  • ran example-tsp-zero-cost-edges successfully (0.37 seconds)
  • restored the old filter temporarily and confirmed the regression fails with best cost 87
  • restored the fix, rebuilt, and reran the regression successfully
  • git diff --check

Closes #151.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant