Authors

Inspiration

During the Chinese new year, I was stuck at home due to the Covid-19 situation. I saw a video which simulates the virus spreading. However that demo has very limited performance and not able to run as a server.  I decided to create a better simulator.

What it does

I decided to create a production level virus spreading simulator to support following features:

  1. POI based person move behavior: person has the following status "Stay home", "Go Out(to a POI)","Walk around", "Go Home". simulator will use "Activity" to decide which status the person should take.
  2. Improved SIR spreading model: I use a location based spreading model, an infective can infect persons around. each person has a "infective progress" property, which it reaches 1(max value). this person is infected and become an infective.
  3. Map data support:  User can use grey-scale image data to setup person home and POI positions.
  4. CSV export: the raw data of each frame is able to be exported after each run.

person

How I built it

I spent about 1 week to workout the high performance parallel calculating kernel. Then spend 1 week to add the plugin system one by one. (person behavior plugin, virus spreading plugin, render plugin)

Challenges I ran into

High performance computing is always challenging, you need to take care thread concurrency, memory management and user code.  using GPU to accelerate calculation is a good way, however I found it has many restrictions. At last I decide to hold the GPU accelerate for now, because developer may need to learn a lot of GPU calculation rules before they can start develop plugin for this.

Accomplishments that I'm proud of

High performace: the kernel is able to simulate about 70K persons at 7~8 FPS on my laptop (UI rendering off). Easy to integrate: the kernel is a dotnetcore 3.1 library, it supports cross platform and can be easily integrate to other tools. It can also be ported to a webAPI and hosted in docker.

What I learned

Span and Memory is very useful in high performance computing. Stay at home is much safer than go out Hospital beds count is very important

What's next for VirusSimulator

  1. add webAPI  & docker support
  2. supported distrusted computing
  3. add "navigation" to person move behavior
  4. UI improvement

Try It out

Hackathons

Technologies

c#, directx, wpf

Devpost Software Identifier

254955