Political Districting

MILP partition · compactness · gerrymandering critique

Partitioning a state's census units into legislative districts seems like a purely geometric problem: equal population, contiguous, compact. It is not. Every line drawn elects a representative, advantages one party over another, concentrates or disperses a racial minority, and carries downstream consequences for a decade. Hess et al. (1965) proposed the first computational formulation; Altman (1997) proved the general problem NP-hard; a generation of MILP and Markov-chain ensemble methods has followed. What no mathematical framework resolves is the ethics of which objective to minimise.

Educational resource. This page describes mathematical models used in legislative redistricting. It is a teaching tool, not legal, political, or policy advice. Redistricting is one of the most politically contested domains in which OR operates; the Limitations & Critique section is not optional reading, and real-world application requires deep engagement with voting-rights law, court precedent, and affected communities.

Problem context

One person one vote — and the line that makes it true

After each decennial census, US states redraw the boundaries of their congressional and state-legislative districts to equalise population per district (the one person, one vote doctrine from Reynolds v. Sims, 1964). The operational question: given n census units (tracts, precincts, blocks) with populations pi, partition them into K districts so that each district has roughly P/K people, every district is geographically contiguous, and each district is “compact” by some measure.

Hess et al. (1965) published the first computational formulation in Operations Research: districts as cells in a weighted “centre of gravity” partition, solved by iteration similar to what we would now call constrained k-means. Garfinkel & Nemhauser (1970) reformulated as set partitioning. Mehrotra, Johnson & Nemhauser (1998) brought modern MILP with column generation. Altman (1997) proved that automated redistricting — satisfying compactness, contiguity, and equal-population simultaneously — is NP-hard, closing the door on polynomial-time “optimal” districting.

More recent work has turned from finding one good map to sampling ensembles: Chen & Rodden (2013), DeFord, Duchin & Solomon (2021), and others use Markov-chain Monte Carlo to generate thousands of plausible compact maps, then compare a proposed map against the ensemble distribution. This has become the de facto technique for courts evaluating partisan gerrymandering claims.

Multi-stakeholder framing

Voters
Live in one district; vote for one representative; affected for ten years.
State legislature
In most US states, draws the maps — with partisan incentive to favour the majority party.
Independent commissions
Used in some states (CA, AZ, MI, CO) to reduce partisan pressure.
Courts
Review for population equality, Voting Rights Act compliance, and (variably) partisan gerrymandering.
Racial / ethnic minorities
Protected under Voting Rights Act §2 and §5 (before Shelby County); majority-minority districts are a key safeguard.
Reform / good-government groups
Push for independent commissions, transparent criteria, and ensemble-based gerrymandering tests.

Mathematical formulation

The set-partitioning MILP, compactness objectives, and their alternatives

SymbolDefinitionDomain
NSet of census units (tracts, precincts)|N| = n
KNumber of districts to formℕ⁺
piPopulation of unit iℕ⁺
PTotal population = Σi piℕ⁺
εAllowed population deviation (e.g., ±1% or ±5%)[0, 1]
xikBinary: 1 if unit i is in district k{0, 1}
dijCentroid distance between units i and jℝ⁺
N(i)Adjacency set of unit i (shared boundary)N(i) ⊆ N
Base districting MILP (moment-of-inertia compactness) min Σk Σi pi · d(i, centroidk)2 xik  // total moment of inertia
s.t. Σk xik = 1   ∀ i  // each unit in exactly one district
     (1 - ε) P/K ≤ Σi pi xik ≤ (1 + ε) P/K   ∀ k  // equal population ±ε
     district k is contiguous in graph (N, edges)  // flow / cut-based contiguity constraints
     xik ∈ {0, 1}

Alternative compactness objectives Polsby-Popper: PPk = 4π · Areak / Perimeterk2 (closer to 1 = more compact)
Reock: Areak / Area(smallest enclosing circle)
Cut-edge: # edges in adjacency graph crossing district boundaries (minimise)

Contiguity is a surprisingly difficult constraint to express as linear inequalities. A common approach uses flow variables on a spanning tree of each district (a single unit is designated “root”; every other unit in the district must send a unit of flow toward root through in-district edges). Alternative formulations use cut-set inequalities and lazy constraint generation. Shirabe (2009) reviews these approaches.

Alternative objectives matter. Minimising moment of inertia often produces different maps than minimising cut-edge count or maximising Polsby-Popper score on the same instance. A state can be simultaneously “compact” by one measure and “non-compact” by another. There is no neutral objective choice.

