SciML / ModelingToolkit.jl

An acausal modeling framework for automatically parallelized scientific machine learning (SciML) in Julia. A computer algebra system for integrated symbolics for physics-informed machine learning and automated transformations of differential equations
https://mtk.sciml.ai/dev/
Other
1.41k stars 203 forks source link

Feature request: support for discrete-time (function maps, Markov processes) #571

Closed sdwfrost closed 3 years ago

sdwfrost commented 4 years ago

Many ecological and epidemiological models are defined in terms of discrete time. Would it be possible to have these explicitly supported in ModelingToolkit? There are two routes to this, as fair as I can see:

  1. Take your standard ModelingToolkit model code, plus a delta t, and turn the rates into probabilities/proportions as in the following
  2. Write the ModelingToolkit model directly in terms of probabilities/proportions, and generate maps/Markov models directly (ie no need for specifying a time step, transforming parameters, etc.)
ChrisRackauckas commented 4 years ago

Yes, this should get system types so it can get properly supported. https://github.com/epirecipes/sir-julia/blob/master/markdown/markov/markov.md this one is just a RegularJump scheme known as binomial leaping, so that would fall under the ReactionSystem / JumpSystem work where it needs a new regular jumping transformation to then call those tools (we're missing a binomial leap, but currently have adaptive Poisson leaping).

https://github.com/epirecipes/sir-julia/blob/master/markdown/function_map/function_map.md is straightforward and is a surprising omission from the library so far.

Write the ModelingToolkit model directly in terms of probabilities/proportions, and generate maps/Markov models directly (ie no need for specifying a time step, transforming parameters, etc.)

Yes, that should be the ReactionSystem and Catalyst.jl. These other system forms can then be targeted from the same high level.

sdwfrost commented 3 years ago

Hi @ChrisRackauckas, now that the MTK system has been generalized, where do we stand on this? Does there need to be binomial and multinomial leaping added to DiffEqBase for Markov models to be generated?

ChrisRackauckas commented 3 years ago

Now is the right time to do it. It should look almost exactly like ODESystem, except have different lowering (DiscreteProblem). We have a conference paper on MTK due on the 9th, so we need to cram through that, take a breath, and this yes this is now wide open.

ChrisRackauckas commented 3 years ago

https://github.com/SciML/ModelingToolkit.jl/pull/986