JuliaDynamics / Agents.jl

Agent-based modeling framework in Julia
https://juliadynamics.github.io/Agents.jl/stable/
MIT License
725 stars 117 forks source link

Automated PDE discovery #345

Open Libbum opened 3 years ago

Libbum commented 3 years ago

Here's an interesting discussion.

The researchers manually generate a PDE system from their ABM. The system is large, so they get a massive speed up for a decent approximation of the ABM output.

I think we can leverage ModelingToolkit and the Universal DE approaches of DiffEqFlux to essentially automate this process.

idontgetoutmuch commented 3 years ago

If this could be automated that would be great - the tumour models I am working on take many minutes to evolve

Libbum commented 3 years ago

I'm confident there's a process to this, that may require users to still fiddle around a bit, but would not involve the manual generation of PDEs from scratch. Will certainly be of benefit for many hybrid ABM models.

@idontgetoutmuch: are the models you're using similar to the ones in the video? When I get time for this I'd like to have a simple enough test system with a straightforward ABM and an already 'discovered' system of PDEs. I could work with the example in the video, but if you have a better choice that would be great!

idontgetoutmuch commented 3 years ago

I have a model in matlab which I might translate into julia - I haven't really thought this through yet and would need to discuss it with my collaborator. Let me think about this a bit more.

Libbum commented 3 years ago

Certainly no rush. I'm not sure when I'd be able to start approaching this myself.

Side note: I've been following your haskell blog for years—glad to see you in Julia-land as well!

idontgetoutmuch commented 3 years ago

@Libbum - I am back working on this now with a student - our first step is to estimate parameters for an infection model using Agents.jl.

00krishna commented 2 years ago

Hey folks, I was wondering about this question as well--converting ABMs to PDEs. Actually, the first question is more a reference request. Does anyone know a good reference book or articles on how to convert ABMs to PDEs? I have seen the method applied in a bunch of articles, but I have never seen a textbook explain how to do this. Any suggestions would be appreciated.

In terms of using something like ModelingToolkit, I was trying to think about how this could be done. Perhaps the most obvious way would be to define "rules" in MTK that would become the basis for de-discretizing the ABM. I am not sure if there is a better word than "de-discretize," meaning to make continuous.

MTK also has the associated MethodOfLines.jl package for converting symbolically written PDEs into finite difference approximations. Since converting from an ABM to a PDE is basically the reverse of finite differences, I wonder if we might be able to reverse the rules in MethodOfLines to implement the de-discretize methods. I understand that it would be much harder than simply reversing the order of steps in MethodOfLines, but it might be a starting point.

Finally, I am also wondering whether something like the NeuralPDE approach or surrogates might work? Note that I have very little experience with NeuralPDEs, but I do have some experience with NeuralODEs. So it is possible to run a large number of simulations and collect the essential data for the PDE, such as the density information, or summary statistics. Then a user could feed this into an automated discovery system. If I remember correctly, NeuralPDEs requires users to specify the PDE, while NeuralODEs do not. So there might be a way forward there as well.

Finally, users could also just skip the PDE and train a neural network to emulate the behavior of the ABM system. This is similar to a Physics Informed Neural Network (PINN) I believe. A user would train with a loss function where the network predicts the output values of the ABM model. The final output would be a neural network that could theoretically run faster than a PDE simulation. Of course, the user would sacrifice some of the nice analysis that PDEs allow, such as von Neumann stability analysis, etc.

These are just a few ideas. If anyone has any additional suggestions, please pass them along.

Datseris commented 2 years ago

paper relevant to issue cited in Slack: https://royalsocietypublishing.org/doi/full/10.1098/rsif.2020.0987

image