Skip to content

Fix #422: [Model] TwoDimensionalConsecutiveSets#673

Open
GiggleLiu wants to merge 6 commits intomainfrom
issue-422-two-dimensional-consecutive-sets
Open

Fix #422: [Model] TwoDimensionalConsecutiveSets#673
GiggleLiu wants to merge 6 commits intomainfrom
issue-422-two-dimensional-consecutive-sets

Conversation

@GiggleLiu
Copy link
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

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (dfcc313) to head (3b57820).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #673      +/-   ##
==========================================
+ Coverage   97.04%   97.06%   +0.01%     
==========================================
  Files         284      286       +2     
  Lines       38037    38234     +197     
==========================================
+ Hits        36914    37110     +196     
- Misses       1123     1124       +1     

☔ 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
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

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\""
)
})?;
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

2 participants