Skip to content

Fix #298: [Model] LengthBoundedDisjointPaths#659

Merged
zazabap merged 9 commits intomainfrom
issue-298-lengthboundeddisjointpaths
Mar 16, 2026
Merged

Fix #298: [Model] LengthBoundedDisjointPaths#659
zazabap merged 9 commits intomainfrom
issue-298-lengthboundeddisjointpaths

Conversation

@GiggleLiu
Copy link
Contributor

Summary

Add the LengthBoundedDisjointPaths model, its tests, CLI creation support, canonical example, and paper entry.

Fixes #298

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 99.40828% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.96%. Comparing base (d922f80) to head (806492c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/graph/length_bounded_disjoint_paths.rs 98.97% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #659      +/-   ##
==========================================
+ Coverage   96.94%   96.96%   +0.02%     
==========================================
  Files         273      275       +2     
  Lines       36505    36843     +338     
==========================================
+ Hits        35388    35724     +336     
- Misses       1117     1119       +2     

☔ 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

  • Added the new LengthBoundedDisjointPaths graph satisfaction model with J * |V| binary membership encoding, path-slot validation, registry wiring, canonical example, and paper entry.
  • Added CLI creation support and help text for explicit and random LengthBoundedDisjointPaths instances.
  • Added model, example-db, and trait-consistency coverage; regenerated exported schemas and reduction graph artifacts.

Deviations from Plan

  • The repo-local review-implementation flow only reviews committed diffs, so the implementation had to be committed before review, with review fixes landing in a follow-up commit.
  • Review findings led to two semantic hardenings beyond the initial plan: large K values are now accepted instead of asserting K <= |V|, and evaluation now rejects reused direct s-t slots and non-binary configs.

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 graph decision problem model, LengthBoundedDisjointPaths, and wires it through the library exports, CLI creation flow, examples/fixtures, and docs so it can be created/serialized/tested like the existing graph models.

Changes:

  • Introduces LengthBoundedDisjointPaths model (schema entry, variant declaration, evaluation logic) plus unit tests and example-db spec/fixture.
  • Exposes the new model via models/prelude, updates trait-consistency tests, and updates generated docs JSON + paper.
  • Extends pred create (including random generation) and CLI flag documentation to support the new model.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/unit_tests/trait_consistency.rs Adds trait-consistency coverage for the new model
src/unit_tests/models/graph/length_bounded_disjoint_paths.rs New unit tests for evaluation/solver/serde behavior
src/unit_tests/export.rs Minor formatting change in export test
src/unit_tests/example_db.rs Minor fixture-verification formatting/refactor
src/models/mod.rs Re-exports the new graph model from the top-level models module
src/models/graph/mod.rs Registers the new model module + example-db specs hook
src/models/graph/length_bounded_disjoint_paths.rs New model implementation, schema entry, examples, variants, and tests hook
src/lib.rs Adds the new model to the public prelude exports
src/example_db/fixtures/examples.json Adds a canonical example fixture for the new model
problemreductions-cli/src/commands/create.rs Adds CLI creation/random-generation support and help example for the new model
problemreductions-cli/src/cli.rs Adds new flags and documents required flags for the model
docs/src/reductions/reduction_graph.json Adds the model to the generated reduction graph docs
docs/src/reductions/problem_schemas.json Adds the model schema to generated schema docs
docs/paper/reductions.typ Adds a paper section/example for the new model

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

"HamiltonianPath" => "--graph 0-1,1-2,2-3",
"LengthBoundedDisjointPaths" => {
"--graph 0-1,1-6,0-2,2-3,3-6,0-4,4-5,5-6 --source 0 --sink 6 --num-paths-required 2 --bound 3"
}
Comment on lines +414 to +422
if source >= graph.num_vertices() || sink >= graph.num_vertices() {
bail!("--source and --sink must be valid graph vertices\n\n{usage}");
}
if num_paths_required == 0 {
bail!("--num-paths-required must be positive\n\n{usage}");
}
if max_length == 0 {
bail!("--bound must be positive\n\n{usage}");
}
Comment on lines +48 to +70
impl<G: Graph> LengthBoundedDisjointPaths<G> {
/// Create a new Length-Bounded Disjoint Paths instance.
pub fn new(
graph: G,
source: usize,
sink: usize,
num_paths_required: usize,
max_length: usize,
) -> Self {
assert!(
source < graph.num_vertices(),
"source must be a valid graph vertex"
);
assert!(
sink < graph.num_vertices(),
"sink must be a valid graph vertex"
);
assert_ne!(source, sink, "source and sink must be distinct");
assert!(
num_paths_required > 0,
"num_paths_required must be positive"
);
assert!(max_length > 0, "max_length must be positive");
@GiggleLiu
Copy link
Contributor Author

Follow-up after review:

  • Fixed the schema-driven pred create LengthBoundedDisjointPaths help path to show --bound instead of the nonexistent --max-length flag.
  • Updated the shared --bound flag docs, added CLI regression tests for the help-flag mapping, and cleaned the CLI clippy lint that surfaced during verification.
  • Verified with cargo test -p problemreductions-cli --bin pred test_problem_help, direct help output inspection, and cargo clippy -p problemreductions-cli --all-targets -- -D warnings.

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 graph decision problem model, LengthBoundedDisjointPaths, and wires it into the library, CLI creation workflow, examples/fixtures, tests, and generated documentation outputs.

Changes:

  • Introduces LengthBoundedDisjointPaths model (schema + variant declaration + example-db spec) and exports it via models and prelude.
  • Adds dedicated unit tests and includes the new model in trait-consistency checks and canonical example fixtures.
  • Extends the CLI pred create flow to support building LengthBoundedDisjointPaths instances (including schema-driven help flag naming).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/models/graph/length_bounded_disjoint_paths.rs New model implementation, schema registration, example-db spec, and variant declaration
src/models/graph/mod.rs Registers/exports the new graph model and includes its example specs
src/models/mod.rs Re-exports the new model from the top-level models module
src/lib.rs Re-exports the new model via the public prelude
src/unit_tests/models/graph/length_bounded_disjoint_paths.rs Adds model-level correctness, solver, and serialization tests
src/unit_tests/trait_consistency.rs Adds trait-consistency coverage for the new model
src/example_db/fixtures/examples.json Adds canonical example fixture entry for the new model
problemreductions-cli/src/cli.rs Adds CLI flags list entry and new args for source/sink/path count
problemreductions-cli/src/commands/create.rs Adds pred create support + schema-driven help flag naming tweaks
problemreductions-cli/src/problem_name.rs Minor internal refactor in edit distance DP initialization
docs/src/reductions/problem_schemas.json Generated schema docs updated to include the new model
docs/src/reductions/reduction_graph.json Generated reduction graph docs updated to include the new variant node
docs/paper/reductions.typ Adds paper documentation section + figure for the new model
src/unit_tests/export.rs Formatting-only change in unit test assertion
src/unit_tests/example_db.rs Formatting + improved labeling in fixture verification output

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

Comment on lines +429 to +437
if source >= graph.num_vertices() || sink >= graph.num_vertices() {
bail!("--source and --sink must be valid graph vertices\n\n{usage}");
}
if num_paths_required == 0 {
bail!("--num-paths-required must be positive\n\n{usage}");
}
if max_length == 0 {
bail!("--bound must be positive\n\n{usage}");
}
GiggleLiu and others added 3 commits March 16, 2026 18:10
…98-lengthboundeddisjointpaths

# Conflicts:
#	docs/src/reductions/reduction_graph.json
#	src/lib.rs
#	src/models/mod.rs
- validate LengthBoundedDisjointPaths CLI inputs consistently
- add regression coverage for constructor and CLI edge cases
- document the LengthBoundedDisjointPaths CLI flow and local run path
…ADME changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Collaborator

@zazabap zazabap left a comment

Choose a reason for hiding this comment

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

Final review passed — all CI green, coverage fixed, quality ~82%.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Collaborator

@zazabap zazabap left a comment

Choose a reason for hiding this comment

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

Final review passed — conflicts resolved, all weaknesses fixed, quality ~82%.

@zazabap zazabap merged commit a977548 into main Mar 16, 2026
3 checks passed
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] LengthBoundedDisjointPaths

3 participants