Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #656 +/- ##
==========================================
+ Coverage 96.88% 96.90% +0.02%
==========================================
Files 269 271 +2
Lines 36036 36371 +335
==========================================
+ Hits 34915 35247 +332
- Misses 1121 1124 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds the new MultipleChoiceBranching graph model (Garey & Johnson ND11) to the core library and wires it through the example DB, docs, and CLI so it can be created/serialized/solved with existing tooling.
Changes:
- Introduces
MultipleChoiceBranchingmodel implementation + variant/schema registration and example-db spec. - Adds unit tests (model correctness + trait consistency), example fixtures, and CLI create/solve round-trip tests.
- Regenerates/updates docs artifacts (schemas + reduction graph) and paper content to include the new model.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/graph/multiple_choice_branching.rs | New model implementation, schema entry, variants, and example-db spec hook |
| src/models/graph/mod.rs | Registers module, re-exports type, and includes canonical example specs |
| src/models/mod.rs | Re-exports MultipleChoiceBranching from graph models |
| src/lib.rs | Adds MultipleChoiceBranching to the public prelude |
| src/unit_tests/models/graph/multiple_choice_branching.rs | New unit tests covering construction, validation, evaluate(), brute-force, and serde round-trip |
| src/unit_tests/trait_consistency.rs | Adds trait-consistency smoke test instantiation for the new model |
| src/example_db/fixtures/examples.json | Adds canonical example instance + satisfying/optimal configs for the model |
| problemreductions-cli/src/cli.rs | Adds --partition flag and documents MCB flags/examples in help text |
| problemreductions-cli/src/commands/create.rs | Implements pred create MultipleChoiceBranching/... parsing, including --partition parsing helper |
| problemreductions-cli/tests/cli_tests.rs | Adds CLI tests for create, example create, and create→solve piping |
| docs/src/reductions/problem_schemas.json | Adds generated schema entry for MultipleChoiceBranching |
| docs/src/reductions/reduction_graph.json | Adds node entry for MultipleChoiceBranching and regenerates graph indices |
| docs/paper/reductions.typ | Adds paper section + figure for MultipleChoiceBranching based on the canonical fixture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+491
to
+503
| let threshold = args.bound.ok_or_else(|| { | ||
| anyhow::anyhow!( | ||
| "MultipleChoiceBranching requires --bound\n\n\ | ||
| Usage: pred create MultipleChoiceBranching/i32 --arcs \"0>1,0>2,1>3,2>3,1>4,3>5,4>5,2>4\" --weights 3,2,4,1,2,3,1,3 --partition \"0,1;2,3;4,7;5,6\" --bound 10" | ||
| ) | ||
| })? as i32; | ||
| ( | ||
| ser(MultipleChoiceBranching::new( | ||
| graph, | ||
| weights, | ||
| partition, | ||
| threshold, | ||
| ))?, |
Comment on lines
+209
to
+223
| let arcs = graph.arcs(); | ||
| let mut in_degree = vec![0usize; graph.num_vertices()]; | ||
| for (index, &selected) in config.iter().enumerate() { | ||
| if selected == 1 { | ||
| let (_, target) = arcs[index]; | ||
| in_degree[target] += 1; | ||
| if in_degree[target] > 1 { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| let selected_arcs: Vec<bool> = config.iter().map(|&selected| selected == 1).collect(); | ||
| if !graph.is_acyclic_subgraph(&selected_arcs) { | ||
| return false; |
Comment on lines
+1473
to
+1495
| /// Parse `--partition` as semicolon-separated groups of comma-separated arc indices. | ||
| /// E.g., "0,1;2,3;4,7;5,6" | ||
| fn parse_partition_groups(args: &CreateArgs) -> Result<Vec<Vec<usize>>> { | ||
| let partition_str = args.partition.as_deref().ok_or_else(|| { | ||
| anyhow::anyhow!( | ||
| "MultipleChoiceBranching requires --partition (e.g., \"0,1;2,3;4,7;5,6\")" | ||
| ) | ||
| })?; | ||
|
|
||
| partition_str | ||
| .split(';') | ||
| .map(|group| { | ||
| group.trim() | ||
| .split(',') | ||
| .map(|s| { | ||
| s.trim() | ||
| .parse::<usize>() | ||
| .map_err(|e| anyhow::anyhow!("Invalid partition index: {}", e)) | ||
| }) | ||
| .collect() | ||
| }) | ||
| .collect() | ||
| } |
Contributor
Author
Review Pipeline Report
Remaining issues for final review
Generated by review-pipeline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MultipleChoiceBranchingFixes #253