Skip to content

Fix #289: Add ShortestWeightConstrainedPath model#632

Open
zazabap wants to merge 7 commits intomainfrom
issue-289-shortest-weight-constrained-path
Open

Fix #289: Add ShortestWeightConstrainedPath model#632
zazabap wants to merge 7 commits intomainfrom
issue-289-shortest-weight-constrained-path

Conversation

@zazabap
Copy link
Collaborator

@zazabap zazabap commented Mar 13, 2026

Summary

  • Add ShortestWeightConstrainedPath satisfaction problem model (bicriteria s-t path with length and weight bounds)
  • Register in CLI dispatch, aliases, and create command
  • Unit tests with brute-force solver verification
  • Paper documentation

Fixes #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.48943% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.90%. Comparing base (e2ef439) to head (4fdeed5).

Files with missing lines Patch % Lines
...c/models/graph/shortest_weight_constrained_path.rs 97.32% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #632      +/-   ##
==========================================
+ Coverage   96.88%   96.90%   +0.01%     
==========================================
  Files         269      271       +2     
  Lines       36036    36357     +321     
==========================================
+ Hits        34915    35232     +317     
- Misses       1121     1125       +4     

☔ 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

Implementation Summary

Changes

  • Added src/models/graph/shortest_weight_constrained_path.rs implementing the ShortestWeightConstrainedPath<G, N> satisfaction model with binary edge-selection encoding, path validation, canonical example-db registration, and declare_variants! complexity "2^num_edges".
  • Registered and re-exported the model in src/models/graph/mod.rs, src/models/mod.rs, and src/lib.rs.
  • Added model coverage in src/unit_tests/models/graph/shortest_weight_constrained_path.rs, src/unit_tests/trait_consistency.rs, and tests/suites/integration.rs.
  • Added CLI create support in problemreductions-cli/src/cli.rs and problemreductions-cli/src/commands/create.rs, plus regression coverage in problemreductions-cli/tests/cli_tests.rs.
  • Added paper/docs entries in docs/paper/reductions.typ and docs/paper/references.bib, then regenerated src/example_db/fixtures/examples.json, docs/src/reductions/problem_schemas.json, and docs/src/reductions/reduction_graph.json.
  • src/unit_tests/example_db.rs and src/unit_tests/export.rs only changed due cargo fmt after verification.

Deviations from Plan

  • The resumed PR branch was stale, so I merged origin/main into it before implementation to pick up the current pipeline scripts and repo structure.
  • The original review packet only saw the previously committed plan-file diff on the resumed branch, so I completed the review pass against the current working-tree patch and fixed the findings directly.
  • During review I renamed the numeric generic from W to N to match the issue spec and maintainer feedback, and I added negative CLI regression tests for the new error paths.

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 satisfaction model, ShortestWeightConstrainedPath, to the problemreductions catalog, integrating it into the CLI and documentation pipeline alongside tests and canonical examples.

Changes:

  • Introduces ShortestWeightConstrainedPath model with schema registration, variants, evaluation logic, and canonical example-db spec.
  • Wires the model into public exports (models, prelude), CLI pred create flag parsing, and CLI test coverage.
  • Updates example-db fixtures and generated docs JSON (problem schemas + reduction graph) plus paper documentation/references.

Reviewed changes

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

Show a summary per file
File Description
tests/suites/integration.rs Adds integration coverage ensuring the brute-force solver can find a satisfying config.
src/unit_tests/trait_consistency.rs Extends trait-consistency checks to include the new model.
src/unit_tests/models/graph/shortest_weight_constrained_path.rs Adds unit tests for construction, accessors, evaluation, brute-force enumeration, and serde roundtrip.
src/unit_tests/export.rs Minor formatting adjustment in export-related test.
src/unit_tests/example_db.rs Refactors formatting/labeling in fixture verification assertions.
src/models/mod.rs Re-exports the new graph model at the models module level.
src/models/graph/shortest_weight_constrained_path.rs Implements the model + schema entry + canonical example + variant declaration.
src/models/graph/mod.rs Registers module, re-export, and canonical example spec aggregation.
src/lib.rs Exposes the new model via the prelude.
src/example_db/fixtures/examples.json Adds canonical example fixture entry for the new model.
problemreductions-cli/tests/cli_tests.rs Adds CLI tests for pred create ShortestWeightConstrainedPath and error cases.
problemreductions-cli/src/commands/create.rs Implements pred create construction path and edge-length parsing helper.
problemreductions-cli/src/cli.rs Adds new CLI flags (--edge-lengths, bounds, source/target) and help text.
docs/src/reductions/reduction_graph.json Updates generated reduction graph catalog to include the new node/variant.
docs/src/reductions/problem_schemas.json Updates generated schema catalog to include the new problem’s fields.
docs/paper/references.bib Adds citations relevant to constrained shortest path.
docs/paper/reductions.typ Adds paper section/example/figure for the new model.

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

Comment on lines +32 to +33
FieldInfo { name: "length_bound", type_name: "N::Sum", description: "Upper bound K on total path length" },
FieldInfo { name: "weight_bound", type_name: "N::Sum", description: "Upper bound W on total path weight" },
Comment on lines +29 to +33
FieldInfo { name: "edge_weights", type_name: "Vec<N>", description: "Edge weights w: E -> ZZ_(> 0)" },
FieldInfo { name: "source_vertex", type_name: "usize", description: "Source vertex s" },
FieldInfo { name: "target_vertex", type_name: "usize", description: "Target vertex t" },
FieldInfo { name: "length_bound", type_name: "N::Sum", description: "Upper bound K on total path length" },
FieldInfo { name: "weight_bound", type_name: "N::Sum", description: "Upper bound W on total path weight" },
@GiggleLiu
Copy link
Contributor

Review Pipeline Report

Check Result
Copilot comments 0 actionable
Issue/human comments 4 checked, 2 fixed
Structural review 17/17 passed
CI green
Agentic test passed
Needs human decision none
Board Review pool -> Under review -> Final review

Remaining issues for final review

  • None.

🤖 Generated by review-pipeline

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] ShortestWeightConstrainedPath

3 participants