Best abstraction for modeling changes in parameters and/or states in a dynamical system?

I’d like to get some advice on the best abstraction for dynamical systems where the parameters and/or states of the system change at discrete time intervals. As a motivating example, I’ll consider a simple compartmental model of a disease spreading through a population, in which there are susceptible, infectious, and recovered individuals. The model is described by the following system of ordinary differential equations:

dS/dt = -\beta S I \\ dI/dt = \beta S I - \gamma I \\ dR/dt = \gamma I

where S, I, and R are the numbers of susceptible, infectious, and recovered individuals, respectively, and \beta and \gamma are parameters of the model. The system is initialized with initial values for S, I, and R, at time t_1 and the parameters \beta and \gamma are fixed throughout the simulation.

Now I want to consider vaccination of susceptible individuals that begins at time t_2, modeled in different ways. Firstly, I could consider a vaccination rate that is constant for t \geq t_2, such that the above system now becomes:

dS/dt = -\beta S I - \nu S\\ dI/dt = \beta S I - \gamma I \\ dR/dt = \gamma I + \nu S

This would involve composing my original model with this new one, involving adding a new transition at time t_2.

Alternatively, I could consider a vaccination rate throughout the time interval [t_1, t_3], such that the above system becomes:

dS/dt = -\beta S I - \nu(t) S\\ dI/dt = \beta S I - \gamma I \\ dR/dt = \gamma I + \nu(t) S

Now, to model the time-varying vaccination, I need to change \nu(t) from 0 to a constant value, (say \nu_0) at time t_2. I appreciate that I don’t need to compose systems here, if I’m prepared to have models with time-varying parameters, but’s let assume I’d like to think about implementing the above by composing one model with \nu=0 with another where \nu=\nu_0 at time t_2.

Alternatively, I could consider a different type of vaccination scenario where a fixed proportion of susceptible individuals are vaccinated at time t_2, then the model proceeds as before. My system remains the same, but I have a discontinuity in my states at time t_2, where S(t_2) \rightarrow S(t_2) - \delta S(t_2) and R(t_2) \rightarrow R(t_2) + \delta S(t_2), where \delta is the proportion of susceptible individuals vaccinated at time t_2.

What’s a reasonable categorical abstraction that captures both discontinuous changes in parameters and/or states for the above system?

I’m assuming that it helps if we assume that each period we consider is non-overlapping. What if my infectivity rate also changes e.g. from \beta_1 to \beta_2 at time t_4? The number of intervals where the parameters are contant will now depend on the value of t_4.

1 Like

So, it seems like the real question here isn’t necessarily about discontinuous changes, it’s more simply about dynamical systems which are specified by a function of time, rather than by a differential equation.

This is an interesting question. Philosophically, this feels very “unphysical” to me. That is, physical systems consist of a state space which evolves according to some rules; their state is never simply specified as a function of a clock (except after we solve for the evolution).

But of course, this is a very natural thing to want in a general program which is supposed to handle dynamical systems.

Is that an accurate summary of your question? If so, here are some thoughts.

The most direct approach here would be to drop down to Willems-style behavioral systems, and simply talk about a system which only has one behavior, namely to act as the specified function of time. And I guess more applicably, this makes sense in a “time-dependent differential-algebraic equation” paradigm of system modeling. However, we shouldn’t need to solve DAEs in order to implement this, because there is a natural input-output factorization that you are already using.

Perhaps the thing to do is to consider lens-based systems where the output is allowed to vary based on time. That is, have a system defined by

  • Input space I and output space O
  • State space X
  • Update v \colon X \times I \to T X
  • Output f \colon X \times \mathbb{R} \to O

And if we have the output depend on \mathbb{R}, it’s no big change to also make the update depend on \mathbb{R}, e.g. v \colon X \times I \times \mathbb{R} \to T X. Then I think that this should just be lenses in the coKleisli category of the comonad - \times \mathbb{R}.

I’ll leave it there for now, but feel free to ask more questions if that didn’t make sense.

Slightly more on this: for reference, any time you have a monoid M in a Cartesian category then - \times M is a monad, and any time you have a comonoid C, - \times C is a comonad; note that all objects in a Cartesian category have a natural comonoid structure given by diagonal X \to X \times X.

Also: welcome Simon! Thanks for putting this question out there, I think that this is a very natural ask for a categorical modeling framework, and I don’t think we had a good answer for this before (though maybe @david.jaz or @mattecapu had already thought of something).