Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Integer programming for locating ambulances
1. Integer programming for locating
ambulances
Laura Albert McLay
The Industrial & Systems Engineering Department
University of Wisconsin-Madison
laura@engr.wisc.edu
punkrockOR.wordpress.com
@lauramclay
1This work was in part supported by the U.S. Department of the Army under Grant Award Number W911NF-10-1-0176 and
by the National Science Foundation under Award No. CMMI -1054148, 1444219.
2. The problem
• We want to locate 𝑠 ambulances at stations in a
geographic region to “cover” the most calls in 9
minutes
• What we need to include:
1. Different call volumes at different locations
2. Non-deterministic travel times
3. Each ambulance responds to roughly the
same number of calls
4. Ambulances that are not always available
(backup coverage is important)
2
4. Anatomy of a 911 call
Response time
Service provider:
Emergency 911 call
Unit
dispatched
Unit is en
route
Unit arrives
at scene
Service/care
provided
Unit leaves
scene
Unit arrives
at hospital
Patient
transferred
Unit returns
to service
4
5. Objective functions
• NFPA standard yields a coverage objective function
for response time threshold (RTT)
• Most common RTT: nine minutes for 80% of calls
• A call with response time of 8:59 is covered
• A call with response time of 9:00 is not covered
Why RTTs?
• Easy to measure
• Intuitive
• Unambiguous
5
6. Coverage models for EMS
• Expected coverage objective
• Maximize expected number of calls covered by a 9
minute response time interval
• Coverage issues:
• Ambulance unavailability: Ambulances not available
when servicing a patient (spatial queuing)
• Fractional coverage: coverage is not binary due to
uncertain travel times
• Other issues:
• Which ambulance to send? As backup?
• Side constraints:
• Balanced workload
6
8. Why use optimization models?
Because it helps you identify solutions that are not
intuitive. This adds value!
8
MODEL
9. Model 1: covering location models
Adjusts for different call volumes at different locations (#1),
but does not include our other needs
9
10. Model 1 formulation
Parameters
• 𝑁 = set of demand locations
• 𝑆 = set of stations
• 𝑑𝑖 = demand at 𝑖 ∈ 𝑁
• 𝑟𝑖𝑗= fraction of calls at location 𝑖 ∈
𝑁 that can be reached by 9
minutes from an ambulance from
station 𝑗 ∈ 𝑆.
• When travel times are
deterministic, then 𝑟𝑖𝑗 ∈ {0, 1}
• 𝐽𝑖 ⊂ 𝑆 = subset of stations that can
respond to calls at 𝑖 within 9
minutes, 𝑖 ∈ 𝑁:
• 𝐽𝑖 = 𝑗: 𝑟𝑖𝑗 = 1
• 𝐽𝑖 = all stations that encircle 𝑖
Decision variables
• 𝑦𝑗 = 1 if we locate an ambulance
at station 𝑗 ∈ 𝑆 (and 0 otherwise)
• 𝑥𝑖 = 1 if calls at 𝑖 ∈ 𝑁 are covered
(and 0 otherwise)
• We must locate all 𝑆 ambulances
at stations
• Linking constraint: a location 𝑖 ∈
𝑁 is covered only if one of the
stations in 𝐽𝑖 has an ambulance
• Integrality constraints on the
variables
10
Constraints (in words)
11. Maximal Covering Location Problem #1
max
𝑖∈𝑁
𝑑𝑖 𝑥𝑖
Subject to:
𝑥𝑖 ≤
𝑗∈𝐽 𝑖
𝑦𝑗
𝑗∈𝑆
𝑦𝑗 = 𝑠
𝑥𝑖 ∈ 0, 1 , 𝑖 ∈ 𝑁
𝑦𝑖 ∈ 0, 1 , 𝑗 ∈ 𝑆
11
Church, Richard, and Charles R. Velle. "The maximal covering location problem." Papers in
regional science 32, no. 1 (1974): 101-118.
13. Example solution
Model 1 solutions
0 1 2 3 4 5 6 7 8 9 10
0
1
2
3
4
5
6
7
8
9
10
Limitations
13
• Does not look at backup coverage
• Assumes all calls in circles are 100%
“covered”
• Does not assign calls to stations
• Each ambulance does not respond to
same number of calls
14. Model 2: p-median models to
maximize expected coverage
Addresses:
1. Different call volumes at different locations
2. Non-deterministic travel times
3. Each ambulance responds to roughly the same number of calls
Does not address #4: backup coverage
14
17. Model formulation
Parameters
• 𝑁 = set of demand locations
• 𝑆 = set of stations
• 𝑑𝑖 = demand at 𝑖 ∈ 𝑁
• 𝑟𝑖𝑗= fraction of calls at location
𝑖 ∈ 𝑁 that can be reached by 9
minutes from an ambulance
from station 𝑗 ∈ 𝑆.
• 𝒓𝒊𝒋 ∈ 𝟎, 𝟏 (fractional!)
• 𝒍 = lower bound on number of
calls assigned to each open
station
• 𝑐 = capacity of each station (max
number of ambulances, 𝑐 = 1)
Decision variables
• 𝑦𝑗 = 1 if we locate an ambulance at
station 𝑗 ∈ 𝑆 (and 0 otherwise)
• 𝒙𝒊𝒋 = 1 if calls at 𝒊 ∈ 𝑵 are assigned
to station 𝒋 (and 0 otherwise)
• We must locate all 𝑠 ambulances at
stations
• Each open station must have at least
𝒍 calls assigned to it
• Linking constraint: a location 𝒊 ∈ 𝑵
can be assigned to station 𝒋 only if 𝒋
has an ambulance
• Each location must be assigned to at
most one (open) station
• Integrality constraints on the
variables
17
Constraints (in words)
18. Integer programming bag of tricks
• 𝛿 = 1 → 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 ≤ 𝑏
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 + 𝑀 𝛿 ≤ 𝑀 + 𝑏
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 ≤ 𝑏 → 𝛿 = 1
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 − 𝑚 − 𝜖 𝛿 ≤ 𝑏 + 𝜖
• 𝛿 = 1 → 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 ≥ 𝑏
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 + 𝑚 𝛿 ≥ 𝑚 + 𝑏
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 ≥ 𝑏 → 𝛿 = 1
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 − 𝑀 + 𝜖 𝛿 ≤ 𝑏 − 𝜖
• 𝛿 is a binary variable
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 constraint
LHS
• 𝑏: constraint RHS
• 𝑀: upper bound on
𝑗∈𝑁 𝑎𝑗 𝑥𝑗 − 𝑏
• 𝑚: lower bound on
𝑗∈𝑁 𝑎𝑗 𝑥𝑗 − 𝑏
• 𝜖: constraint violation
amount (0.01 or 1)
18
Each open station must have at least 𝒍 calls assigned to it
20. Bag of tricks
• We want to use this one:
• 𝛿 = 1 → 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 ≥ 𝑏
• 𝑗∈𝑁 𝑎𝑗 𝑥𝑗 + 𝑚 𝛿 ≥ 𝑚 + 𝑏
For this:
• 𝑦𝑗 = 1 → 𝑖∈𝑁 𝑑𝑖 𝑥𝑖𝑗 ≥ 𝑙
• Step 1:
• Find 𝑚: lower bound on 𝑖∈𝑁 𝑑𝑖 𝑥𝑖𝑗 − 𝑙
• This is −𝑙 since we could assign no calls to 𝑗
• Step 2: Put it together and simplify
• 𝑖∈𝑁 𝑑𝑖 𝑥𝑖𝑗 − 𝑙 𝑦𝑗 ≥ −𝑙 + 𝑙 simplifies to
• 𝑖∈𝑁 𝑑𝑖 𝑥𝑖𝑗 ≥ 𝑙 𝑦𝑗
• Note: this will also work when we let up to 𝑐
ambulances located at a station
• 𝑦𝑖 ∈ 0, 1, … , 𝑐
20
23. Model 3: p-median models to maximize
expected (backup) coverage
Addresses:
1. Different call volumes at different locations
2. Non-deterministic travel times
3. Each ambulance responds to roughly the same number of calls
4. Ambulances that are not always available (backup coverage is
important)
23
24. Ambulances that are not always available
Let’s model this as follows:
• Let’s pick the top 3 ambulances that should respond to each call
• Ambulance 1, 2, 3 responds to a call with probability 𝜋1, 𝜋2, 𝜋3
with 𝜋1 + 𝜋2 + 𝜋3 < 1.
Ambulances are busy with probability 𝜌
1. First choice ambulance response with probability π1 ≈ 1 − 𝜌
2. Second choice ambulance response with probability π2 ≈
𝜌(1 − 𝜌)
3. Third choice ambulance response with probability π3 ≈
𝜌2 1 − 𝜌
• If 𝜌 = 0.3 then 𝜋1 = 0.7, 𝜋2 = 0.21, 𝜋3 = 0.063 (sum to 0.973)
• If 𝜌 = 0.5 then 𝜋1 = 0.5, 𝜋2 = 0.25, 𝜋3 = 0.125 (sum to 0.875)
24
25. New variables
We need to change this variable:
• 𝑥𝑖𝑗 = 1 if calls at 𝑖 ∈ 𝑁 are assigned to station 𝑗 (and
0 otherwise)
to this:
• 𝑥𝑖𝑗𝑘 = 1 if calls at 𝑖 ∈ 𝑁 are assigned to station 𝑗 at
the 𝑘 𝑡ℎ priority, 𝑘 = 1, 2, 3.
Note: this is cool!
This tells us which ambulance to send, not just where
to locate the ambulances.
25
26. Model formulation
Parameters
• 𝑁 = set of demand locations
• 𝑆 = set of stations
• 𝑑𝑖 = demand at 𝑖 ∈ 𝑁
• 𝑟𝑖𝑗= fraction of calls at location
𝑖 ∈ 𝑁 that can be reached by 9
minutes from an ambulance
from station 𝑗 ∈ 𝑆.
• 𝑟𝑖𝑗 ∈ 0,1
• 𝑙 = lower bound on number of
calls assigned to each open
station
• 𝝅 𝟏, 𝝅 𝟐, 𝝅 𝟑 = proportion of calls
when the 1st, 2nd, and 3rd
preferred ambulance responds
Decision variables
• 𝑦𝑗 = 1 if we locate an ambulance at
station 𝑗 ∈ 𝑆 (and 0 otherwise)
• 𝒙𝒊𝒋𝒌 = 1 if station 𝒋 is the 𝒌th preferred
ambulance for calls at 𝒊 ∈ 𝑵, 𝒌 = 𝟏, 𝟐, 𝟑.
• We must locate all 𝑆 ambulances at
stations (at most one per station)
• Each open station must have at least
𝑙 calls assigned to it
• Linking constraint: a location 𝑖 ∈ 𝑁 can be
assigned to station 𝑗 only if 𝑗 has an
ambulance
• Each location must be assigned to 3
(open) stations
• 3 different stations
• Stations must be assigned in a specified
order
• Integrality constraints on the variables26
Constraints (in words)
29. Related blog posts
• A YouTube video about my research
• In defense of model simplicity
• Operations research, disasters, and science
communication
• Domino optimization art
29