Fix #330: Add MinMaxMulticenter (p-Center) model#630
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #630 +/- ##
==========================================
+ Coverage 96.92% 96.94% +0.01%
==========================================
Files 271 273 +2
Lines 36298 36572 +274
==========================================
+ Hits 35182 35454 +272
- Misses 1116 1118 +2 ☔ 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()); | ||
| } | ||
| } |
docs/paper/reductions.typ
Outdated
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; |
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