Lecture VIII - Police Districting

Applied Optimization with Julia

Author
Affiliation

Dr. Tobias Vlćek

University of Hamburg

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

Police car with flashing lights at night

Emergency services address the needs of three interest groups:

  • Citizens
  • Service personnel
  • Administrators

Question: What could be the objectives of these groups?

Stakeholder Objectives

  1. Citizens
    • Fast response times
    • Reliable service coverage
  2. Service Personnel
    • Manageable workloads
    • Safe working conditions
  1. Administrators
    • Cost efficiency
    • Resource optimization

Aligning the objectives of the three interest groups is challenging.

Emergency Service Districting

Aerial view of a city with a dense street network

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

How can we improve

this situation?

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

Timeline of a response: call, dispatch, driving, arrival

  • 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?

Hexagonal grid divided into three colored districts with marked department cells

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

Timeline of a response: call, dispatch, driving, arrival

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
WarningConclusion

We focus on minimizing expected driving times between departments and incident locations.

Let’s build our model

step by step!

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

Hexagonal cell reduced to its centroid point

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

Hexagon centroids as vertices of a graph connected by edges

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?

Hexagon centroids as vertices of a graph connected by edges

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)?

NoteWe have the following sets:
  • BAs, indexed by \(j \in \mathcal{J}\)
  • Potential department locations, indexed by \(i \in \mathcal{I}\)

. . .

ImportantOur objective is to:

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}\)

Let’s build our

objective function!

Objective Function?

ImportantOur objective is to:

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} \]

. . .

ImportantExpected Driving Time
  • 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

Hexagonal grid divided into three compact colored districts

Question: Constraints needed?

  1. BA must have one department
  2. Limit number of departments
  3. Only assign active departments
  4. Ensure contiguous districts
  5. 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

. . .

NoteWe need the following variables:
  • \(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?

ImportantThe goal of these constraints is to:

Ensure that exactly \(p\) departments are opened.

. . .

NoteWe need the following sets, parameters and variables:
  • \(\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?

ImportantThe goal of these constraints is to:

Ensure that each BA is assigned to an active department, e.g. a department that is opened and that could dispatch vehicles.

. . .

NoteWe need the following sets and variables:
  • \(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

Hexagonal grid divided into three colored districts with marked department cells

Question: Why is contiguity important?

  • Prevents isolated areas
  • Ensures contiguous patrol routes
  • Maintains operational coherence

What is compactness?

Districting with a distorted district snaking to the corner

Districting with three compact districts

Alternative districting with three compact districts

. . .

NoteCompactness

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

Districting with three compact districts

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} \]

. . .

NoteThe idea

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

Hexagonal grid with department i on the left and BA j to its right in the same row

Department \(i\) and BA \(j\): which neighbors of \(j\) are closer to \(i\)?

Example A

Same grid with the three neighbors of BA j that are closer to department i highlighted in green

All three highlighted BAs \(v\) are adjacent to \(j\) and closer to \(i\): \(|\mathcal{N}_{i,j}| = 3\).

Example B

Hexagonal grid with department i on the left and BA j at the upper edge of the grid

Same department \(i\), but BA \(j\) now lies at the edge of the grid.

Example B

Same grid with only two neighbors of BA j highlighted in green as closer to department i

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 \]

. . .

ImportantThe idea

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*}\]

. . .

ImportantThe idea

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

Districting where the red district snakes to the upper right corner

Districting with three compact, round-shaped districts

Alternative districting with three compact, round-shaped districts

. . .

NoteWhy does this work?

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:
    1. Large metropolitan area (Germany)
    2. 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

Map of optimized police districts in the German metropolitan case study

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

Map of optimized police districts in the Belgian rural case study

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

  1. Model adaptability crucial
  2. Local context matters
  3. Stakeholder buy-in essential
  4. 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

NoteAnd that’s it for today’s lecture!

We now have covered districting problems and are ready to start solving some tasks in the upcoming tutorial.

Questions?

Literature

Literature I

For more interesting literature to learn more about Julia, take a look at the literature list of this course.

References

Bodily, Samuel E. 1978. “Police Sector Design Incorporating Preferences of Interest Groups for Equality and Efficiency.” Management Science 24 (12): 1301–13. https://doi.org/10.1287/mnsc.24.12.1301.
Bruce, Christopher. 2009. Districting and Resource Allocation: A Question of Balance.” A Quarterly Bulletin of Applied Geography for the Study of Crime & Public Safety 1 (4): 1–3.
D’Amico, Steven J., Shoou-Jiun Wang, Rajan Batta, and Christopher M. Rump. 2002. “A Simulated Annealing Approach to Police District Design.” Computers & Operations Research 29 (6): 667–84. https://doi.org/10.1016/s0305-0548(01)00056-9.
Kalcsics, Jörg, Stefan Nickel, and Michael Schröder. 2005. “Towards a Unified Territorial Design Approach — Applications, Algorithms and GIS Integration.” Top 13 (1): 1–56. https://doi.org/10.1007/BF02578982.
Liberatore, Federico, Miguel Camacho-Collados, and Begoña Vitoriano. 2020. “Police Districting Problem: Literature Review and Annotated Bibliography.” In International Series in Operations Research & Management Science: Optimal Districting and Territory Design, edited by Roger Z. Ríos-Mercado. Springer International Publishing. https://doi.org/10.1007/978-3-030-34312-5_2.
Mayer, Allison. 2009. Geospatial Technology Helps East Orange Crack down on Crime.” A Quarterly Bulletin of Applied Geography for the Study of Crime & Public Safety 1 (4): 8–10.
Miller, Herbert F., and Bastiaan A. Knoppers. 1972. Computer Simulation of Police Dispatching and Patrol Functions.” In International Symposium on Criminal Justice Information and Statistics Systems Proceedings, edited by Gary Cooper. National Institute of Justice.
Vlćek, Tobias, Knut Haase, Malte Fliedner, and Tobias Cors. 2024. “Police Service District Planning.” OR Spectrum, ahead of print, February. https://doi.org/10.1007/s00291-024-00745-3.
Wang, Jue, and Mei-Po Kwan. 2018. “Hexagon-Based Adaptive Crystal Growth Voronoi Diagrams Based on Weighted Planes for Service Area Delimitation.” ISPRS International Journal of Geo-Information 7: 257. https://doi.org/10.3390/ijgi7070257.
Zoltners, Andris A., and Prabhakant Sinha. 1983. “Sales Territory Alignment: A Review and Model.” Management Science 29 (11): 1237–56. https://doi.org/10.1287/mnsc.29.11.1237.

Footnotes

  1. Zoltners and Sinha (1983)↩︎