Skip to content

feat: Added rustsat and z3 constraint dominance programming solving capabilities#1619

Open
TronciuVlad wants to merge 9 commits intoconjure-cp:mainfrom
TronciuVlad:rustsat_cdp
Open

feat: Added rustsat and z3 constraint dominance programming solving capabilities#1619
TronciuVlad wants to merge 9 commits intoconjure-cp:mainfrom
TronciuVlad:rustsat_cdp

Conversation

@TronciuVlad
Copy link
Contributor

@TronciuVlad TronciuVlad commented Mar 11, 2026

Description

This PR adds dominance-relation support across the SAT and SMT adaptors, including incremental dominance constraint injection during solution enumeration and final CLI pruning of dominated solutions

It also updates the tree-sitter Essence syntax from dominanceRelation ... to dominance relation ..., and adjusts the integration test harness so dominance tests no longer generate or compare rule traces

Related issues

N/A

Key changes

  • Added dominance-aware solving in both the RustSAT and SMT adaptors:
    • store dominance expressions from the model
    • substitute fromSolution(...) using the current/prior solution
    • rewrite the resulting dominance constraint
    • inject the rewritten constraint incrementally after each solution
  • Moved the shared rewrite_model_with_configured_rewriter helper into conjure-cp-core and used it in the dominance rewrite paths, so these rewrites now follow the configured rewriter instead of hard-coding rewrite_naive
  • Kept retroactive pruning of dominated solutions in CLI output
  • Updated the tree-sitter parser to accept dominance relation directly
  • Updated dominance/parser Essence fixtures to the new syntax
  • Updated integration tests so dominance models skip generated/expected rule-trace handling
  • Removed stale dominance expected rule-trace fixtures, since those traces are no longer part of dominance integration validation

How to test/review

  1. Review dominance constraint generation/injection in:
    crates/conjure-cp-core/src/solver/adaptors/rustsat/adaptor.rs
    crates/conjure-cp-core/src/solver/adaptors/smt/adaptor.rs

  2. Review the shared configured-rewriter helper in:
    crates/conjure-cp-core/src/rule_engine/mod.rs

  3. Review the tree-sitter syntax change in:
    crates/tree-sitter-essence/grammar.js
    crates/tree-sitter-essence/src/parser.c

  4. Review the dominance integration-test behavior change in:
    tests-integration/tests/integration_tests.rs

  5. Run targeted tests:
    cargo test -p conjure-cp-core smt::adaptor -- --nocapture
    cargo test -p tests-integration --test integration_tests dominance_ -- --nocapture

  6. Optional spot checks:
    cargo test -p tests-integration --test integration_tests tests_integration_dominance_sat_pareto_01 -- --nocapture
    cargo test -p tests-integration --test integration_tests tests_integration_basic_bool_01 -- --nocapture

Expected behavior:

  • dominance integration tests pass without generating/comparing rule traces
  • non-dominance integration tests still generate rule traces as before
  • SAT and SMT dominance examples produce the expected nondominated solution sets

@conjure-bot
Copy link

conjure-bot bot commented Mar 11, 2026

RustDoc Coverage

Report: https://conjure-cp.github.io/conjure-oxide-reports/pr/1619/coverage-docs/index.html

This PR: 43.33% documented, 3.43% with examples (35/442/1020)
Main: 43.28% documented, 3.43% with examples (35/441/1019)
Delta: docs +0.06 pp, examples -0.00 pp

@conjure-bot
Copy link

conjure-bot bot commented Mar 11, 2026

Code Coverage

Report: https://conjure-cp.github.io/conjure-oxide-reports/pr/1619/coverage-code/index.html
Diff report: https://conjure-cp.github.io/conjure-oxide-reports/pr/1619/coverage-code/diff-coverage.html

This PR: 75.34% lines (18510/24568)
Diff: 86.00% lines (790/914 measured; 1514 changed)
Main: 73.79% lines (16907/22913)
Delta vs main: +1.55 pp

Copy link
Contributor

@ozgurakgun ozgurakgun left a comment

Choose a reason for hiding this comment

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

  • disable tracing in the CDP rewrite call
  • use the configured rewriter
  • change syntax to "dominance relation"
  • support kissat with simulated incremental

@conjure-bot
Copy link

conjure-bot bot commented Mar 19, 2026

@TronciuVlad TronciuVlad changed the title feat: Added rustsat constraint dominance programming solving capabilities (draft) feat: Added rustsat and z3 constraint dominance programming solving capabilities (draft) Mar 19, 2026
@TronciuVlad TronciuVlad changed the title feat: Added rustsat and z3 constraint dominance programming solving capabilities (draft) feat: Added rustsat and z3 constraint dominance programming solving capabilities Mar 19, 2026
@TronciuVlad TronciuVlad marked this pull request as ready for review March 19, 2026 10:19
@TronciuVlad
Copy link
Contributor Author

@ozgurakgun Undrafted the pr

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.

2 participants