Skip to content

Fix #289: Add ShortestWeightConstrainedPath model#632

Merged
isPANN merged 11 commits intomainfrom
issue-289-shortest-weight-constrained-path
Mar 21, 2026
Merged

Fix #289: Add ShortestWeightConstrainedPath model#632
isPANN merged 11 commits intomainfrom
issue-289-shortest-weight-constrained-path

Conversation

@zazabap
Copy link
Copy Markdown
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
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.43260% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.60%. Comparing base (cb32085) to head (537166b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/models/graph/shortest_weight_constrained_path.rs 97.42% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #632    +/-   ##
========================================
  Coverage   97.59%   97.60%            
========================================
  Files         387      389     +2     
  Lines       48159    48478   +319     
========================================
+ Hits        47002    47316   +314     
- Misses       1157     1162     +5     

☔ 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

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
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 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
Copy Markdown
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

isPANN and others added 2 commits March 21, 2026 04:05
…ight-constrained-path

# Conflicts:
#	docs/paper/reductions.typ
#	docs/paper/references.bib
#	docs/src/cli.md
#	docs/src/reductions/problem_schemas.json
#	docs/src/reductions/reduction_graph.json
#	problemreductions-cli/src/cli.rs
#	problemreductions-cli/src/commands/create.rs
#	src/example_db/fixtures/examples.json
#	src/lib.rs
#	src/models/graph/mod.rs
#	src/models/mod.rs
#	src/unit_tests/example_db.rs
#	src/unit_tests/trait_consistency.rs
#	tests/suites/integration.rs
- Resolve merge conflicts in 11 files (both-sides-added pattern)
- Remove generated files deleted in main (problem_schemas.json, reduction_graph.json, examples.json)
- Update ModelExampleSpec to use new API (instance/optimal_config/optimal_value instead of build closure)
- Fix paper Typst code: use graph.edges instead of graph.inner.edges, use optimal_config instead of samples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@isPANN isPANN mentioned this pull request Mar 20, 2026
3 tasks
isPANN and others added 2 commits March 21, 2026 13:23
- Add edge_lengths, source_vertex, target_vertex, length_bound, weight_bound to empty_args()
- Remove duplicate W::Sum pattern already covered by earlier match arm

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ight-constrained-path

# Conflicts:
#	docs/src/cli.md
@isPANN isPANN merged commit fc1cdf8 into main Mar 21, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-289-shortest-weight-constrained-path 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] ShortestWeightConstrainedPath

4 participants