Conversation
… graph Zero-cost connector edges allowed multi-hop shortest paths between non-adjacent arcs, creating optimal SC permutations that don't map back to valid Hamiltonian circuits. Change connector edge lengths from 0 to 1 so only single-hop connectors are optimal (cost 2n instead of n). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #791 +/- ##
==========================================
- Coverage 97.85% 97.85% -0.01%
==========================================
Files 625 625
Lines 68311 68329 +18
==========================================
+ Hits 66846 66863 +17
- Misses 1465 1466 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #789: the reduction chain
HamiltonianCircuit → StackerCrane → ILPreturnedOr(false)on the prism graph, which has a valid Hamiltonian circuit.Root Cause
The HC→StackerCrane reduction splits each vertex$v_i$ into $v_i^{in}$ (= $2i$ ) and $v_i^{out}$ (= $2i+1$ ), adding:
The zero-cost connectors form a rich network where multi-hop paths are also zero-cost. On the prism graph, vertices 5 and 6 have no direct connector (original edge${2,3}$ doesn't exist), but a 5-hop zero-cost path exists:
This means the ILP can find an optimal SC permutation$n = 6$ that does not correspond to a valid Hamiltonian circuit. When extracted back to HC, edges $2→3$ and $0→5$ don't exist →
[1, 2, 3, 0, 5, 4]with costOr(false).Fix
Change connector edge lengths from 0 to 1. This ensures:
Correctness proof for all graphs:
Since every optimal permutation at cost$2n$ must use only single-hop connectors (each costing exactly 1), every optimal SC permutation maps back to a valid HC. The
extract_solutionidentity mapping is therefore correct.Changes
src/rules/hamiltoniancircuit_stackercrane.rs— connector edge lengths 0 → 1, updated doc commentssrc/unit_tests/rules/hamiltoniancircuit_stackercrane.rs— updated expected costs (Test plan
test_hamiltoniancircuit_to_stackercrane_prism_graph)pred reduce --to StackerCrane | pred solvenow returnsOr(true)on prism graphexample-dbandilpfeatures passing (3657 tests)🤖 Generated with Claude Code