Closed benmaier closed 4 years ago
for both classes, construct events from processes that look like this:
( acting_compartments, rate_expression, dy)
where acting_compartments
is a list of compartment indices that will cause this reaction, dy
is an N_compartments
-long vector that contains the compartment-count changes for this process and rate_expression
is either a constant or a function of t and y.
The rate_expression
s will be converted to functions of t and y if any of them is a function. In this case, set a flag that tells the object that it has functional rates. In this case, the numerical dydt will be constructed in a different way, i.e. by iterating through events and adding all dy
s as multiplied by the rate.
If the model has no functional rates, the simulation algorithm becomes the classical Gillespie algorithm. Otherwise, the integral to obtain the time leap tau has to be solved numerically.
This would fix #3, as well.
On second thought, leave DeterministicEpiModel
as it is. Instead, construct the new NumericEpiModel
from scratch. Also, think about basing SymbolicEpiModel
on NumericEpiModel
. Or think about doing both models as two separate ways.
fixed in 7e6e13a and previous by the introduction of NumericEpiModel
In this case it's clear that both
SymbolicEpiModel
as well asDeterministicEpiModel
are mean-field models. It should be possible to integrate both as well as to simulate both using Gillespie's algorithm. The only difference should be that one is more comfortable regarding checks and analytical treatment while the other is faster numerically.