[Ann] CompetingProcesses.jl sample generalized semi-Markov processes

CompetingClocks is a set of samplers with Gillespie-type algorithms for non-Exponential distributions, also known as distributions with time-varying hazards. This library is meant to help you write frameworks for queuing theory, reliability models, disease simulation, generalized stochastic Petri nets (GSPN), or any simulation that falls into the class of generalized semi-Markov models (GSMP).

It includes:

  • Next reaction algorithm
  • Anderson’s method
  • Optimized direct method
  • First-to-fire

More importantly, it supports variance reduction using common random numbers and importance sampling.


Congrats on the package! How does it compare to JumpProcesses.jl?

Hi Guillaume! What a great question.

JumpProcesses.jl does something very cool because it both represents the mathematical formalism well and provides a high-level user interface to it. I think of this monograph by Anderson and Kurtz, called Stochastic Analysis of Biochemical Systems, that is so clear about how larger simulations are built from jump processes, and I admire how JumpProcesses.jl brings that approach to a user interface.

Two main differences:

  • JumpProcesses.jl has a user interface that includes specification and simulation of processes while CompetingClocks.jl has a user interface based on individual transitions. This library isn’t even close to being as usable as JumpProcesses.jl.

  • JumpProcesses.jl specifies jump rates using hazard rates as functions of parameters and time. CompetingClocks.jl specifies rates using distributions that are Univariate distributions from Distributions.jl.

So CompetingClocks.jl is a lower-level library meant to support more user-oriented frameworks. It’s much less full-featured, but there are a couple of advantages.

  • Some samplers, for some distributions, are faster than those restricted to using hazard rates instead of other ways to sample.

  • It is possible to sample from distributions that include discontinuities, such as mixtures with delta functions. I kept running into these in previous disease work.

  • The simulation can have an infinite number of individual counting processes, effectively, because CompetingClocks.jl only needs to know about the currently-enabled transitions, which do have to be finite.

I think of this library as support to frameworks for queuing theory, disease simulation, reinforcement learning, whatever, that wants to do do variance reduction, importance sampling, Hamiltonian Monte Carlo, and autodifferentiation. That’s what we’re working towards, being a piece of the puzzle.

What do you think? Do you think atomic hazards matter? Or that JumpProcesses can do it all?

Hope All Is Well,

1 Like

Hi, @adolgert the link for CompetingProcesses.jl above displayed seems to be dead.

Haha. Thank you @VivMendes for the correction. I got the name of my own package wrong. We had to rename it just before it got posted to JuliaHub. It’s fixed, I hope!