Fix #330: Add MinMaxMulticenter (p-Center) model#630
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #630 +/- ##
==========================================
- Coverage 97.59% 97.59% -0.01%
==========================================
Files 385 387 +2
Lines 47886 48159 +273
==========================================
+ Hits 46736 47002 +266
- Misses 1150 1157 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Implements the vertex-restricted p-center problem as a satisfaction problem:
given a graph with vertex weights, edge lengths, K centers, and distance
bound B, determine if K vertices can be chosen such that max{w(v)*d(v)} <= B.
Includes model, unit tests (15 tests), CLI creation support, canonical
example, and regenerated fixtures/schemas.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds a new graph satisfaction model, MinMaxMulticenter (vertex p-center), integrating it into the model registry, CLI creation workflow, example DB, and generated docs/paper materials.
Changes:
- Introduces
MinMaxMulticenter<G, W>model with schema/variant registration and brute-force compatibility. - Adds unit tests, trait-consistency coverage, and example-db fixture entry for the new model.
- Wires the model into exports/prelude, CLI
pred create, and regenerates docs JSON + paper section.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/models/graph/min_max_multicenter.rs | Implements the new MinMaxMulticenter satisfaction problem model, registers schema/variants, and provides example-db spec + tests module hook. |
| src/models/graph/mod.rs | Registers the new graph model module and re-exports it; adds canonical example spec hook. |
| src/models/mod.rs | Exposes MinMaxMulticenter at the top-level models module. |
| src/lib.rs | Adds MinMaxMulticenter to the prelude exports. |
| src/unit_tests/models/graph/min_max_multicenter.rs | Adds comprehensive unit tests for construction, evaluation, serialization, solver integration, and panics. |
| src/unit_tests/trait_consistency.rs | Adds a trait-consistency smoke test instance for MinMaxMulticenter. |
| src/example_db/fixtures/examples.json | Adds a canonical example instance and satisfying configurations for MinMaxMulticenter. |
| problemreductions-cli/src/commands/create.rs | Adds pred create MinMaxMulticenter support and a help example string. |
| problemreductions-cli/src/cli.rs | Documents MinMaxMulticenter-specific flags in CLI help text. |
| docs/src/reductions/problem_schemas.json | Adds generated schema entry for MinMaxMulticenter. |
| docs/src/reductions/reduction_graph.json | Adds generated reduction-graph node entry for MinMaxMulticenter and updates node indices accordingly. |
| docs/paper/reductions.typ | Adds paper section + figure/example text for MinMaxMulticenter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+174
to
+179
| // Initialize centers | ||
| for (v, &selected) in config.iter().enumerate() { | ||
| if selected == 1 { | ||
| dist[v] = Some(W::Sum::zero()); | ||
| } | ||
| } |
Comment on lines
+1013
to
+1014
| // Pick optimal[1] = {v1, v4} to match figure | ||
| let sol = x.optimal.at(1) |
Comment on lines
+966
to
+971
| let bound = args.bound.ok_or_else(|| { | ||
| anyhow::anyhow!( | ||
| "MinMaxMulticenter requires --bound (distance bound B)\n\n\ | ||
| Usage: pred create MinMaxMulticenter --graph 0-1,1-2,2-3 --k 2 --bound 2" | ||
| ) | ||
| })? as i32; |
…icenter # Conflicts: # docs/paper/reductions.typ # 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 # problemreductions-cli/src/commands/inspect.rs # problemreductions-cli/src/commands/solve.rs # problemreductions-cli/src/dispatch.rs # problemreductions-cli/tests/cli_tests.rs # src/example_db/fixtures/examples.json # src/lib.rs # src/models/graph/mod.rs # src/models/mod.rs
- Update canonical_model_example_specs to use new ModelExampleSpec struct fields (instance, optimal_config, optimal_value) instead of the old callback-based API - Fix paper graph access: graph.edges instead of graph.inner.edges - Fix paper optimal access: use optimal_config/optimal_value instead of old optimal array API - Remove count of satisfying solutions (not available in new export) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GiggleLiu
approved these changes
Mar 21, 2026
MinMaxMulticenter has no ILP reduction path, so it needs --solver brute-force. Add it to the solve help text alongside LengthBoundedDisjointPaths and StringToStringCorrection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Adds the MinMaxMulticenter (vertex p-center) problem model as a satisfaction problem. Given a graph with vertex weights and edge lengths, K centers to place, and a distance bound B, determine whether K vertices can be chosen such that the maximum weighted shortest-path distance from any vertex to its nearest center is at most B.
Fixes #330