torhaa1 / response_time_minimization Goto Github PK
View Code? Open in Web Editor NEWOptimal placement of police units to minimize response time to events in police districts.
Optimal placement of police units to minimize response time to events in police districts.
Problem started at Commit: Improved sampling of car points
Obs: noticed that the Capacity constraints was slightly exceeded for some reason. E.g.:
Police car id: 8228357538 handles 293 events | Capacity: 104.64% | ...
Next commit: Move functions into utilityModule.py
Noticed even more exceedance of max_capacity constraint again (even when solving the MILP problem):
Police car id: 2012771318 handles 291 events | Capacity: 111.92% | ...
New constraint:
# Police Car Placement Constraint
problem += pulp.lpSum([x[i] for i in P]) == K, "NumberOfPoliceCars"
# Event Assignment Constraint
for j in E:
problem += pulp.lpSum([y[(i, j)] for i in P if (i, j) in CostMatrix_dict_reduced]) == 1, f"EventAssignment_{j}"
# Validity Constraint
for (i, j) in CostMatrix_dict_reduced:
problem += y[(i, j)] <= x[i], f"Validity_{i}_{j}"
# Capacity Constraint
for i in P:
problem += pulp.lpSum([y[(i, j)] for j in E if (i, j) in CostMatrix_dict_reduced]) <= M * x[i], f"Capacity_{i}"
Ideas:
Expand the Oslo analysis to include the entire Oslo police district (Oslo, Asker, Bærum).
Most useful to perform analysis district-by-district.
"Oslo politidistrikt er det største politidistriktet i landet målt etter folkemengde - og det minste distriktet målt i areal. Tidligere Asker og Bærum politidistrikt og Oslo politidistrikt er slått sammen. Fra 1.1.2020 ble Røyken og Hurum kommuner en del av Asker kommune, og således også innunder Oslo politidistrikt. Totalt har de tre kommunene ca. 928.156 innbyggere (per 1.kv. 2022). Distriktet har i underkant av 3400 ansatte."
Need to roughly estimate the number of police cars per police district based on public data.
Potential sources to base estimate on:
Uncertainties will be large as there is large variation between the districts, and the Oslo district likely holds additional resources and personnel for other departments.
Use a static speed multiplier of 0.2-0.3 to cut the travel time by 20-30%.
Quick to implement and adjust between runs. Can be applied directly on CostMatrix
.
Adjust speed multipliers based on road type:
Need to filter graph and modify the original edge weights.
Stability issues with the kernel density function utilityModule.plot_population_density_and_event_points()
when the high density clusters happen at the boundary. E.g. In South-East District have clusters in south east side(Drammen).
Looks like it is trying to draw a polygon shape, but get cutoff by the district boundary.
Function is not critical for the analysis, it only constrains the sampling of car nodes closer to the simulated event points.
Currently just skip this function when dealing with a problematic district and filter car nodes more heavily based on network centrality stats.
Not able to fetch complete OSM road network for South-East police district.
OSMnx has problems fetching roads north in Rogaland, bordering to Vestland county.
Even when combining graphs (incl. service roads) for both Rogaland and Vestland county, some of the northern roads of Rogaland is still missing.
A fixed population multiplier for all districts that directly maps population density on 250x250m grids into nr of simulated events in that cell.
Have to create a minimum acceptable nr of points in Finnmark (lowest population density). Then use same multiplier for Oslo (highest population density) resulting in many more points. This could be more than computationally reasonable for a MILP problem.
Finnmark has 401 events, using population multiplier: 0.008347656250000002
Oslo has 7652 events, using population multiplier: 0.008347656250000002
Pro:
Con:
Find a fixed number (interval) nr of points to generate in each district. It should be enough points to spatially represent the population satisfactory, while not too many points to be computationally reasonable for a MILP problem.
With a target range of [1500, 1550] points, we get a median multiplication multiplier of 0.006172363281250001 from all the districts. This can be used as a "standard" multiplication multiplier.
For each district we use a flexible population mulitplier to generate a suitable nr of points in target range of [1500, 1550].
Then we compare the population multiplier used against the standard multiplication multiplier to get a correction factor.
The correction factor is applied to the response time to scale it up or down accordingly.
Correction factor example for the districts with the highest and lowest population density:
Pro:
Con:
For East police district, much of the road network of Oslo needs to be included for correct travel times. Much of the fast roads from south to north pass through Oslo.
E.g. driving from Kolbotn to Lørenskog, would be fast and logical through Oslo, while a major detour if constrained to Akershus road network.
Include whole/parts of Oslo Network as a subgraph/something, while considering:
Also check if the East road network stretch into Oslo in the south-east (kinda looks like it)
In the plot of optimal locations:
See image below:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.