We were inspired by the simulation presented by the Washington Post, however we found it that it was hard to relate to dots moving randomly in a rectangle. Therefore, we decided to build a simulation that is based on a city grid and reflects the movement of people in an urban environment.
What it does
A simulation of agents in a city such as Berlin that move around between home, work and leisure points, using the subway system and selected streets around each subway station. Agents can infect other people when there are in the same place at the same time. In this way, we are able to model different scenarios such as a reduce public transport service, closure of restaurants or a complete lockdown. Thus, on the one hand people can see the effect of these measures in this simulation and on the other hand it can help to inform policy makers in their difficult decision making process in this time with so much uncertainty.
How we built it
Graph creation: We use the open street maps API and the OSMnx package to create a graph network of subway lines and streets in vicinity to subway stations, we simplify the network to increase the performance of our simulation with random walks. In the end, non-connected components and dead ends are removed to ensure a well connected graph.
Rendering: Responsive web app, using open street maps data to plot city traffic graphs, simulate a SIR model with agent movements on top of the actual city environment (instead of a simple rectangular box), real-time rendering of 10k+ individual agents using WebGL vertex shaders is possible.
Simulation: We run an agent based simulation, with agent movements based on the created graph to create more realistic interactions in urban environments, we select random home, work and leisure points for each agent and model the infections based on a SIR model.
Challenges we ran into
Using a graph network that is meant for routing is hard for simulations purposes, because things like dead ends or not connected parts of the graph can lead to unexpected results of the simulation. It was way harder than expected to simulate thousands of agents in parallel, where each agents has its own behavior in terms of different points it is heading to, which required to solve an all-pairs-shortest-path problem.
Accomplishments that we're proud of
What we learned
- leaflet open street maps
- webgl vertex shader rendering - concurrent web computation using worker threads
- creating a connectivity graph from real map information such as streets and subway lines
- convert a mapping graph to a graph that is useful for a simulation
What's next for Urban Virus
Run more simulation scenarios and compare the effects of different measures. We already have seen interesting effects in comparing the normal simulation to one where 75% of the people stay at home as it decreased the infection rate by a factor of 100. It would be interesting to test how more soft measures influence the infection rate. While this is still a simple simulation and thus not highly accurate, we still think that with a bit more work this could actually be useful to not only stimulate people to take action but also inform policy makers in their decision process.
Furthermore, to make the simulation more realistic, we could include more data such as:
- actual population distribution of Berlin
- movement profiles of real people
- meta information on supermarkets, leisure points, residential areas, work areas
- subway schedule (at the moment we have no real "trains", but people move together from one subway station to the next every 10 minutes)
- other transportation modes