Multi-member ReCom#461
Open
peterrrock2 wants to merge 6 commits into
Open
Conversation
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
Don't worry about the docs failing for now.
Restores ReCom support for plans whose districts elect different fixed numbers of members, rebuilt
on the current GerryChain contracts. Adds a parallel proposal API, a per-member population
constraint, documentation, and reproducible asset generation, leaving the single-member API
untouched. Stacks on
tech-debt/finish-fixing-types.Why
Multi-member ReCom existed in a separate branch before the RustworkX migration but needed migration
following the rewrite.
Each district label carries a positive integer member count, and its population target is
pop_target * members_per_district[label], wherepop_targetis the target for a single member.Changes
multi_member_recom,build_multi_member_recom_proposal_fn, and the non-instantiableMultiMemberReComnamespace (four non-reversible variants) ingerrychain/proposals/multi_member_tree_proposals.py, exported fromgerrychain.proposals.epsilon_tree_bipartition_multi_member, a proposal-level wrapper that computes the feasiblepopulation interval for the two merged labels, converts it to the scalar symmetric form
bipartition_treealready accepts, and calls it withsingle_district_cut=True. An emptyinterval raises
PopulationBalanceErrorimmediately rather than retrying trees or reselectingpairs, since a different tree cannot make the numeric interval feasible.
within_percent_of_ideal_population_per_member, which bounds each district's population permember around the plan-wide ideal (
total population / total members).docs/user/recom.ipynbusing the per-member constraint.make docs-recom-assetstarget and extendeddocs/generate_recom_assets.pyto regenerateevery static Gerrymandria plan image reproducibly; the regenerated assets are included.
Testing
tests/test_proposals.pycovers exact and epsilon-tolerant splits, per-label bounds preservedacross a seeded chain, mixed-type labels, seeded-trajectory reproducibility, all four namespace
variants matching direct calls, region-surcharge plumbing, pair reselection, infeasible-interval
PopulationBalanceError, and the full validation matrix.tests/constraints/test_validity.pyandtests/typing_assertions.pycover the constraint and its typing contract. Verified withmake test,make lint,make type-check, andmake docs.Reviewer Notes
partition's labels exactly, and every count must be a positive integer (booleans rejected).
_PopulatedGraph, the cut finders, or the tree protocols.Unequal-target support is confined to the new proposal-level wrapper.
constraint is not appropriate, pair selection is not seat-weighted, and there is no reversible
variant (reversible multi-member ReCom needs a separate mathematical design).
single-member districts for now.