Lecture VIII - Police Districting
Applied Optimization with Julia
Introduction
Police Service District Planning
Learning Objectives
After this lecture, you can:
- Explain the territory design problem and its applications
- Model districting as a p-median problem
- Explain the difference between contiguity and compactness
- Enforce both with additional constraints
- Discuss the assumptions and limitations of the model
Challenges
Question: What makes the work of emergency services complex?
- Dynamic urban development
- Changing population patterns
- Resource constraints
- Need for rapid response
- Multiple stakeholder interests
Emergency Services
Emergency services address the needs of three interest groups:
- Citizens
- Service personnel
- Administrators
Question: What could be the objectives of these groups?
Stakeholder Objectives
- Citizens
- Fast response times
- Reliable service coverage
- Service Personnel
- Manageable workloads
- Safe working conditions
- Administrators
- Cost efficiency
- Resource optimization
Aligning the objectives of the three interest groups is challenging.
Emergency Service Districting
Question: Why might current district layouts be suboptimal?
- Many layouts date back several decades
- Often designed along highways and regions (Bruce 2009)
- Extensive data not used for data-driven improvement
The Role of Data
Question: What data can help improve emergency services?
- Historical incident patterns
- Response time analysis
- Resource utilization metrics
- Population densities and traffic patterns
. . .
Extensive data collected, but often lack of tools or knowledge to leverage it.
Optimization
- Operations research (OR) models can help!
- Based on incident records and geographical information
- Improve the response of emergency services
- Help administrators in making strategic decisions
- Locate new departments or close departments (Liberatore et al. 2020)
Case Studies
Police Districting
For an efficient and effective distribution of resources, police jurisdictions are divided into precincts or command districts with separate departments. These are further divided into patrol beats (D’Amico et al. 2002).
Service Priority Extremes
- High Priority
- Life-threatening situations
- Active crimes in progress
- Multiple unit response needed
- Low Priority
- Minor incidents
- Administrative tasks
Case Studies
- Different urban contexts
- Study of jurisdictions in
- Germany: Large metropolitan area
- Belgium: Large rural area
- Focus on response time optimization
. . .
Part of the force patrols the streets, another part is stationed at the departments.
Dispatching
- Dispatchers assign all calls for service (CFS) to vehicles from the corresponding districts and patrol areas
- Officers are familiar with the area and are thus better prepared to respond appropriately (Bodily 1978)
- To cope with high demands, dispatchers can assign vehicles from nearby districts or beats
Potential Problem
Question: What could be the potential problem?
. . .
- This can lead to a domino effect
- Transferring vehicles from other districts or beats reduces coverage in those locations (Mayer 2009)
- This makes them vulnerable to missing resources when they need assistance themselves
Overloaded Systems
- This can lead to overloaded systems!
- Long dispatching delays due to staff shortages
- Preventive patrol hardly possible (Miller and Knoppers 1972)
- Dispatchers constantly draw on patrol resources
- Reduces the response time of emergency services
. . .
This is a common problem in many emergency services.
Response Time
- Central criterion to measure the effectiveness of emergency services is the response time
- Time between a call for aid and the arrival at the incident location
- Low response time increases the likelihood of helping and improves confidence (Bodily 1978)
Response Time Influencers
Question: What affects response time?
- Initial contact
- Information gathering
- Unit assignment
- Resource coordination
- Route to location
- Traffic conditions
Territory Design Problem
What is Territory Design?
Aggregation of small geographic areas, called basic areas (BAs), into geographic clusters, called districts, so that these are acceptable according to pre-defined planning criteria1.
. . .
Territory design is a general framework applicable to many domains: emergency services, sales territories, political districts, school districts, etc.
Territory Design Components
Question: What are the key components?
- Basic Areas (BAs): Smallest indivisible geographic units
- Districts/Territories: Aggregation of BAs
- Planning Criteria: Rules and objectives for grouping
- Decision: Which BAs belong to which district?
. . .
In our police case: BAs are hexagonal cells, districts are service areas for police departments.
Common TD Objectives
Balance Criteria:
- Equal workload distribution
- Equal sales potential
- Equal population coverage
- Resource balance
Geographic Criteria:
- Contiguity: No isolated basic areas
- Compactness: “Round”, undistorted shapes
- Minimize travel distances
- Respect boundaries
. . .
These criteria often conflict with each other… Optimization helps find the best trade-off!
Applications of TD
Question: Where else is this used?
- Sales force deployment: Sales reps to territories
- Political districting: Electoral boundaries
- School districts: Student assignment zones
- Waste collection: Service route planning
- Healthcare: Hospital catchment areas
. . .
Same mathematical structure, different objectives and constraints!
Police Districting Specifics
Question: What could be the objective?
. . .
- Minimize the response time to help citizens faster while increasing the confidence in the service
. . .
Question: What could be further objectives?
. . .
- Reallocate only part of the police department’s resources
- Compact and contiguous territories to improve patrol
- Prevention of isolated departments
Response Time Components
Question: How can we model response time?
- Call length is independent of territory
- Dispatch time is difficult to model
- Driving time can be minimized directly
We focus on minimizing expected driving times between departments and incident locations.
Model Formulation
Key Model Components
Question: What could be our key model components?
. . .
- Basic areas (BAs) and potential department locations
- Driving times between department locations and BAs
- Forecasted incident data
- Assignment decisions
. . .
Question: Which are sets, parameters, and variables?
From Geography to Graph
Question: How do we model this mathematically?
- Geographic areas → Centroids
- Centroids → Vertices in a graph
- Spatial relationships → Edges between vertices
. . .
This abstraction allows us to use optimization techniques from graph theory and location science!
Mathematical Structure
Question: What sets do we need?
- \(\mathcal{J}\) : Set of all BAs (basic areas), indexed by \(j\)
- \(\mathcal{I}\) : Set of potential department locations where \(\mathcal{I} \subseteq \mathcal{J}\), indexed by \(i\)
. . .
Department locations are a subset of all BAs as not every BA can host a department!
Why Hexagons?
Question: Advantages of hexagons?
- Equal distances to all neighboring centroids
- Reduces sampling bias from edge effects (Wang and Kwan 2018)
- Special properties that help with the enforcement of compactness
- Better representation of urban geography
Parameters
Question: What parameters do we need?
- \(p\) - Number of departments to be located
- \(t_{i,j}\) - Expected driving time from department location \(i\) to BA \(j\)
- \(w_j\) - Forecasted number of incidents in BA \(j\)
. . .
Parameters should be carefully calibrated with real-world data!
Decision Variable(s)?
- BAs, indexed by \(j \in \mathcal{J}\)
- Potential department locations, indexed by \(i \in \mathcal{I}\)
. . .
Minimize the expected response time of the emergency services by optimizing the assignment of BAs to departments.
. . .
Question: What decisions do we need to model?
Decision variable/s
- \(X_{i,j}\): 1 if BA \(j\) assigned to department \(i\), 0 otherwise
. . .
Question: What is the domain of our decision variable?
. . .
- \(X_{i,j} \in \{0,1\} \quad \forall i \in \mathcal{I}, j \in \mathcal{J}\)
Objective Function?
Minimize the expected response time of the emergency services by optimizing the assignment of BAs to departments.
. . .
Question: How do we minimize response time?
- We want to minimize total driving time
- Weight each BA by its forecasted incidents \(w_j\)
- No fixed opening costs: the number of departments is fixed to \(p\) anyway
Objective Function
Question: What could be our objective function?
. . .
\[ \text{Minimize} \quad \sum_{i \in \mathcal{I}}\sum_{j \in \mathcal{J}} w_j \times t_{i,j} \times X_{i,j} \]
. . .
- Total driving time across all assignments
- Weighted by the incident frequency \(w_j\) of each BA
- Considers all possible BA-department pairs
Constraints
Key Constraints
Question: Constraints needed?
- BA must have one department
- Limit number of departments
- Only assign active departments
- Ensure contiguous districts
- Maintain district compactness
Single Assignment Constraint?
Question: Why do we need this constraint?
. . .
- Each BA must be assigned to exactly one department
- Prevents overlapping jurisdictions
- Ensures complete coverage
. . .
- \(X_{i,j}\) - 1 if BA \(j\) assigned to department \(i\), 0 otherwise
Single Assignment Constraint?
Question: What could the constraint look like?
. . .
\[ \sum_{i \in \mathcal{I}} X_{i,j} = 1 \quad \forall j \in \mathcal{J} \]
. . .
Each BA must be assigned to exactly one department.
Department Count Constraint?
Ensure that exactly \(p\) departments are opened.
. . .
- \(\mathcal{I}\) - Set of potential department locations, indexed by \(i\)
- \(X_{i,j}\) - 1, if BA \(j\) assigned to department \(i\), 0 otherwise
- \(p\) - Number of departments
The Self-Assignment Trick
Question: What does the variable \(X_{i,i}\) stand for?
. . .
- BA \(i\) is assigned to the department in the same BA \(i\)
- An open department always serves its own BA
- Hence: \(X_{i,i} = 1\) exactly if department \(i\) is open
. . .
Many textbooks use a separate variable \(Y_i\) to model opening a facility. Using the “diagonal” \(X_{i,i}\) instead saves these extra variables — both formulations are equivalent here.
Department Count Constraint
Question: What could the constraint look like?
. . .
\[ \sum_{i \in \mathcal{I}} X_{i,i} = p \]
. . .
Question: What happens if we have more departments than potential locations?
. . .
- We can’t open more departments than there are locations
- The model will be infeasible
Active Department Constraint?
Ensure that each BA is assigned to an active department, e.g. a department that is opened and that could dispatch vehicles.
. . .
- \(X_{i,j}\) - 1, if BA \(j\) assigned to department \(i\), 0 otherwise
Question: How do we ensure assignments only to active departments?
Active Department Constraint
\[ X_{i,j} \leq X_{i,i} \quad \forall i \in \mathcal{I}, j \in \mathcal{J} \]
. . .
This constraint creates a logical connection between department locations and BA assignments where BAs can only be assigned to opened departments.
p-Median Problem
\[\begin{align} \text{Minimize} \quad & \sum_{i \in \mathcal{I}}\sum_{j \in \mathcal{J}} w_j \times t_{i,j} \times X_{i,j} \\ \text{subject to:} \quad & \sum_{i \in \mathcal{I}} X_{i,j}= 1 && \forall j \in \mathcal{J} \\ & \sum_{i \in \mathcal{I}} X_{i,i} = p && \\ & X_{i,j} \leq X_{i,i} && \forall i \in \mathcal{I}, j \in \mathcal{J} \\ & X_{i,j} \in \{0,1\} && \forall i \in \mathcal{I}, j \in \mathcal{J} \end{align}\]
Connection to Facility Location
Question: How does this relate to these problems?
. . .
p-Median Problem:
- Fixed number of facilities (exactly \(p\))
- Minimize total distance
- All customers served
- No capacity constraints
Similar problems:
- UFLP: Uncapacitated Facility Location
- p-Center: Minimize maximum distance
- Capacitated: Add limits
. . .
Our police districting is a p-Median variant with additional geographic constraints (contiguity, compactness)!
Contiguity and Compactness
Contiguity Introduction
Question: Why is contiguity important?
- Prevents isolated areas
- Ensures contiguous patrol routes
- Maintains operational coherence
What is compactness?
. . .
Compactness has no univocal definition; a district is commonly declared compact if it is ‘somehow round-shaped and undistorted’ (Kalcsics et al. 2005).
Contiguity and Compactness
Question: Are our resulting districts based on the model contiguous and compact?
- This depends on \(t_{i,j}\)
- If Euclidean distance
- Districts will be contiguous
- Likely of compact shape
Compactness p-Median
Question: Is this likely for police service districting?
- No, as we minimize the driving time within a city
- Highways, Tunnels, etc.
- Multiplied by the differing number of requested cars
- This can contribute to distorted district shapes
Contiguity Sets
Additional Set and Parameter
- \(e_{i,j}\) - Euclidean distance between centroids
- \(\mathcal{A}_j\) - Set of BAs adjacent to BA \(j\)
. . .
\[ \mathcal{N}_{i,j}=\{v \in \mathcal{A}_j | e_{i,v} < e_{i,j}\} \quad \forall i\in \mathcal{I}, j\in \mathcal{J} \]
. . .
BAs closer to department \(i\) than BA \(j\) in Euclidean distance and adjacent to \(j\)!
Careful with Ties!
- If all adjacent BAs are exactly as far from \(i\) as \(j\), the strict inequality leaves \(\mathcal{N}_{i,j}\) empty
- Then the assignment of \(j\) to \(i\) is forbidden
- Implementations should break ties, e.g. with \(e_{i,v} \leq e_{i,j}\) and \(v \neq j\)
. . .
On a complete hexagonal grid, this cannot happen: one neighbor of \(j\) is always strictly closer to \(i\). But real-world maps with holes, concave boundaries, or irregular BAs can produce ties!
Example A
Department \(i\) and BA \(j\): which neighbors of \(j\) are closer to \(i\)?
Example A
All three highlighted BAs \(v\) are adjacent to \(j\) and closer to \(i\): \(|\mathcal{N}_{i,j}| = 3\).
Example B
Same department \(i\), but BA \(j\) now lies at the edge of the grid.
Example B
Here, only two neighbors of \(j\) are closer to \(i\): \(|\mathcal{N}_{i,j}| = 2\).
Enforcing Contiguity
All districts have to be contiguous
\[ X_{i,j} \leq \sum_{v \in \mathcal{N}_{i,j}} X_{i,v} \quad \forall i \in \mathcal{I}, j \in \mathcal{J} \setminus \mathcal{A}_i: i \neq j \]
. . .
If BA \(j\) is assigned to department \(i\), then at least one BA that is adjacent to \(j\) and closer to \(i\) must also be assigned to department \(i\)!
Contiguity and Compactness
All districts have to be contiguous and compact
\[\begin{align*} X_{i,j} &\leq \sum_{v \in \mathcal{N}_{i,j}}X_{i,v} && \forall i \in \mathcal{I}, j \in \mathcal{J} \setminus \mathcal{A}_i:|\mathcal{N}_{i,j}|= 1 \wedge i \neq j \\ 2X_{i,j} &\leq \sum_{v \in \mathcal{N}_{i,j}}X_{i,v} && \forall i \in \mathcal{I}, j \in \mathcal{J} \setminus \mathcal{A}_i:|\mathcal{N}_{i,j}|> 1 \wedge i \neq j \end{align*}\]
. . .
If BA \(j\) is assigned to department \(i\), then at least two BAs that are adjacent to \(j\) and closer to \(i\) must also be assigned to department \(i\) — if \(|\mathcal{N}_{i,j}| > 1\)!
Comparison
. . .
Due to the constraints, there is always a path back to the department if a BA is assigned to a department! Contiguity alone still allows the “snake” on the left; the compactness constraint cuts off such shapes (middle, right).
Model Characteristics
Characteristics I
Question: Is the model formulation linear or non-linear?
. . .
- Objective and all constraints are linear
- With binary variables → mixed-integer problem (MIP)
. . .
Question: What kind of variable domains do we have?
. . .
- \(X_{i,j}\) is binary: \(|\mathcal{I}| \times |\mathcal{J}|\) variables in total
Characteristics II
Question: Can the model be solved quickly?
. . .
- For instances of moderate size: yes, with modern solvers
- The contiguity constraints add many rows → longer runtimes
. . .
Question: Have we prevented isolated districts?
. . .
- The plain p-median does not prevent them
- That is exactly why we added the contiguity constraints!
Model Assumptions
Questions: On model assumptions
- What assumptions have we made?
- Use Euclidean distances to approximate driving time?
- Can we rely on incident data collected by the police?
Implementation and Impact
Overview of Studies
Question: Where did we apply our model?
- Two distinct environments:
- Large metropolitan area (Germany)
- Rural region (Belgium)
- Different challenges and requirements
- Focus on response time optimization
German Metropolitan Case
. . .
- 1.8 million incidents (2015-2019)
- ~20 department locations
- 1,596 basic areas
- Dense urban environment
. . .
Goal: Redesign districts to improve response time.
German Metropolitan Results
Belgian Rural Case
. . .
- 50,000 incidents (2019-2020)
- 2 existing + 1 planned location
- 1,233 basic areas
- Dispersed rural setting
. . .
Goal: Optimize coverage with limited resources.
Belgian Rural Results
Simulation Framework
How did we validate the results?
. . .
- Spatial and temporal patterns
- Shift schedules
- Priority handling
- Rush hours
- Inter-district support
- Variable driving times
Results
- Response time reduction up to 14.52%
- Better workload distribution
- Improved coverage equity
- More efficient resource utilization
. . .
All improvements are without additional staff!
What About Workload Balance?
Question: Our model only minimizes driving time. Where does the better workload distribution come from?
. . .
- The model does not balance workload directly — the effect is emergent
- Compact districts around well-placed departments also spread the expected workload more evenly
- This was measured in the simulation, not enforced by a constraint
. . .
Think about it: how could you add an explicit workload balancing constraint with our parameters \(w_j\) and \(t_{i,j}\)?
Conclusions
- Model adaptability crucial
- Local context matters
- Stakeholder buy-in essential
- Data quality critical
. . .
Success requires balancing theoretical optimization with practical constraints!
Future Applications
Question: Where else could this approach be useful?
- Other emergency services
- Different urban contexts
- Resource allocation problems
- Service territory design
. . .
The methodology is adaptable to various public service optimization scenarios.
Wrap Up
We now have covered districting problems and are ready to start solving some tasks in the upcoming tutorial.
Literature
Literature I
For more interesting literature to learn more about Julia, take a look at the literature list of this course.