Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #664 +/- ##
========================================
Coverage 96.92% 96.93%
========================================
Files 271 273 +2
Lines 36298 36416 +118
========================================
+ Hits 35182 35299 +117
- Misses 1116 1117 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds the Partition satisfaction problem model to the misc model catalog, integrating it into the registry/docs/example DB and ensuring it participates in the project’s shared solver + trait infrastructure.
Changes:
- Introduces
Partitionmodel (Problem<Metric=bool>) with schema registration, variant declaration, and canonical example specs. - Adds a dedicated unit test suite for
Partitionand wires it into trait-consistency checks. - Updates generated documentation artifacts (problem schemas, reduction graph), paper catalog entry, and example DB fixtures.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unit_tests/trait_consistency.rs | Adds Partition to the cross-model trait sanity test. |
| src/unit_tests/models/misc/partition.rs | New unit tests for Partition behavior, solver integration, and serialization. |
| src/models/mod.rs | Re-exports Partition from models::misc. |
| src/models/misc/partition.rs | New Partition model implementation, schema inventory entry, variants, and example spec hook. |
| src/models/misc/mod.rs | Registers the new module and exposes Partition in misc. |
| src/lib.rs | Adds Partition to the public prelude exports. |
| src/example_db/fixtures/examples.json | Adds canonical Partition fixture (samples + satisfying set). |
| docs/src/reductions/reduction_graph.json | Adds Partition node and shifts indices accordingly (generated artifact). |
| docs/src/reductions/problem_schemas.json | Adds Partition schema entry (generated artifact). |
| docs/paper/reductions.typ | Adds Partition to the paper’s problem catalog and definition section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| #[test] | ||
| #[should_panic(expected = "All sizes must be positive")] |
Comment on lines
+102
to
+108
| let selected_sum: u64 = config | ||
| .iter() | ||
| .enumerate() | ||
| .filter(|(_, &x)| x == 1) | ||
| .map(|(i, _)| self.sizes[i]) | ||
| .sum(); | ||
| selected_sum * 2 == self.total_sum() |
Comment on lines
+102
to
+109
| let selected_sum: u64 = config | ||
| .iter() | ||
| .enumerate() | ||
| .filter(|(_, &x)| x == 1) | ||
| .map(|(i, _)| self.sizes[i]) | ||
| .sum(); | ||
| selected_sum * 2 == self.total_sum() | ||
| } |
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
Add the Partition problem model — a classical NP-complete satisfaction problem (Karp #20, Garey & Johnson SP12). Given a multiset of positive integers, decide whether it can be partitioned into two subsets of equal sum.
Implements the full model with brute-force solver support, canonical example, unit tests (>95% coverage), trait consistency, and paper entry.
Fixes #210