Skip to content

Add staged inter-distance propagation with variable separation - #247

Open
zayenz wants to merge 11 commits into
mainfrom
feature/inter-distance
Open

zayenz wants to merge 11 commits into
mainfrom
feature/inter-distance

Conversation

@zayenz

@zayenz zayenz commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Add native inter-distance constraints for fixed and variable separation. The public overloads enforce |x[i] - x[j]| >= p and accept an integer constant or IntVar distance.

IPL_BASIC uses the O(n log n), linear-space feasibility algorithm and binary search to tighten a variable distance's upper bound. IPL_DEF, IPL_ADVANCED, and IPL_BASIC_ADVANCED schedule quadratic bounds(Z) filtering after that stage. Distance one rewrites to the existing bounds-consistent distinct propagator. Domains with holes use interval supports.

Feasibility uses sorted Region arrays and Fenwick trees for task loads and active residue groups. Residue removal and reactivation reuse the same scratch storage. Filtering separates forbidden-region construction, completion tables, and internal and external adjustment sweeps. The propagator uses Gecode views, subscriptions, cloning, disposal, and temporary region storage. Wide arithmetic covers deadlines, reflected bounds, and assigned gaps.

The tests use the integer test harness for assignment, cloning, search, and consistency, with custom Base tests for heterogeneous domains and posting contracts. The independent tuple oracle checks feasibility, supported bounds, and maximum distance, and records complete inputs on failure. Public documentation, paper references, the changelog, and both build systems are included.

Validation

  • All 36 focused tests passed before and after the refactor under AddressSanitizer and UndefinedBehaviorSanitizer: gecode-test -test InterDistance -iter 1.
  • Tuple enumeration covers 18,522 interval triples, 2,000 randomized fixed-distance cases, and 512 variable-distance cases, including holes and integer limits. A focused case exercises residue removal followed by reactivation.
  • Three independent Astra reviews checked the residue data structure, filtering invariants, code structure, and test-harness integration; no findings remained.
  • All 14 CI checks passed on commit 075e07ef3e, including every Windows build and test job.
  • Tidy and git diff --check passed.

Algorithm references: Garey et al., SIAM Journal on Computing 1981, Quimper, Lopez-Ortiz, and Pesant, AAAI 2006, and the CPL 2008 extension, Section 5 for variable distance.

@zayenz
zayenz marked this pull request as ready for review October 4, 2026 11:48

@zayenz zayenz left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Combined filter preparation and pruning. The sole caller no longer has to perform a separate initialization step.
  • Documented the dual links encoding and the adjustment cursor owned by each live bound-group representative.

This branch has not been deployed

No deployments
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