-
Notifications
You must be signed in to change notification settings - Fork 25
refactor(pumpkin-propagators): Move away from TestSolver in propagator tests #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b3ae02c
Create CLAUDE.md file
maartenflippo 492da7e
refactor(pumpkin-propagators): Move away from `TestSolver` in propaga…
maartenflippo 1fad8af
Be consistent in the way conflicts are expected in tests
maartenflippo 6762154
Update arithmetic propagators to use StateExt::assert_bounds
maartenflippo 85d5fa3
Move cumulative and element to use `StateExt::assert_bounds`
maartenflippo 5cf02dc
Fix formatting
maartenflippo 17bc914
More cleanup of cumulative test cases
maartenflippo 8d73261
And even more cumulative cleanup
maartenflippo ecdd9e1
Fix cumulative test cases
maartenflippo 0b1d927
Fix conjunction creation
maartenflippo 611ed5f
Document StateExt
maartenflippo 74598bc
Remove unnecessary qualification
maartenflippo 9af7f88
Fix renaming errors
maartenflippo be13814
Remove more unnecessary qualification
maartenflippo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Overview | ||
|
|
||
| Pumpkin is a constraint programming (CP) solver written in pure Rust, based on the lazy clause generation paradigm. It supports proof logging via DRAT (SAT) and DRCP (CP) certificates. | ||
|
|
||
| ## Build & Development Commands | ||
|
|
||
| ```bash | ||
| # Build | ||
| cargo build | ||
| cargo build --release | ||
|
|
||
| # Test (standard CI command) | ||
| cargo test --release --no-fail-fast --features pumpkin-solver/check-propagations | ||
|
|
||
| # Run a single test | ||
| cargo test --release --features pumpkin-solver/check-propagations <test_name> | ||
|
|
||
| # Format (requires nightly) | ||
| cargo +nightly fmt | ||
| cargo +nightly fmt --check # check only | ||
|
|
||
| # Lint (requires nightly) | ||
| cargo +nightly clippy --all-targets -- -Dwarnings | ||
|
|
||
| # Docs | ||
| cargo doc --no-deps | ||
|
|
||
| # License check | ||
| cargo deny check | ||
|
|
||
| # WASM tests (for pumpkin-crates/core) | ||
| wasm-pack test --release --node | ||
|
|
||
| # Python tests | ||
| cd pumpkin-solver-py && pytest | ||
| ``` | ||
|
|
||
| Scripts in `scripts/` (`fmt.sh`, `clippy.sh`, `documentation.sh`, `deny.sh`) mirror the CI commands and are also run by the pre-commit hook (`.githooks/pre-commit`). | ||
|
|
||
| ## Workspace Architecture | ||
|
|
||
| The project is a Cargo workspace (edition 2024, resolver 2). Crates are grouped by role: | ||
|
|
||
| ### Core Engine (`pumpkin-crates/`) | ||
| - **`core`** — The main solver engine. Contains the CDCL loop, propagation engine, nogood learning, branching heuristics, and proof logging infrastructure. This is the heart of the solver. | ||
| - **`checking`** — Shared types used by both `core` and `pumpkin-checker` (avoids circular deps). | ||
| - **`propagators`** — Implementations of CP propagators (arithmetic, cumulative, disjunctive, element, etc.). | ||
| - **`conflict-resolvers`** — Pluggable conflict analysis strategies for nogood derivation. | ||
| - **`constraints`** — High-level constraint API built on top of `core`. | ||
|
|
||
| ### Interfaces | ||
| - **`pumpkin-solver`** — CLI binary. Accepts CNF, WCNF (MaxSAT), and FlatZinc input formats. | ||
| - **`pumpkin-solver-py`** — Python bindings via PyO3. | ||
|
|
||
| ### Proof Infrastructure | ||
| - **`drcp-format`** — Reading/writing the DRCP proof certificate format. | ||
| - **`pumpkin-checker`** — Standalone proof verification tool. | ||
| - **`pumpkin-proof-processor`** — Proof transformation/preprocessing utility. | ||
| - **`drcp-debugger`** — Debugging tool for DRCP proofs. | ||
|
|
||
| ### Parsing & Utilities | ||
| - **`fzn-rs`** / **`fzn-rs-derive`** — FlatZinc parser and derive macros. | ||
| - **`pumpkin-macros`** — Procedural macros used across the workspace. | ||
| - **`minizinc/`** — MiniZinc integration (solver plugin). | ||
|
|
||
| ## Key Design Concepts | ||
|
|
||
| - **Lazy Clause Generation (LCG)**: The solver operates on a hybrid SAT/CP model. CP propagators generate explanations (clauses/nogoods) on demand during conflict analysis. | ||
| - **Proof Logging**: Every inference can be certified. The `core` crate threads proof-logging through propagators via a `Proof` type. The `check-propagations` feature enables runtime validation of propagator explanations during tests. | ||
| - **Propagator Interface**: Custom propagators implement the `Propagator` trait in `pumpkin-crates/core`. They must provide both `propagate` and `explain` methods for proof soundness. | ||
| - **Feature Flags**: `pumpkin-solver/check-propagations` enables expensive correctness assertions — always enable this when running tests. | ||
|
|
||
| ## Code Style | ||
|
|
||
| - **Rust edition 2024**, stable toolchain (see `rust-toolchain.toml`), but formatting/linting requires nightly. | ||
| - Line length: 120 chars for comments (`rustfmt.toml`). | ||
| - Imports: grouped (std / external / crate), single-line style enforced. | ||
| - Workspace-level lints are configured in the root `Cargo.toml` — check there before suppressing warnings locally. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.