Hey folks,
I’m doing a PhD in Electrical and Computer Engineering and my research focus is on Agent Based Models. I’m usually applying the principles of ABM to pandemic disease outbreaks but to get the old funding train rolling I need to branch out every now and then.
I put a quick prototype together using Unity along with CityEngine and OpenStreetMap. The video (bottom of post) is of afternoon/evening traffic. Sorry, there’s no audio yet, that’s being put in tomorrow.
Basic explanation:
We have sanitized cell data we received from MTS (my province’s formerly government owned phone company) that gives us a device id (it’s been cleaned so we can’t find out who owned the phone) and what cell tower and sector that device is using every fifteen minutes or so (unless the device was turned off). We’ve been using the term trajectory for the cell data (one device and all it’s locations/timestamps = one trajectory). Using this data I created agents that chase a target around the city, the target’s location is determined by the cell data.
The agents themselves are pretty dumb in the way they chase the target around, when they come to an intersection they decide which node in the street graph will get them closest to the target and go that way. Because it’s a greedy decision agents can get stuck in local minima from time to time. This is going to be remedied by implementing a pathfinding component for the agents so they no longer get stuck.
There are eight trajectories running in the video with around 256 agents each. There’s also a group of another 256 agents that randomly walks the graph without a target as background noise.
Part of the reason I chose to do this in Unity is that I wanted to show my supervisor/labmates that using a game engine could drastically cut down on our development time of new models. Unsurprisingly my strategy worked
As for future work for this thing (needs a lot of love), I’ll be sticking in actual pathfinding code and updating the street graph so that it contains proper directionality as well as speedlimits and capacity (number of lanes).
When I’m satisfied with the traffic aspects of the model I’ll be integratingSIR models so I can keep using the sim for my main line of research.
Anyway, just thought I’d show you guys what I’ve been up to the last week or so (most of that time was fighting with CityEngine and OpenStreetMap). If anyone is interested I can give a bit more detail about the pipeline from OpenStreetMap to Unity, pretty simple but time consuming.
I’m a bit over caffeinated right now so if anything didn’t make sense just let me know and I’ll clarify.
Thanks for reading!
P.S. You may notice there’s no road mesh. That’s because somewhere in the map there’s something causing CityEngine to throw an error on model export. I’m pretty sure I know what’s causing it but I have to inspect the model in CE and I didn’t have time, so if you see vehicles driving across the rivers on nothing that’s why.