Skip to content

Fix #422: [Model] TwoDimensionalConsecutiveSets#673

Merged
isPANN merged 9 commits intomainfrom
issue-422-two-dimensional-consecutive-sets
Mar 20, 2026
Merged

Fix #422: [Model] TwoDimensionalConsecutiveSets#673
isPANN merged 9 commits intomainfrom
issue-422-two-dimensional-consecutive-sets

Conversation

@GiggleLiu
Copy link
Copy Markdown
Contributor

Summary

Add TwoDimensionalConsecutiveSets model — a satisfaction problem from Garey & Johnson (A4 SR19). Given an alphabet and collection of subsets, determines whether the alphabet can be partitioned into ordered groups satisfying intersection and consecutiveness constraints.

Fixes #422

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (e70b661) to head (66788e3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #673      +/-   ##
==========================================
+ Coverage   97.49%   97.50%   +0.01%     
==========================================
  Files         359      361       +2     
  Lines       45584    45780     +196     
==========================================
+ Hits        44440    44636     +196     
  Misses       1144     1144              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GiggleLiu
Copy link
Copy Markdown
Contributor Author

Implementation Summary

Changes

  • src/models/set/two_dimensional_consecutive_sets.rs — new model: struct, Problem/SatisfactionProblem impl, declare_variants!, canonical example
  • src/unit_tests/models/set/two_dimensional_consecutive_sets.rs — 11 unit tests (creation, evaluation, no-instance, solver, serialization, paper_example, panic tests)
  • src/models/set/mod.rs, src/models/mod.rs — module registration and re-export
  • src/unit_tests/trait_consistency.rs — new check_problem_trait entry
  • problemreductions-cli/src/commands/create.rs — CLI create arm (--universe, --sets)
  • problemreductions-cli/src/cli.rs — help table entry and example
  • docs/paper/reductions.typ — display-name entry + problem-def with data-driven example figure
  • docs/paper/references.bib — added @lipski1977fct citation
  • src/example_db/fixtures/examples.json — regenerated (36 satisfying solutions)
  • docs/src/reductions/ — updated problem_schemas.json and reduction_graph.json

Deviations from Plan

  • None

Open Questions

  • None

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new satisfiability model, TwoDimensionalConsecutiveSets (Garey & Johnson A4 SR19), and integrates it across the library, CLI, example DB, and documentation so it appears in the registry/graph and can be created from the CLI.

Changes:

  • Implement TwoDimensionalConsecutiveSets model + variant declaration + example-db spec.
  • Add unit tests (creation, evaluation, brute-force satisfiability, serialization, invalid-input panics) and trait-consistency coverage.
  • Integrate into CLI (pred create), example fixtures, docs JSON exports, and paper references/definition.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/models/set/two_dimensional_consecutive_sets.rs New model implementation, schema registration, variants, example-db hook, tests module include
src/models/set/mod.rs Expose the new set model and include example-db specs
src/models/mod.rs Re-export TwoDimensionalConsecutiveSets at the crate models level
src/unit_tests/models/set/two_dimensional_consecutive_sets.rs New unit tests for the model
src/unit_tests/trait_consistency.rs Add trait-consistency check for the new model
src/example_db/fixtures/examples.json Add canonical example instance + satisfying assignments
problemreductions-cli/src/commands/create.rs Add CLI example string + pred create support for the new model
problemreductions-cli/src/cli.rs Document flags and add usage example in CLI help text
docs/src/reductions/reduction_graph.json Add variant node for the new model in the rendered reduction graph
docs/src/reductions/problem_schemas.json Add schema entry for the new model in docs
docs/paper/references.bib Add Lipski 1977 reference
docs/paper/reductions.typ Add paper definition/example block for the new problem

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for subset in &self.subsets {
if subset.is_empty() {
continue;
}
Comment on lines +952 to +957
let universe = args.universe.ok_or_else(|| {
anyhow::anyhow!(
"TwoDimensionalConsecutiveSets requires --universe and --sets\n\n\
Usage: pred create TwoDimensionalConsecutiveSets --universe 6 --sets \"0,1,2;3,4,5;1,3;2,4;0,5\""
)
})?;
GiggleLiu and others added 5 commits March 17, 2026 01:43
The ModelExampleSpec struct changed on main to use instance/optimal_config/optimal_value
fields instead of a build closure. Also update Typst paper to use new example-db format.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@isPANN isPANN mentioned this pull request Mar 20, 2026
3 tasks
Split validation_error (which validated AND sorted) into a pure validate()
function and an explicit sorting step in try_new().

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@isPANN isPANN merged commit aa5e687 into main Mar 20, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-422-two-dimensional-consecutive-sets branch April 12, 2026 00:53
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.

[Model] TwoDimensionalConsecutiveSets

3 participants