Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #686 +/- ##
==========================================
- Coverage 97.39% 97.38% -0.02%
==========================================
Files 339 341 +2
Lines 43413 43659 +246
==========================================
+ Hits 42284 42519 +235
- Misses 1129 1140 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds a new graph game model, GeneralizedHex, to the problemreductions model registry and wires it through the CLI, examples/fixtures, and paper docs so it can be created, serialized, and evaluated like existing graph problems.
Changes:
- Introduces the
GeneralizedHexmodel (memoized minimax evaluator;dims() = []) with schema/variant registration and a canonical example. - Adds CLI support for
pred create GeneralizedHex(including--source/--sinkand--randomgeneration) plus CLI tests. - Adds unit tests, example-db fixture entry, and paper documentation/references for the new model.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/graph/generalized_hex.rs | New GeneralizedHex model, schema registration, variants, and example-db hook |
| src/unit_tests/models/graph/generalized_hex.rs | Unit tests covering construction, evaluation, solver behavior, and serde round-trip |
| src/models/graph/mod.rs | Registers the new module/export and includes its canonical example spec |
| src/models/mod.rs | Re-exports GeneralizedHex from the top-level models module |
| src/lib.rs | Exposes GeneralizedHex in the crate prelude |
| problemreductions-cli/src/commands/create.rs | Adds create + random-generation support for GeneralizedHex and CLI tests |
| problemreductions-cli/src/cli.rs | Updates CLI help text to list GeneralizedHex flags and an example command |
| src/example_db/fixtures/examples.json | Adds GeneralizedHex example fixture (and modifies other existing fixtures) |
| docs/paper/references.bib | Adds citations relevant to Generalized Hex / Shannon switching game |
| docs/paper/reductions.typ | Adds a paper section describing GeneralizedHex and its canonical instance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if canonical == "LengthBoundedDisjointPaths" && field_name == "max_length" { | ||
| return "bound".to_string(); | ||
| } | ||
| if canonical == "GeneralizedHex" && field_name == "target" { | ||
| return "sink".to_string(); | ||
| } | ||
| field_name.replace('_', "-") |
| if !config.is_empty() { | ||
| return false; | ||
| } | ||
| let playable_vertices = self.playable_vertices(); | ||
| let vertex_to_state_index = self.vertex_to_state_index(&playable_vertices); | ||
| let mut state = vec![ClaimState::Unclaimed; playable_vertices.len()]; | ||
| let mut memo = HashMap::new(); | ||
| self.first_player_wins(&mut state, &vertex_to_state_index, &mut memo) |
| {"source":{"problem":"LongestCommonSubsequence","variant":{},"instance":{"strings":[[65,66,65,67],[66,65,67,65]]}},"target":{"problem":"ILP","variant":{"variable":"bool"},"instance":{"constraints":[{"cmp":"Le","rhs":1.0,"terms":[[0,1.0],[1,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[2,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[3,1.0],[4,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[5,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[2,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[0,1.0],[3,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[5,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[1,1.0],[4,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[0,1.0],[2,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[1,1.0],[2,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[1,1.0],[3,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[1,1.0],[5,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[4,1.0],[5,1.0]]}],"num_vars":6,"objective":[[0,1.0],[1,1.0],[2,1.0],[3,1.0],[4,1.0],[5,1.0]],"sense":"Maximize"}},"solutions":[{"source_config":[0,1,1,1],"target_config":[0,0,1,1,0,1]}]}, | ||
| {"source":{"problem":"MaxCut","variant":{"graph":"SimpleGraph","weight":"i32"},"instance":{"edge_weights":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"graph":{"inner":{"edge_property":"undirected","edges":[[0,1,null],[0,4,null],[0,5,null],[1,2,null],[1,6,null],[2,3,null],[2,7,null],[3,4,null],[3,8,null],[4,9,null],[5,7,null],[5,8,null],[6,8,null],[6,9,null],[7,9,null]],"node_holes":[],"nodes":[null,null,null,null,null,null,null,null,null,null]}}}},"target":{"problem":"SpinGlass","variant":{"graph":"SimpleGraph","weight":"i32"},"instance":{"couplings":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"fields":[0,0,0,0,0,0,0,0,0,0],"graph":{"inner":{"edge_property":"undirected","edges":[[0,1,null],[0,4,null],[0,5,null],[1,2,null],[1,6,null],[2,3,null],[2,7,null],[3,4,null],[3,8,null],[4,9,null],[5,7,null],[5,8,null],[6,8,null],[6,9,null],[7,9,null]],"node_holes":[],"nodes":[null,null,null,null,null,null,null,null,null,null]}}}},"solutions":[{"source_config":[0,1,0,1,0,1,0,0,0,1],"target_config":[0,1,0,1,0,1,0,0,0,1]}]}, | ||
| {"source":{"problem":"MaxCut","variant":{"graph":"SimpleGraph","weight":"i32"},"instance":{"edge_weights":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"graph":{"inner":{"edge_property":"undirected","edges":[[0,1,null],[0,4,null],[0,5,null],[1,2,null],[1,6,null],[2,3,null],[2,7,null],[3,4,null],[3,8,null],[4,9,null],[5,7,null],[5,8,null],[6,8,null],[6,9,null],[7,9,null]],"node_holes":[],"nodes":[null,null,null,null,null,null,null,null,null,null]}}}},"target":{"problem":"SpinGlass","variant":{"graph":"SimpleGraph","weight":"i32"},"instance":{"couplings":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"fields":[0,0,0,0,0,0,0,0,0,0],"graph":{"inner":{"edge_property":"undirected","edges":[[0,1,null],[0,4,null],[0,5,null],[1,2,null],[1,6,null],[2,3,null],[2,7,null],[3,4,null],[3,8,null],[4,9,null],[5,7,null],[5,8,null],[6,8,null],[6,9,null],[7,9,null]],"node_holes":[],"nodes":[null,null,null,null,null,null,null,null,null,null]}}}},"solutions":[{"source_config":[1,0,1,0,0,0,0,0,1,1],"target_config":[1,0,1,0,0,0,0,0,1,1]}]}, | ||
| {"source":{"problem":"MaximumClique","variant":{"graph":"SimpleGraph","weight":"i32"},"instance":{"graph":{"inner":{"edge_property":"undirected","edges":[[0,1,null],[0,2,null],[0,3,null],[0,4,null],[1,2,null],[1,3,null],[1,5,null],[2,4,null],[2,5,null],[3,4,null],[3,5,null],[4,5,null]],"node_holes":[],"nodes":[null,null,null,null,null,null]}},"weights":[1,1,1,1,1,1]}},"target":{"problem":"ILP","variant":{"variable":"bool"},"instance":{"constraints":[{"cmp":"Le","rhs":1.0,"terms":[[0,1.0],[5,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[1,1.0],[4,1.0]]},{"cmp":"Le","rhs":1.0,"terms":[[2,1.0],[3,1.0]]}],"num_vars":6,"objective":[[0,1.0],[1,1.0],[2,1.0],[3,1.0],[4,1.0],[5,1.0]],"sense":"Maximize"}},"solutions":[{"source_config":[1,1,1,0,0,0],"target_config":[1,1,1,0,0,0]}]}, |
| //! Generalized Hex problem implementation. | ||
| //! | ||
| //! Generalized Hex asks whether the first player has a forced win in the | ||
| //! vertex-claiming Shannon switching game on an undirected graph. | ||
|
|
Agentic Review ReportStructural Check
Build: CI passing, patch coverage 95.42%, project coverage 97.03%. Whitelist: FAIL — Semantic Review:
Issue Compliance:
Quality CheckDesign Principles:
HCI (CLI changed):
Test Quality Issues:
Agentic Feature Tests
Issues:
Generated by review-pipeline |
Resolve conflicts: keep GeneralizedHex alongside newly added models (ConjunctiveQueryFoldability, ResourceConstrainedScheduling, PartitionIntoPathsOfLength2, etc.). Adapt ModelExampleSpec to new API. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Final review notes:
All local checks pass ( |
zazabap
left a comment
There was a problem hiding this comment.
Final review passed. All conflicts resolved, inline comments addressed, coverage meets threshold. LGTM.
- Fix GeneralizedHex: graph.inner.edges -> graph.edges (no inner wrapper in serialized SimpleGraph) - Fix ConjunctiveBooleanQuery: x.optimal.at(0).config -> x.optimal_config (adapted to new ModelExampleSpec API) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
Add the
GeneralizedHexgraph model with a zero-variable memoized minimax evaluator, CLI creation support (--source/--sinkand--random), focused unit coverage, the canonical example fixture, and the corresponding paper/reference updates.Fixes #572