1 Modelling Voter Distributions on Lattices
A manner of generating large sets of quasi-random population and voter distributions can provide a flexible tool for studying the general features of population subdivisions and gerrymandering. Abstracting away from purely data-driven studies of voter distributions can allow both more general analyses and more specialized studies depending on how one implements the model. In this section we outline an elegant manner of constructing models of a voter distribution. Specifically, we propose to study a population distribution which is modelled on a binomial distribution (generated by a walker algorithm), which approximates well a discretized Gaussian distribution with random fluctuations. Such a quasi-Gaussian distribution is a good model for a city or town in the absence of natural boundaries (which breaks the spherical symmetry). We then superimpose a spread of partisan bias on this population. Whilst the notion of modelling voters via lattice distributions has been previously explored in applications of statistical physics to sociopolitical research e.g.[Chou & Li, 2006; Wall, 2008; Castellano et al., 2009], to our knowledge there are no previous studies which apply lattice techniques to assess the viability of specific gerrymandering strategies for a given voter distribution.
1.1 Lattice Models of Population Distributions
In this sections we shall define the key concepts that will be used throughout the paper, which concern modelling geographical regions with a population of voters, which we refer to as territories. In most representative democracies, it is common to split territories into small indivisible cells called territorial units (such as census units), with each unit containing a potion of voters. In this work we model territories as lattices:
A territory is a square lattice in , where each lattice site defines a territorial unit carrying a population value and a voter preference . The total population of the territory is defined as .
We shall call a population distribution on a territory a set of fixed values for all and call a “voter” (or “partisan”) distribution a set of fixed values for all . We call equipped with a population distribution a “population model” and equipped with both a population and voter distribution will be referred to as a “voter model”.
Given a territory , a district is a finite union of territorial units, i.e., for an index set . The district population is defined as and district voter preference is .
In contrast to arbitrary graphs, lattice territories can be efficiently manipulated and are ideal for our analysis, since the distributions input to our algorithms and the districts output can all be represented as square matrices. Furthermore, the lattice structure provides intuitive notions of adjacency and connectedness between the territorial units:
Territorial units at and are said to be adjacent if and , xor (exclusive or) and .
A territorial unit is reachable from if there exists a sequence of adjacent territorial units beginning at and ending at .
Given the above definitions of adjacent units and reachable units, we can express a simple notation of district connectedness:
A district is connected if any is reachable for every .
Since we are interested in cases where the territory is partitioned into a set of equal population districts, we introduce the following definition:
A valid districting is a set of disjoint districts for such that and for fixed one has for .
The quantity denotes the total number of districts in . We call the population threshold, which allows for small variations in population between districts, whilst requiring approximately equal district populations. Throughout this work we will take , such that differences between districts are percent-level.
Since it is of interest to consider population distributions which well model real world situations, here we shall focus on a quasi-Gaussian distribution of population much as would be appropriate in a large city in which the population is highly dense towards the centre and becomes diffuse at large radial distances. To approximate a Gaussian population spread with random fluctuations, we implement a walker function (see e.g. Shiffman ) on a lattice with with the central lattice site designated . The walker function is essentially a simple agent-based model (see e.g. Macal & North ) which undergoes time step evolution. In this case an agent is an object associated to a single lattice site at a given time step and the walker function is a set of probabilistic rules which determine how the spatial location of agents evolve between time steps. The agent represents an individual of the population and thus the probabilistic evolution of agents leads to random fluctuations in the population distribution. We will exploit these random fluctuations in the population distribution to implement Monte Carlo methods later in this work.
For a given territory one can construct a population model with total population via the walker function, as detailed below. We take a lattice and consider agents with the following starting distribution (at time step )
Thus, each integer unit of population is associated to an agent on the lattice and, prior to evolution via the walker function, the whole population of the territory is located at the central lattice site.
During each time step an agent can move with fixed probability to any lattice site adjacent to its current location with equal probability, with the restriction that agents remain within the
lattice. Each agent is allocated a fixed number of moves, and move counts across all agents follow a normal distribution centred at the minimum number of moves needed to reachfrom . Once an agent has taken its prescribed number of moves, it remains in its terminal unit.
After all agents have taken their prescribed moves the walker function outputs the number of agents at each lattice site and this is identified with the population of the territorial unit . The walker function provides a value for for each and thus defines a population model (but not a voter model, since the remain undetermined at this stage). The population spread due to this algorithm well approximates a two-dimensional Gaussian distribution; an example is shown in Figure 2.
1.2 Modelling Elections on the Lattice
With a working lattice model of population distributions we next introduce a flexible manner of introducing a voting distribution within the population which shall lead to the premise of voting and electoral events.
The proponent (opponent) is the party which benefits (loses) from gerrymandering. A territorial unit is a proponent unit if , an opponent unit if , or neutral if .
Without loss of generality, we let the proponent party corresponds to positive extremity, i.e. , and designate this the “red” party. The opponent party we designate the “blue” party. We assume all voters cast ballots, so corresponds to the average vote in territorial unit favouring the proponent. We also assume that the gerrymander knows the values with certainty, although this could be relaxed.
The net territory vote (or popular vote) of a territory is the sum . A territory is said to be balanced if . For a district in , the district vote is .
We say that the red party wins the popular vote in if ; conversely, blue wins (red loses) the popular vote if . However, rather than the popular vote of the whole territory, what is typically most important is the district-wise overall vote. Similar to the popular vote, for districts, we say that red wins the district vote of district for if and we say blue wins (red loses) the district vote if .
The distinction between the district vote and the popular vote implies that a given party can lose the latter, while securing the most districts. Typically the most important outcome is the number of districts won by each party. Thus, gerrymandering fundamentally exploits the differences between the local and global properties of distributions. Realistic numbers of districts in a given territory range from 2 to ; for example Hawaii has only 2 congressional districts, while California has 53. In our later example and statistical studies we will typically take .
Since elections are dynamic and inherently uncertain, the gerrymanderer risks losing if the plan is to win a district by only a single vote. Introducing a vote threshold ensures that the gerrymanderer’s party wins a given district with a minimum margin.***One could define district-by-district, such that the requirement is weaker or stronger depending on the district. We call a district “safe” for red if , for a fixed prescribed which is called the vote threshold (conversely, is safe for blue). We typically take , for districts, such that safe districts favour the proponent with a margin of at least 1%.
1.3 Modelling Voter Preference Distribution
In what follows we shall introduce a novel procedure for generating smooth distributions of voter preferences. We implement voter preference in terms of a number of specified points of peak partisan bias, ‘sources’, with voter preference falling towards neutrality away from these peaks. Using an analogy to the theory of electrostatic potentials and inverse power laws, we define sources of partisan bias via the properties of point charges, as follows.
Given a territory , a source point is a pair characterized by its location and the magnitude of the source. We require that any set of source points gives .
To match with our previous (arbitrary) assignment that corresponds to the red party, we call a red source when and a blue source when . Source points can be located at arbitrary lattice sites, and the voter preference at a given territorial unit is a function of the distance from these source points, following a power law:
The vote contribution from a source by to the net vote of territorial unit , where and are separated by distance is
where the distance function (the metric) is taken to be
Given source points for , whose positions are chosen independently, we denote their contribution to as and
From the above definition the vote contribution from a given source falls linearly with distance from the source.†††In principle one could study other power laws or consider sources each with different dependencies. Because of the power law, the source points typically represent local maxima of the voter preference, with sign indicating the favoured party. In this model, a balanced territory requires at least one blue and one red source, so we are generally interested in scenarios with two or more sources.
Additionally, we note that in principle two source points could be located at the same lattice site,
in this case the two sources can always be replaced with a single source:
1.4 Benchmark Models
To summarize, given a territory we use the walker function of Section 1.1 to fix the values of and by designating a set of source points and referring to eq. (4) we fix values of , thus defining a voter model. As an example, we assign lattice sites immediately left and right of the origin to serve as blue and red source points with
The combination of the two dimensional quasi-Gaussian population distribution (as in Figure 2) and the sources produces the voter distribution shown in Figure 3. The colour intensity indicates the magnitude of the net voter preference and the centre of these coloured regions corresponds to the positions of the two source points.
In subsequent examples and statistical analyses presented throughout the remainder of this work we shall consider a number of specific benchmark voter models with a quasi-Gaussian population distribution and particular source point distributions, as given in Table 1 below:
2 The Friedman-Holden Packing Strategy
There are two fundamental strategies in algorithmic gerrymandering: packing and cracking. First, a gerrymanderer can dilute the voting power of the opponent party either by packing the most concentrated opponent-voting subpopulations into a small number of districts. Second, one can crack the most concentrated opponent population into several districts so that the most concentrated or extreme voting base for the opponent party never gains a majority. A strategic application of voter packing underlies the approach of Friedman & Holden .
As an the example consider a gerrymanderer that favours the red party and whose goal is that in the maximum number of districts for in a given territory. Friedman & Holden  considered a pseudo-normal voter extremity distribution and generated districts by simply partitioning the bell curve of the population by extremity. The first district is formed by joining the most extreme subpopulations, i.e., the bell curve tails, so that i) their combined population is approximately the average district population, and ii) the right tail is sufficiently larger than the left tail. The latter condition signifies that the extreme right-party voters are sufficient to override the extreme left-party vote in their district.
The above process will, in essence, “waste” the opponent’s strongest voting population in a district it cannot likely win. This process is repeated on the subsequent districts and the final district is composed of the remaining population. Thus, by construction, the later districts are comprised of mostly moderate voters and, for balanced territories, are typically won by the opponent party. This approach has a number of merits but suffers from the lack of spatial considerations. The Friedman-Holden method equates to unrestricted “cherry picking”: the gerrymanderer has the freedom to select scattered population chunks for placement in the same category, as we demonstrate shortly. Notably, if even a single district is disconnected, the districting plan is typically legally prohibited.
A useful measure of failure, is the number of connected components of each district:
A connected component of a district is a (non-empty) set of territorial units in such that given a territorial unit , another territorial unit also lies in if and only if is reachable from .
A district can be decomposed into its set of connected components and we shall write , where is the number of connected components. If any territorial unit in is reachable from all other territorial units in , then and we say that is connected. The number of connected components is important for the analysis of the spatial distributions arising through the algorithms studied.
2.1 Implementing Friedman and Holden’s Algorithm on Lattice Territories
Friedman & Holden  outline a packing strategy which ignores the spatial data of the voter distribution. In order to demonstrate how this strategy leads to highly disconnected districts we shall reformulate the strategy of Friedman & Holden  for generating districts in terms of an algorithmic approach applied to a lattice voter model and we will refer to this algorithm as “FH Packing”. Then by neglecting spatial data during the redistricting process, but tracking the positions of the territorial units allocated to each district, we can assess the connectivity of the districts constructed via FH packing.
First, since voting districts are legally required to have comparable populations, we define a target population to ensure that all districts have approximately equal populations. The target population is implemented using the population threshold (from Definition 6), the total population , and the number of districts , as follows
The value of is computed before the algorithm is executed and each district should satisfy the following population condition
Also, the majority of district should satisfy the district win condition
Later districts, in particular the final district, must have an opponent bias if the territory is balanced. Only when the algorithm is satisfied with the composition of a given district will it proceeds to form the next district, until all districts are formed.
To implement FH packing strategy on a lattice territory our algorithm iteratively assigns single territorial units to a district, one district at a time, such that the end result favours the proponent. We call a territorial unit unassigned unit if it has not yet been assigned to a district and denote the set of unassigned units . As territorial units are assigned to districts by the algorithm, they are deleted from . For a territory on a lattice there are initially unassigned territorial units in and (empty) districts for . We implement the FH packing strategy by first sorting the territorial units in order of decreasing net vote , using a quicksort method [Hoare, 1961], and relabelling the elements of this ordered set , such that corresponds to the strongest unit vote for the opponent party and is the strongest unit vote for the proponent. More precisely, the strongest unassigned opponent unit is if for all , or equivalently it is if for all other one has . Conversely, for the largest index in is the strongest unassigned proponent unit.
Implementing a discretised version of the strategy outlined in Friedman & Holden , our algorithm forms each district by iteratively adding the strongest the unassigned proponent unit followed by the strongest unassigned opponent units, until . The algorithm then calculates the district vote and compares it to the vote threshold . If and then the district is complete and the algorithm repeats this process to create the remaining districts, with the exception of the last district.
It may be that in forming a given district, whilst the district satisfies the district vote is calculated to be less than the vote threshold. In this case the algorithm adds the strongest remaining unassigned proponent units until , and at each step checks that . Once the district vote is sufficiently large, the district is complete. When the population limit is exceeded, , our algorithm will remove the last unit added and try the next in the ordered list until it identifies an addition to the district that does not violate the population limit. For large vote thresholds or small population thresholds , this districting algorithm may fail (i.e. no district satisfies simultaneously eq. (9) and (10)), but this is rarely a problem for percent-level and .
Finally, the last district is identified with the remaining unassigned territories after the first () districts are constructed. If the territory is balanced, as we assume, then it is impossible for all districts to favour the proponent, and thus it is expected that for the final district . Moreover, by design, the final district is primarily comprised of moderate voters. The only requirement on the final district is that it satisfies and this will commonly be the case for reasonable choices of . For a smaller population threshold, and thus a more stringent requirement of population uniformity, the final district may fail the population constraint. In this case, after constructing the final district the algorithm will make a number of amendments to the district compositions such that the populations are within the threshold. In the case that , the proponent-favouring territorial units on the exterior of the final district are transferred to adjacent districts. If , then the opponent-favouring territorial units in other districts and adjacent to the final district will be transferred to the final district.
Example executions are shown in Figure 5 and a flow chart illustrating the steps of this algorithm is presented in Figure 6. Specifically, we show the output of our implementation of the algorithm of Friedman & Holden , as described above, partitioning a lattice territory into 5 districts for benchmark models #1 and #4 (defined in Table 1). The intensity of the colour indicates the partisan extremity of a given territorial unit and the black lines indicate divides between districts. The left most panel illustrates the whole territories, whilst the panels to the right show, in order, the composition of Districts 1 to 5 in order of construction. Observe that the district compositions output by this algorithm are all typically disconnected, and this shall be quantified through Monte Carlo studies shortly.
2.2 Impact of Friedman and Holden Packing Method
Before examining whether the districts constructed emulating the Friedman and Holden method are connected we shall first look to quantify what degree of advantage this gerrymandering procedure gives to the proponent by comparing to a non-partisan model of districting. To assess the impact of gerrymandering we construct a voter model on a lattice territory where the population distribution is quasi-Gaussian as in Section 1.2, the source points follow the benchmarks of Table 1, and the total population‡‡‡The typical population of U.S. congressional districts is 700,000; our results can be rescaled accordingly if desired. is fixed to be (up to fluctuations). Since the walker function introduces random fluctuation in the approximately Gaussian population distribution, each run returns a different redistricting. Thus we can assess the impact of gerrymandering for a given set of source points via a Monte Carlo approach using multiple runs of the algorithm.
Specifically, we generate a set of distinct redistricting plans on 30 different lattice population models with balanced votes for each of the four benchmark source point placements (as shown in Figures 3 & 4), and partition the territory into five districts (i.e. take ). For each district , for , we calculate the average district vote and population , and the average number of district wins for the proponent . In Table 2 we show the average net vote in each district (where the districts are enumerated by order of construction) following redistricting via FH packing and averaging over 30 runs:
It is insightful to compare these results to some “fair” partitions of the population. Since the population approximates a two dimensional Gaussian distribution, any spherically symmetric partition of the population which does not take into account the voter distribution can be considered a non-partisan districting. We shall construct a non-partisan districting by allocating the central cells to District 1 and then symmetrically partitioning the set of territorial units not assigned to District 1 to create Districts 2-5.
We choose to partition Districts 2-5 by simply drawing the district lines along the horizontal and vertical mid axes, and assigning the territorial units on the borders to the adjacent district in the clockwise direction. The size of District 1 is fixed such that the 5 territories have approximately equal populations, thus it is determined by the Gaussian spread and population threshold . The resulting districts are illustrated in Figure 7.
To assess the impact of gerrymandering we compare predicted results for the case of aggressively gerrymandered districts (as determined by our algorithmic implementation of the FH packing strategy) to the vote for the symmetric districts outlined above for balanced territories. Generating 30 population distributions on , we calculate both the average net vote per district , and the average number of district wins for the proponent , as shown in Table 3.
Through the comparison of Tables 2 & 3 it is clear that FH packing significantly impacts the electoral outcome, skewing the predicted number of district wins in favour of the proponent party. However, as we show next, the districts constructed via FH packing are generically disconnected and therefore typically legally prohibited.
2.3 Connectivity of Friedman and Holden Districts
Since the Friedman-Holden method includes no spatial data, one might expect disconnected districts. In what follows we shall quantify the failure of the FH packing method to produce connected (and thus legal) districts. To this end we shall take the districts constructed in Table 2, output the assignments of the territorial units, and identifying the number of connected components in each district.
To show that the districts constructed via FH packing are highly disconnected we take the outputs of the 30 runs of FH packing on generated previously and calculate the mean number of connected components for each district (labelled D1 to D5) and the mean over all districts for the 4 benchmark source point models. The results are displayed in Table 4 and Figure 5 shows one (of the 30) district composition output by the algorithm for each benchmark model, where one can see that the districts are highly disconnected.
Under the above settings we find the strategy of Friedman & Holden  typically outputs districts with components. Importantly, disconnected districts are legally prohibited. Thus, while the Friedman-Holden method is simple and easy to implement, it is too simplistic to give a realistic model of redistricting and makes it clear that it is critical that algorithmic approaches take into account the spatial distribution of voters. We note also that Puppe & Tasnadi  have given complementary arguments against ignoring spatial data whilst gerrymandering from an axiomatic perspective.
3 Packing with Spatial Restriction
We dedicate this section to introducing two novel algorithms that gerrymander voter distributions on a lattice in a manner that strongly favours the proponent and gives mostly connected districts: “Spatially Restricted Friedman-Holden” (SRFH) Packing and “Saturation” Packing. In SRFH packing the gerrymander aims to guarantee wins in the majority of districts, but lose the later constructed (moderate) districts, whereas the saturation strategy relies on constructing districts to be discarded with significant opponent biases. In Section 4 we introduce one further new strategy based on genetic algorithms. Python codes for each of our algorithms are provided online.
3.1 Spatially Restricted Friedman-Holden Packing
We shall introduce here the Spatially Restricted Friedman-Holden (SRFH) Packing algorithm, which is a modification to the FH packing approach that allows the inclusion of spatial data. The SRFH districting algorithm forms each district by first including the strongest opponent and proponent unassigned units, as well as a path of territorial units between them (which necessarily includes moderate voters). The algorithm then successively adds highly polarized units of both parties which are adjacent to the forming district, until it satisfies the population requirement and the net vote favours the proponent party, i.e. until the district satisfies eq. (9) and eq. (10).
We first discuss the general construction of districts, with the exception of the final district. Suppose there are unassigned territorial units, then similar to the FH algorithm the first step is to sort, via quicksort, the unassigned units in order of decreasing net vote and relabel the ordered set . To form a new district the algorithm includes the unassigned units and in the district and the shortest path between them that avoids all already assigned territorial units, as illustrated in Figure 8. We use a standard Grassfire algorithm Bium  to remove assigned units when determining the shortest path. If a given path between and exceeds the target population , then the next shortest path can be selected instead, however this is typically not an issue.
While the algorithm will repeatedly add to the district the most extreme territorial unit that is unassigned and adjacent to it. If the net vote of the district does not sufficiently favour the proponent party, as determined by a vote threshold parameter , then the algorithm will successively add proponent units to the district. Once the net vote favours the proponent, the algorithm adds opponent units to balance the vote. After adding each unit to a given district, the algorithm calculates the current district population and fixes the district when . It then checks that , if this check fails, the most recent territorial unit added is replaced with an alternative adjacent unit, until the above is satisfied. After a connected set is validated as a district, the algorithm recurs on the remaining sorted list of territorial units to create another district. The algorithm will typically produce districts in order of decreasing , with the proponent vote being stronger than the opponent vote. The remaining unassigned units after the construction of districts are assigned to the final district, and thus the last district is typically disconnected. Figure 10 provides a flow chart illustrating the steps of this algorithm. We will quantify the typically number of connected components in Section 3.3.
3.2 A Saturation Packing Algorithm
In what follows we shall introduce an alternative packing algorithm, we call the Saturation Packing algorithm, which implements the classic strategy of simply packing extreme opponent voters into a single compact district. The Saturation Packing algorithm builds on the establish algorithmic framework of the SRFH Packing method, however prior to constructing any districts, each territorial unit is assigned a priority value based on its net vote and its average distance from proponent source points.
For a territory with proponent source points , we define the priority of a territorial unit to be
Once all priorities are assigned, the list of territorial units is sorted in order of decreasing priority and the territorial unit with the greatest negative priority at the beginning of the sorted list is added to the collection , that will eventually form the first district. Then, the algorithm searches over all territorial units adjacent to and adds the next highest negative priority unit to . This last process is repeated until . After District 1 is constructed via the Saturation Packing algorithm, all subsequent districts are created using the SRFH Packing algorithm outlined in the previous section. A flow chat for this algorithm can be seen in Figure 12.
3.3 Example Executions of Saturation Packing and Friedman-Holden Packing
In Section 5 we will use the two algorithms developed in this section to undertake Monte Carlo studies of aspects of gerrymandering. First, however, it is insightful to consider a number of individual examples, and in particular to view the typical districts which each algorithm produces for a given voter distribution, analogous to Figure 5. Figures 9 and 11 present example outputs of, respectively, the SRFH Packing and Saturation Packing strategies in which we partition a lattice into five districts for the benchmark voter models #1 and #4 of Table 1.
Observe that, by design, with the exception of District 5 the districts created are connected, which is a notable improvement on the original strategy of Friedman & Holden  which typically produced an average of component for each district. Following similar methodology to Table 4 with 30 trails, in Table 5 we quantify the number of connected component in the final district (“D5 #”) for the Saturation Packing and SRFH-Packing, as well as stating the average number of connected components for all districts (“average”) to allow comparison with Table 4.
|Model||SRFH: D5 #||SRFH: average||Saturation: D5 #||Saturation: average|
As shown in Section 2.3 using the basic FH Packing method, which does not account for the spatial distribution of voters, the average number of connected components is components (cf. Table 4), whereas for our algorithms with spatial restrictions the average is . With so few components one can potentially achieve connectivity in post-processing with a small number of swaps. Moreover, in a real world environment one could also possibly exploit geographical features or utilize the empty area external to territory to arrange for the final district to be connected. Studies on the effectiveness of these different districting strategies shall be presented in Section 5.
4 Genetic Gerrymandering Algorithm
In Section 3 we advanced on the basic strategy of Friedman & Holden  by including spatial restrictions through what we called the Saturation and SRFH packing algorithms. However, those methods both rely on assigning territorial units to districts in manner that satisfies local requirements without reference to the global assignments and thus typically the final districts are disconnected. Whilst one can potentially ‘fix’ the final district following the completion of the algorithm, this is somewhat unsatisfactory. In order to resolve this issue that the final district remains disconnected, we introduce here a new class of gerrymandering algorithm which we call Genetic Gerrymandering (GG), based on the general ideas of genetic algorithm approaches. Rather than constructing districts by selecting particular territorial units, this genetic algorithm takes a starting configuration of districts and evolves it over a number of iterations towards some goal. From some arbitrary initial ‘seed’ set of districts the algorithm generates a number of mildly altered variants (mutations), it then calculates a fitness index for each of the sets of districts and retains the district sets with the highest index values, before repeating the process. After several iterations the system converges on a particular outcome.
One distinct benefit of this procedure is that since the initial seed is a set of connected districts, provided that connectivity is respected in subsequent mutations, then the final set of gerrymandered districts will also be connected. To our knowledge genetic algorithms have not been applied to the question of how to optimally gerrymander a territory to provide highly partisan outcomes. There has, however, been a good deal of work on implementing fair districting using genetic algorithms, e.g. [Forman & Yue, 2003; Bacao et al., 2005; Chou et al., 2007; Altman & McDonald, 2011; Vanneschi et al., 2017].
4.1 The Gerrymandering Index
In order to gerrymander the districts, one needs to construct a fitness index which favours the proponent party. Although there is no unique way to construct this index, any good fitness index for gerrymandering should take into account the number of districts which are winnable for the gerrymanders’ party and the population spread. The latter is taken into consideration to ensure that the districts have approximately equal populations, in order to make the districts legally valid. The fitness function we construct depends on these two qualities and it allows the algorithm to skew the populations if it provides an advantage to the proponent party.
Let be the number of districts which are winnable by the proponent, given by the number of districts with , plus half the contended districts (those with )
where is the Heaviside function. We also define the following population measure
The quantity and the measure characterize the salient properties of a given district plan for the purposes of gerrymandering, and using these we define the following gerrymandering fitness index, given by the ratio of districts won minus the population spread:
The index takes values in the interval , with the most desirable outcome for the gerrymanderer occurring for those sets of districts with the highest fitness index.
This index we consider is fairly simple, defined by just two parameters, and one could certainly construct more elaborate indexes, but this simple form is sufficient to explore the prospects of gerrymandering a given territory. However, identifying highly effective indexes for gerrymandering would be an interesting question for future work.
4.2 Random Seed
Having quantified which sets of districts are preferred through the gerrymandering index , the other components of the genetic algorithm are the definition of a set of seed districts for the genetic gerrymandering algorithm, being a random starting configurations of districts, and the mutation procedure which generates the iterations.
Our starting point for the genetic gerrymandering algorithm is an arbitrary partition of the territory into connected districts which is referred to as the seed. We construct this random seed as follows: for a partition of the territories into districts we randomly select territorial units, label these for , and perform a flood fill [Smith, 1979; Glassner, 2013] around these units. Via the flood fill algorithm each of the territorial units is assigned to the nearest unit in , calculated using the distance function defined in eq. (3). The districts in the seed are defined as follows
One should note that via this definition of equidistant points would not be assigned to a district. This is a minor technicality and in the algorithmic definition these unassigned units are simply assigned to the set carrying the lowest numerical label .
The flood-fill random districting guarantees connected districts that are typically convex and compact. Although this method does not enforce population equality, the random districtings start out highly equitable from a geometric standpoint, and the district populations tend to balance out as they evolve due to the definition of the index .
4.3 Mutation Procedure
The final component of the genetic gerrymandering algorithm is to randomly alter the districts, identify the mutated district which maximizes , and iterate this procedure. Our mutation procedure swaps certain units between adjacent districts on each iteration in a manner that preserves connectedness of each district and favours balanced populations.
For a territorial unit in district , a district (for ) is said to be an adjacent district to if there exists a which is an adjacent unit to .
To describe a territorial units propensity to switch to a different adjacent district during the mutation procedure we define the following
The instability of a territorial unit in district is zero if is not connected. Otherwise, over all districts adjacent to .
From the above definition, if a given territorial unit lies in the same district as each of its adjacent territorial unit, then and occurs only for territorial units on a border between districts. To implement the mutation process, we first determine the instability for each and we define over all .
For all with , a mutation on is performed with probability , removing from its old district and adding to the lowest-population district adjacent to . This transfer of territorial units will always make the district populations more balanced and thus the voting districts become significantly more equitable rather quickly (in just a few generations).
In summary, a set of seed districts forms generation 1 and our algorithm then performs the following iterative procedure for generation : it identifies the cases (rounding appropriately) with the highest indices and to these cases it applies the mutation procedure times. Because of the probabilistic nature of the mutations this produces different offspring, which comprise generation . With each iteration the set of districts evolve towards a local maximum of . After a preset set number of iterations the algorithm outputs the set of districts with the best index from the final generation. Typically, after iterations the algorithm converges to sets with . We provide a flow chart illustration of this algorithm in Figure 14.
4.4 Sample Executions of Genetic Gerrymandering
For our example run we construct random seed districtings for the first generation and the algorithm selects the 10 with highest index to mutate. At each stage the algorithm runs the mutation method times on each parent, producing offspring. This evolution is iterated over 30 generations, and the final districting output is the set in the last generation with the highest index. In Figure 13 we present a sample executions of the genetic gerrymandering algorithm applied to the benchmark models #1 and #4 of Table 1, in analogy to Figures 5, 9 & 11.
4.5 Modified GG for Fair Redistricting
Before closing this section we highlight that the genetic gerrymandering algorithm developed above can be adapted to construct fair districtings simply by changing the fitness index. As mentioned above, the use of genetic algorithms to fair districting has been previously studied in the literature, for instance [Forman & Yue, 2003; Bacao et al., 2005; Chou et al., 2007; Altman & McDonald, 2011; Vanneschi et al., 2017]
and, indeed, many of the existing algorithms for fair districting are far more sophisticated than the one we discuss below. However, the genetic heuristic and mutation procedure developed in our genetic gerrymandering algorithm is distinct and original, and it is interesting that, at least in our simplified lattice models, fair districts can be readily constructed from the simple and intuitive criteria we stipulate below.
While fairness is a subjective concept, one can construct a reasonable fitness index via a heuristic formula that takes into account:
The district population balance;
Accuracy of state representation in Congress;
Representation accuracy in each district.
We quantify these three characteristics, respectively, via fitness functions , , :
where and are defined in eq. (12) & (13), and we denote by a measure of the proportion of the population in a given district (for an index set ) whose vote preference aligns with the net district vote , defined by:
Note also that whereas measured the population spread, here characterises the population balance.
Using the partial fitness functions, we define the overall “fair” fitness to be
whose values lie in the interval . Districts that are deemed “fairest” should have the highest fitness index. Typically for our trails we have found that the final set of fair districts tends to have fitness index values in excess of .
We will refer to the Genetic Gerrymandering (GG) algorithm equipped with the index (rather than ) as the “Modified-GG for Fair Redistricting”. Following the same methodology of Section 4.4 we execute an example run using seed configurations and taking 30 iterations. The results of this example run are shown in Figure 15 for seven districts. In particular, by design, the equitable district configurations produced by the Modified GG for Fair Redistricting support a vote split for balanced territories, accurately representing voter preference across the whole territory. Moreover, a majority of the districts avoid including oppositely polarized voters, ensuring that each elected district representative reflects the values of their constituents.
Through the algorithms developed here we shall quantify some general statements about gerrymandering. To this purpose, we consider the subdivision of a lattice into districts, with population and voter distributions as in Table 1. The population and vote thresholds are fixed to be and in all cases.
Due to the inherent randomness built into the population distribution we can use the districts output by the redistricting algorithms with spatial restrictions, developed in Section 3 & 4, to study aspects of gerrymandering via a Monte Carlo approach. Specifically, we generate a large sets of gerrymandered territory for the case of five districts and undertake a statistical analysis to quantify the advantage which gerrymandering brings to the proponent party and other characteristics of gerrymandered territories.
Whilst Monte Carlo methods have been previously employed for detection of gerrymandering, for instance [Herschlag, 2018; Herschlag et al., 2017], and also towards constructing fair districts, e.g. [Fifield et al., 2015], to our knowledge this is the first study to apply a Monte Carlo approach to look to quantify general features of gerrymandering.
5.1 Quantitative Impact of Different Gerrymandering Strategies.
The primary aim of the gerrymanderer is to maximize the predicted number of districts won during an election. The secondary aims are to construct proponent districts with and to arrange for opponent districts with , such that the districts constructed are secure from potential swings in the voting preferences against them, and can capitalize on swings in their favour to pick up additional districts.
To assess the impact of gerrymandering we compare predicted election results for each of the gerrymandering algorithms developed above to the non-partisan symmetric districting model outlined in Section 2.2 and illustrated in Figure 7. The predicted election results of the symmetric districting model are given in Table 3. Taking first the SRFH Packing algorithm, and following a similar methodology to Section 2.2, we generate 30 population distributions on and calculate the average net vote per district and the average number of district wins for the proponent ():
SRFH-packing is most effective when oppositely extreme voters are situated in close proximity to one another. This approach handles the voter distribution of model #4 notably less well (as can be seen from the fact that ) and although favouring the proponent party, the opponent takes the majority of districts in 30% of trials.
In the case of gerrymandering via Saturation packing we find that, although blunt, it can be extremely effective in securing districts for territories with a balanced vote:
Finally, we consider applications of the Genetic Gerrymandering algorithm, after each run we label the districts in order of net vote (prior to calculating the district averages):
Since in each case above, the territorial vote is close to balanced, , in a fair election the expected average number of proponent districts wins is . This is seen to be the case in Table 3 for symmetric districting with symmetric sources. However, as anticipated, for the gerrymandered districts generated by our algorithms one observes clear skews in favour of the proponent. Specifically, SFRH Packing (Table 6) leads to the proponent always winning 60% of districts and Saturation Packing (Table 7) results in an impressive 80% of district wins for the proponent . Genetic Gerrymandering (Table 8) is less effective but still can provide a proponent advantage for voter models with only two source points.
5.2 Compactness Tests
One of the most identifiable traits of gerrymandering is that it typically leads to highly non-convex or non-compact districts. Motivated by this common trait, researchers [Roeck, 1961; Schwartzberg, 1966; Oxtoby, 1977; Young, 1988; Niemi et al., 1990; Polsby & Popper, 1991; Chambers & Miller, 2010; Hodge et al., 2010] have proposed geometric measures that can potentially be used to identify gerrymandering. It should be noted that simple geometric tests, while intuitive, do have certain drawbacks. For instance, they often do not account for variations in district boundaries due to natural or legal borders (e.g. coastlines or national borders) and do not incorporate information on population distributions or demographics. Regardless, it is interesting to calculate these geometric measures for the gerrymandered districts arising in our work, in order to ascertain which index values likely indicate aggressive gerrymandering.
We shall examine the most intuitive dimensionless gerrymandering measure: the isoperimetric quotient index [Polsby & Popper, 1991], defined as
for a district of area and perimeter . The index is normalized to the circle, and deviations of a district from a circle give . In Table 9 we give the average for each district produced via Genetic Gerrymandering (labelling districts in ascending after each run) as well as the mean for all districts averaged over 30 runs.
In order to demonstrate that the districts generated by the Genetic Gerrymandering algorithm could potentially be detected and constrained by isometric quotient tests, we compare the values of Table 9 to the isometric quotients calculated for the idealized non-partisan symmetric districts of Section 2.2, these are given in Table 10.
|#1 - #4||0.40||0.71||0.71||0.71||0.71||0.65|
Since the idealized non-partisan symmetric districts follow simple geometric construction rules, without reference to the voter distribution, the same value is found for models #1 - #4 (up to negligible fluctuations in the population distribution).
From the above analysis we find that our gerrymandering method always leads to an average which is much lower (around ) than the symmetric ‘fair’ districts. Moreover, some of the gerrymandered districts have very low values, for instance the average value for District 3 of model 1 was , which is less than half the isoperimetric quotient of the typical symmetric district with . We conclude that gerrymandered districts constructed via our Genetic Gerrymandering algorithm typically lead to highly non-compact districts for realistic distributions of voters.
The implications of our results are that if redistricting were restricted by compactness constraints, then the extent to which one can impact an election would be significantly curtailed, and many aggressive gerrymandering methods (in particular our own) would likely prove to be ineffective. Thus this provides further support for the need for democratic governments to place some form of compactness requirement on redistricting schemes, and complements similar arguments and findings presented in e.g. [Schwartzberg, 1966; Polsby & Popper, 1991; Altman, 1998; Hodge et al., 2010; Humphreys, 2011; Chou et al., 2014; Bowen, 2014; Chen & Rodden, 2015]
6 Summary and Conclusions
The assignment of power to the electorate is the fundamental strength of representative democracies. Political gerrymandering, if left unchecked, threatens to undermine democratic systems. Since gerrymandering issues can be formulated as well-stated mathematical problems, one can develop tools and tests to identify and inhibit such practices.
We have presented a number of tools for studying gerrymandering and used these to examine central questions to gerrymandering. A lattice model for population distributions was developed and we proposed several algorithms to partition lattice territories into gerrymandered, equal-population, connected (or mostly connected) districts. We used our lattice model to argue that the method of Friedman & Holden  is unrealistic since it generally leads to disconnected districts. However, the techniques of packing and cracking remain central tools for gerrymandering, and we carried these ideas in constructing our own algorithmic approaches. To this end we developed three novel gerrymandering algorithms, SRFH Packing, Saturation Packing and Genetic Gerrymandering, and example executions of these strategies are shown in Figures 9, 11, & 13.
The probabilistic population fluctuations inherent to our voter models, allowed us to employ Monte Carlo methods to study the effectiveness of our gerrymandering algorithms. We found that Saturation Packing, the blunt strategy of packing opposition voters into a small number of districts, provided the most effective manner to secure district for a balanced vote. Moreover, our Saturation Packing algorithm led to a less fractured final district than SRFH Packing, with around 25% fewer components. Genetic Gerrymandering was highlighted as our most complete algorithm, since it outputs districts which are connected with balanced populations as typically required to be legally valid, however the price for guaranteed connectedness in all districts is a significant reduction in partisan advantage for the gerrymander. Indeed, the Genetic Gerrymandering algorithm did not always assure electoral victory for a balanced vote, but it can tilt the territory in favour of the proponent for simple voter distributions. These weaker results are likely due to the genetic algorithm converging prematurely to local optima, and in future work we will confront this issue to construct more aggressive genetic gerrymandering algorithms.
There are several other extensions of our algorithms which would be interesting to explore, such as incorporating third-party candidates and nonvoting electors. Furthermore, our current algorithms assume complete knowledge about the population distribution and voter preferences, but in reality, a gerrymanderer has imprecise information about these distributions, which leads to uncertainty in the voter preference distributions. Voter uncertainty can be implemented by allowing each to have some probabilistic fluctuations. One might also implement ‘voter shocks’ to model swings in the popular vote by after redistricting is complete, as discussed in Friedman & Holden . Both of these extensions directly affect the required vote threshold , since if during redistricting is not sufficiently large, the proponent party may lose the election. Additionally, it would be interesting to extend the work initiated here to a more systematic study of different population distributions and spreads of partisan bias, in order to identify voter distributions which may be more vulnerable to gerrymandering.
We used the outputs of our gerrymandering algorithms to empirically demonstrate that gerrymandering provides a clear advantage for the gerrymanderer’s party, and that the partisan connected districts output by our algorithms typically fail isoperimetric quotient tests. Notably, while connectivity is legally mandated, compactness is not. Thus our work adds further support for implementing some legally mandated compactness requirement for redistricting to inhibit political gerrymandering.
- Altman  Altman, M. (1998) modelling the effect of mandatory district compactness on partisan gerrymanders. Political Geography 17.8 (1998): 989-1012.
- Altman & McDonald  Altman, M. and McDonald, M. (2011), BARD: Better Automated Redistricting, Journal of Statistical Software, Articles 42 (2011) 4.
- Apollonioa et al.  Apollonioa, N. et al. (2009) Bicolored Graph Partitioning, or: Gerrymandering at its Worst, Discrete Applied Mathematics, Volume 157, Issue 17, 28 (2009), 3601.
- Bacao et al.  Bacao, F., Lobo, V., and Painho, M. (2005) Applying genetic algorithms to zone design. Soft Computing 9.5 (2005): 341-348.
- Benisek v. Lamone  Benisek v. Lamone, 585 U.S. 17-333 (2018).
- Bium  Bium, H. (1964) A transformation for extracting new descriptions of shape, Symposium on Models for the Perception of Speech and Visual Form, MIT Press (1964).
- Bowen  Bowen, D. C. (2014) Boundaries, Redistricting Criteria, and Representation in the US House of Representatives. American Politics Research 42.5 (2014): 856-895.
- Castellano et al.  Castellano, C., Santo F., and Vittorio L. (2009) Statistical physics of social dynamics. Reviews of modern physics 81.2 (2009): 591.
- Chambers & Miller  Chambers, C. P. and Miller A. D. (2010) A Measure of Bizarreness, Quarterly Journal of Political Science 5 (1) (2010), 27-44.
- Chen & Rodden  Chen, J., and Rodden J. (2015) Cutting through the thicket: Redistricting simulations and the detection of partisan gerrymanders. Election Law Journal 14.4 (2015): 331.
- Chou & Li  Chou, C.-I., and Li. S.-P. (2006) Taming the gerrymander: statistical physics approach to political districting problem. Physica A 369.2 (2006): 799-808.
- Chou et al.  Chou, C.-I., Chu. Y., and Li. S.-P. (2007) Evolutionary strategy for political districting problem using genetic algorithm. International Conference on Computational Science. Springer, Berlin, Heidelberg, 2007.
- Chou et al.  Chou, C., et al. (2014) On empirical validation of compactness measures for electoral redistricting and its significance for application of models in the social sciences. Social Science Computer Review 32.4 (2014): 534-543.
- Duchin  Duchin, M. (2018) Gerrymandering metrics: How to measure? What’s the baseline? arXiv:1801.02064.
Fifield et al. 
Fifield, B., et al., (2015)
A new automated redistricting simulator using markov chain monte carlo,Work. Pap., Princeton Univ., Princeton, NJ (2015).
- Friedman & Holden  Friedman, J. N. and Holden, R. T. (2008) Optimal Gerrymandering: Sometimes Pack, But Never Crack, American Economic Review (2008), 98:1, 113-144.
Forman & Yue 
Forman, S. L., and Yue. Y. (2003) Congressional districting using a TSP-based genetic algorithm.
Genetic and Evolutionary Computation Conference. Springer, Berlin, Heidelberg, 2003.
- Giansiracusa  Giansiracusa, N. and Ricciardi C. (2017), Geometry in the Courtroom, preprint arXiv: 1709.05662
- Gill v. Whitford  Gill v. Whitford, 585 U.S. 16-1161 (2018).
- Glassner  Glassner, A. S., (2013) Graphics gems. Elsevier.
- Herschlag et al.  Herschlag, G., Ravier R., Mattingly J. C., Evaluating Partisan Gerrymandering in Wisconsin, preprint arXiv:1709.01596 (2017).
- Herschlag  Herschlag, G., et al., Quantifying Gerrymandering in North Carolina, preprint arXiv:1801.03783 (2018).
- Hoare  Hoare, C. A. R. (1961) Algorithm 64: Quicksort, Comm. ACM. 4 (7): 321 (1961).
- Hodge et al.  Hodge, J., Marshall, E. and Patterson, G. (2010) Gerrymandering and Convexity, The College Mathematics Journal Vol. 41, No. 4 (2010), pp. 312-324
- Humphreys  Humphreys, M. (2011) Can compactness constrain the gerrymander?. Irish Political Studies 26.4 (2011): 513-520.
- Niemi et al.  Niemi, R.G., Groffman, B., Calucci C., and Hofeller, T. (1990) Measuring compactness and the role of compactness standard in a test for partisan and racial gerrymandering, Journal of Politics 52:1155.
- Macal & North  Macal, C. M., and North M. J. (2005) Tutorial on agent-based modeling and simulation. Simulation conference, 2005 proceedings of the winter. IEEE, 2005.
- Miller v. Johnson  Miller v. Johnson, 515 U.S. 900 (1995).
- Oxtoby  Oxtoby, J. (1977) Diameters of Arcs and the Gerrymandering Problem, The American Mathematical Monthly, Vol. 84, No. 3 (1977), pp. 155-162
- Polsby & Popper  Polsby, D. and Popper, R. (1991) The Third criterion: Compactness as a procedural safeguard against partisan gerrymandering, Yale Law and Policy Review, 9, 301.
- Puppe & Tasnadi  Puppe, C. and Tasnadi, A. (2009) Optimal redistricting under geographical constraints: Why “pack and crack” does not work, Economics Letters 105.1 (2009): 93.
- Roeck  Roeck, Jr., E. C. (1961) Measuring the compactness as a requirement of legislative apportionment, Midwest Journal of Political Science, 5 (1961), 70-74.
- Shaw v. Reno  Shaw v. Reno, 509 U.S. 630 (1993).
- Schwartzberg  Schwartzberg, J. E. (1966) Reapportionment, gerrymanders, and the notion of compactness, Minnesota Law Review, 50 (1966), 443-452.
- Sherstyuk  Sherstyuk, K. (1998) How to Gerrymander: A Formal Analysis, Public Choice 95, 27.
- Shiffman  Shiffman, D. (2012) The Nature of Code: Simulating Natural Systems with Processing (2012), ISBN-13: 978-0985930806.
- Smith  Smith, A. R. (1979). Tint Fill, SIGGRAPH ’79 Proceedings, 279?283.
- Vanneschi et al.  Vanneschi, L., Henriques, R., and Castelli, M. (2017) Multi-objective genetic algorithm with variable neighbourhood search for the electoral redistricting problem. Swarm and Evolutionary Computation 36 (2017): 37-51.
- Wall  Wall, J. F. (2008) Considering Opinion Dynamics and Community Structure in Complex Networks: A view towards modelling elections and gerrymandering. (2008).
- Wang  Wang, S. S-H. (2016) Three tests for practical evaluation of partisan gerrymandering. Stan. L. Rev. 68 (2016): 1263.
- Warrington  Warrington, G. S. (2018) A comparison of gerrymandering metrics, preprint arXiv:1805.12572.
- Young  Young, H. P. (1988) Measuring the Compactness of Legislative Districts, Legislative Studies Quarterly Vol. 13, No. 1 (1988), pp. 105-115