liveBook · Manning

Population equilibrium

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

A condition in which populations are distributed fairly and comparably across geographic districts.

Population equilibrium distributes residents fairly across geographic districts. A district is balanced when its total population falls between an acceptable lower bound and upper bound around the target average. section 8.8

A districting solution evaluates equilibrium by checking whether each district is:

  • Overpopulated when its total exceeds the upper bound. section 8.8
  • Underpopulated when its total falls below the lower bound. section 8.8
  • Appropriately sized when its total remains within both bounds. section 8.8
  • Optimal when the objective counts zero overpopulated or underpopulated districts. section 8.8

East Toronto districting

A genetic algorithm groups 16 East Toronto neighborhoods into three districts using population data, adjacency relationships, a margin of 6,000, and constraints for nonempty and contiguous districts. The resulting groups satisfy the population-balance objective. section 8.8

Listing 8.6 Solving a political districting problem using GA
import geopandas as gpd
import pandas as pd
import folium
 
data_url="https://raw.githubusercontent.com/Optimization-Algorithms-Book/  #1
Code-Listings/main/Appendix%20B/data/PoliticalDistricting/" 
 
toronto = gpd.read_file(data_url+"toronto.geojson")                        #2
neighborhoods = pd.read_csv(data_url+"Toronto_Neighborhoods.csv")          #3
 
range_limit = 16                                                           #4
toronto_sample = toronto.tail(range_limit)                                 #4
values = neighborhoods.tail(range_limit)                                   #4
values = values.join(toronto_sample["cartodb_id"])                         #4

Use the implementation listing to inspect preprocessing, population extraction, adjacency construction, genetic-algorithm parameters, and optimization. section 8.8

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines bounds and an objective, then implements population and feasibility checks within a genetic algorithm.
Examples
Uses 16 East Toronto neighborhoods, population records, adjacency data, three districts, and a 6,000-person margin.
What it assumes
Assumes neighborhood population and geometry data, while demonstrating how to derive adjacency relationships before optimization.
What you can do after
Apply it via a genetic algorithm to evaluate and construct geographically connected, population-balanced electoral districts.
How it connects
Links political districting with genetic algorithms, geographic adjacency, constraints, and objective functions.

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.