Partisan-fairness metrics live outside the geometric objectives but are increasingly in view. Stephanopoulos & McGhee (2015)'s efficiency gap measures wasted votes asymmetrically between parties; the mean-median gap compares mean district vote share to median district vote share. Either can be embedded as a soft constraint or as a fairness objective alongside compactness.

Interactive solver

Partition a grid state into K districts; compare compactness measures

Grid Districting Solver

6×6 grid (36 units)
8×8 grid (64 units)
10×10 grid (100 units)
3
Moment of Inertia
Cut-Edge Count
Polsby-Popper
Uniform
Urban cluster
Choose grid size, number of districts, compactness objective, and population distribution, then click Solve. Solver uses seeded Voronoi-like growth with contiguity preservation + local-search swap improvement; teaching-quality only.

About the solver. A grid state is a dramatic simplification: real census tracts have irregular shapes, embedded water / unbuildable areas, and jurisdictional subdivisions (counties, wards) that districts must generally respect. The solver uses a seeded BFS-growth heuristic that maintains contiguity by construction, then improves the chosen objective with swap moves between adjacent districts. Production tools (e.g. GerryChain, Auto-Redistrict) implement ReCom MCMC for ensemble sampling, which is dramatically more sophisticated — see Extensions.

Solution interpretation

What the map tells — and what it hides

Reading the grid

Different compactness objectives produce visibly different maps. Moment of inertia favours round, concentric districts. Cut-edge favours squat blocks that minimise boundary. Polsby-Popper maximises interior-to-perimeter ratio and tends to produce rectangular shapes.

Urban-cluster population distributions expose an efficiency-equity tension. When population concentrates in one region, the population-equality constraint forces districts to reach far into lower-density areas, making them less geometrically compact. This is a real feature of every state with major metro areas.

Compactness does not prevent gerrymandering. It is perfectly possible to draw a partisan-biased map where every district is compact by any metric. “Pack and crack” can be done inside compact shapes by choosing which adjacent urban and rural units to combine. The tools for detecting gerrymandering (partisan-fairness metrics, ensemble comparison) are separate from compactness.

What voters care about: Whose representative are they? Are they grouped with their natural political community? What courts care about: Did the drawing body follow stated neutral criteria and VRA compliance? What reform groups care about: Does the final map differ meaningfully from a neutral ensemble sample?

Limitations & Critique

Why compactness is not neutrality

Compactness does not prevent gerrymandering

A partisan map can satisfy any individual compactness metric while still systematically advantaging one party via targeted pack-and-crack at the unit level. Compactness is necessary but not sufficient for fairness. Ensemble methods, not compactness bounds, are the modern tool.

DeFord, Duchin & Solomon (2021) on the limits of compactness-only districting.

There is no neutral objective

Moment of inertia, Polsby-Popper, Reock, cut-edge, and convex-hull measures all produce different optima on the same instance. Any objective embodies a theory of what “good” districting looks like; the choice is political, not technical.

Young (1988). Measuring the compactness of legislative districts.

Partisan fairness vs. racial fairness can conflict

Voting Rights Act §2 requires majority-minority districts where protected-class voters can elect their preferred candidate. Drawing such districts can reduce overall partisan symmetry and vice versa. The Supreme Court has been inconsistent on how much racial consideration is permitted; this is contested ground, not settled law.

Stephanopoulos & McGhee (2015) on partisan fairness; Alabama Legislative Black Caucus v. Alabama (2015).

NP-hardness means no “optimal” solution is findable

Altman (1997) proved that jointly optimising compactness, contiguity, and population equality is NP-hard. Any tool claiming to find “the optimal” map is either running a heuristic or restricting the problem. Ensemble methods explicitly acknowledge this: sample many, compare to the proposed map statistically.

Altman (1997). NP-hardness of automated redistricting.

Census data carries its own biases

The input populations pi are themselves model outputs. The 2020 US Census had documented differential undercounts for Hispanic, Black, and Native American populations. Districts drawn on undercounted data systematically under-represent those communities, independent of whatever optimisation runs on top.

US Census Bureau (2022). Post-enumeration survey: 2020 Census undercount report.

Court review has been inconsistent

Rucho v. Common Cause (2019) held that federal courts cannot adjudicate partisan-gerrymandering claims. State courts in some states have stepped in (PA, NC) using state-constitutional grounds. The legal framework is unstable; any OR-driven proposal must be framed for whichever forum will actually review it.

Rucho v. Common Cause, 588 US ___ (2019). Supreme Court.

Extensions & variants

Where the field is now

