Skip to content

Fix #296: [Model] UndirectedTwoCommodityIntegralFlow#658

Merged
zazabap merged 10 commits intomainfrom
issue-296-undirected-two-commodity-integral-flow
Mar 16, 2026
Merged

Fix #296: [Model] UndirectedTwoCommodityIntegralFlow#658
zazabap merged 10 commits intomainfrom
issue-296-undirected-two-commodity-integral-flow

Conversation

@GiggleLiu
Copy link
Contributor

Summary

Fixes #296

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 98.74608% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.97%. Comparing base (a977548) to head (25269e7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ls/graph/undirected_two_commodity_integral_flow.rs 97.84% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #658      +/-   ##
==========================================
+ Coverage   96.96%   96.97%   +0.01%     
==========================================
  Files         275      277       +2     
  Lines       36843    37161     +318     
==========================================
+ Hits        35724    36038     +314     
- Misses       1119     1123       +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 Author

Implementation Summary

Changes

  • Added the new UndirectedTwoCommodityIntegralFlow model with schema registration, variant declaration, canonical example, example-db exports, CLI create/help support, paper entry, and trait-consistency wiring.
  • Added model and CLI coverage for the canonical instance, registry visibility, example exports, and create-command behavior.
  • Tightened post-review edge-case handling for very large capacities by using checked/wider arithmetic in evaluate() and by returning user-facing CLI validation errors for invalid terminals/capacities instead of panicking.

Deviations from Plan

  • Review surfaced numeric-overflow and CLI-validation edge cases that were not explicit in the initial plan; these were fixed before finalizing the branch.

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 the UndirectedTwoCommodityIntegralFlow graph satisfaction model (Fixes #296) and wires it through the library registry, example DB, CLI, and docs/paper so it shows up as a first-class problem type across the project.

Changes:

  • Introduces UndirectedTwoCommodityIntegralFlow model implementation (schema registration, evaluation logic, variant declaration, canonical example spec).
  • Adds unit tests + example-db fixture entry for the model and updates trait-consistency checks.
  • Extends the CLI (list, show, create) and regenerates docs JSON / paper references + section for the new model.

Reviewed changes

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

Show a summary per file
File Description
src/models/graph/undirected_two_commodity_integral_flow.rs New model implementation, schema registration, variant declaration, example-db spec, tests module hook-up
src/models/graph/mod.rs Registers the new graph submodule, re-export, and adds example-db spec aggregation
src/models/mod.rs Re-exports the new model from the top-level models module
src/lib.rs Re-exports the model in the public prelude
src/unit_tests/models/graph/undirected_two_commodity_integral_flow.rs New unit tests for creation/evaluation/serialization and overflow edge cases
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
src/example_db/model_builders.rs Clarifies model-example sourcing (graph registry)
src/unit_tests/example_db.rs Formatting tweak in fixture verification output/labeling
src/unit_tests/export.rs Formatting tweak for JSON line assertion
problemreductions-cli/src/cli.rs Adds --capacities and terminal/requirement flags + help text/examples for pred create
problemreductions-cli/src/commands/create.rs Implements pred create UndirectedTwoCommodityIntegralFlow ... parsing/validation and adds type hints/example string
problemreductions-cli/src/problem_name.rs Adds alias-resolution test coverage for the new canonical name
problemreductions-cli/tests/cli_tests.rs Adds CLI tests for list, show, and create for the new model
docs/src/reductions/problem_schemas.json Regenerated schema JSON including the new model entry
docs/src/reductions/reduction_graph.json Regenerated reduction graph JSON including the new variant node
docs/paper/references.bib Adds Even–Itai–Shamir (1976) reference
docs/paper/reductions.typ Adds paper section + figure/example narrative 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",
"UndirectedTwoCommodityIntegralFlow" => {
"--graph 0-2,1-2,2-3 --capacities 1,1,2 --source-1 0 --sink-1 3 --source-2 1 --sink-2 3 --requirement-1 1 --requirement-2 1"
}
Comment on lines +6 to +10
fn even_capacity_instance() -> UndirectedTwoCommodityIntegralFlow {
UndirectedTwoCommodityIntegralFlow::new(
SimpleGraph::new(4, vec![(0, 2), (1, 2), (2, 3)]),
vec![1, 1, 2],
0,
GiggleLiu and others added 5 commits March 16, 2026 17:19
…96-undirected-two-commodity-integral-flow

# Conflicts:
#	src/example_db/fixtures/examples.json
#	src/models/graph/mod.rs
#	src/models/mod.rs
- Rename capacity_two_bottleneck_instance to canonical_instance
- Add #[should_panic] tests for constructor validation (capacity count
  mismatch, vertex out of bounds)
- Add flow conservation violation test and shared capacity exceeded test
- Replace platform-dependent large-capacity tests with portable versions
- Revert unrelated README.md change
- Remove stale test report file

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%.

Merge origin/main into issue-296 branch, resolving conflicts in
source code (models/mod.rs, cli.rs, create.rs, trait_consistency.rs,
reductions.typ, cli.md) by keeping both sides (UndirectedTwoCommodityIntegralFlow
from this branch + SteinerTree, SetBasis, LengthBoundedDisjointPaths from main).
Regenerated reduction_graph.json, problem_schemas.json, and examples.json.
Reverted README.md to main.

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 a4c3516 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] UndirectedTwoCommodityIntegralFlow

3 participants