MCMC ensemble sampling (ReCom)

DeFord, Duchin & Solomon (2021). Generate thousands of compact plans via spanning-tree-based recombination; compare proposed map statistically to the ensemble.

Majority-minority VRA constraints

Reserve districts where a protected class has population share sufficient to elect their preferred candidate. Thornburg v. Gingles three-part test.

Partisan-fairness metrics

Efficiency gap (Stephanopoulos-McGhee 2015), mean-median gap, partisan symmetry, declination. Each proxies a different normative notion of fairness.

Column-generation MILP

Mehrotra, Johnson & Nemhauser (1998). Enumerate feasible-district columns; master problem selects a feasible partition.

Cut-edge minimisation

Herschlag et al. (2020). Minimise number of edges in adjacency graph crossing district boundaries — an integer objective with interpretable compactness meaning.

GerryChain / auto-redistrict

Open-source tooling (MGGG, Auto-Redistrict) for academic and advocacy ensemble analysis; used in expert testimony.

Community-of-interest constraints

Keep recognised communities (ethnic neighbourhoods, Tribal lands, school districts) intact. Increasingly encoded in state redistricting statutes.

Multi-objective approaches

ε-constraint or weighted-sum across compactness, VRA compliance, county-preservation, partisan-symmetry. DeFord et al. (2020); Swamy-Jacobson-Magazine (2022) review.

Key references

Cited above · DOIs where available

[1]Hess, S. W., Weaver, J. B., Siegfeldt, H. J., Whelan, J. N., & Zitlau, P. A. (1965).
“Nonpartisan political redistricting by computer.”
Operations Research 13(6), 998–1006. doi:10.1287/opre.13.6.998
[2]Garfinkel, R. S., & Nemhauser, G. L. (1970).
“Optimal political districting by implicit enumeration techniques.”
Management Science 16(8), B495–B508. doi:10.1287/mnsc.16.8.B495
[3]Altman, M. (1997).
“Is automation the answer? The computational complexity of automated redistricting.”
Rutgers Computer & Technology Law Journal 23, 81–142.
[4]Mehrotra, A., Johnson, E. L., & Nemhauser, G. L. (1998).
“An optimization based heuristic for political districting.”
Management Science 44(8), 1100–1114. doi:10.1287/mnsc.44.8.1100
[5]Ricca, F., Scozzari, A., & Simeone, B. (2013).
“Political districting: From classical models to recent approaches.”
Annals of Operations Research 204(1), 271–299. doi:10.1007/s10479-012-1267-2
[6]Young, H. P. (1988).
“Measuring the compactness of legislative districts.”
Legislative Studies Quarterly 13(1), 105–115. doi:10.2307/439947
[7]Shirabe, T. (2009).
“Districting modeling with exact contiguity constraints.”
Environment and Planning B 36(6), 1053–1066. doi:10.1068/b34104
[8]Chen, J., & Rodden, J. (2013).
“Unintentional gerrymandering: Political geography and electoral bias in legislatures.”
Quarterly Journal of Political Science 8(3), 239–269. doi:10.1561/100.00012033
[9]Stephanopoulos, N. O., & McGhee, E. M. (2015).
“Partisan gerrymandering and the efficiency gap.”
University of Chicago Law Review 82, 831–900.
[10]DeFord, D., Duchin, M., & Solomon, J. (2021).
“Recombination: A family of Markov chains for redistricting.”
Harvard Data Science Review 3(1). doi:10.1162/99608f92.eb30390f
[11]Herschlag, G., Ravier, R., & Mattingly, J. C. (2020).
“Quantifying gerrymandering in North Carolina.”
Statistics and Public Policy 7(1), 30–38. doi:10.1080/2330443X.2020.1796400
[12]McCartan, C., & Imai, K. (2023).
“Sequential Monte Carlo for sampling balanced and compact redistricting plans.”
Annals of Applied Statistics 17(4), 3300–3323. doi:10.1214/23-AOAS1763
[13]Rucho v. Common Cause. (2019).
588 U.S. ___ (2019).
Supreme Court of the United States. Partisan gerrymandering held non-justiciable in federal court.
[14]Swamy, R., Jacobson, S. H., & King, D. M. (2022).
“Multiobjective optimization for politically fair districting: A scalable multilevel approach.”
Operations Research 71(2), 536–562. doi:10.1287/opre.2022.2311

Advising a redistricting commission
or reform initiative?

Get in Touch
Data and numerical examples are illustrative. This page is an educational tool, not legal, political, or policy advice.
Public Services