Closed evadelmas closed 3 years ago
So when we talked it seemed like this is an issue caused by the frequency of the rewiring. The current default is that it only occurs following an extinction but, as we discussed, it makes more sense for the ADBM rewiring to be called more often. This leaves two options:
We rewire at some set time interval t
using the PeriodicCallback
function in the diffEq package.
We rewire based on the magnitude of the change in biomass over time using ContinuousCallback
. This would require that we define some measure of the change in the system (e.g. euclidean distance) and the threshold at which the rewiring should occur.
Both methods have their benefits. The time based rewiring will be simple to implement and computationally cheap, though the value of the time interval may need to be set very small to prevent the jumps in food web structure. On the other hand the biomass based method will be accurate but may be unfeasible as we need to compare the current state to the previous one at each integration step.
Overall I'm tending towards the second method as I think that the value of t
may end up being very small, though we may need to check each one to see what works. I'll have a play around and see what I get
@CleggTom I think another idea is to use Gillespie algorithm to decide when we rewire. It's better than to keep track of past states of the system, in addition to being a generally accepted method of doing this sort of events.
@tpoisot I'm not familiar with the Gillespie algorithm, how would it work in this case?
Also interested in the Gillespie algorithm as I haven’t heard of this.
The other option is to implement both time interval and change in biomass methods and give people the option.
At the very least it’s probably a good idea to have a TRUE/FALSE setting to enable continuous rewiring or not. i.e. keep the current rewiring after extinction, but give users the option to enable more frequent rewiring.
http://docs.juliadiffeq.org/latest/tutorials/discrete_stochastic_example.html describes adding Gillespie style jumps to a set of diffeqs
Just to add that time-interval-based rewiring, with t as an adjustable parameter, could be useful for a project idea I have been discussing with Andrew.
I agree that we should give users the option to chose among different rewiring frequencies, as it reflects different ecological hypotheses. We could either
rewire_method
(that allows to chose between different rewiring models) from :ADBM / :stan / :Gilljam / :none
to :ADBM_interval / :ADBM_gillespie / :ADBM_extinction / :stan / :Gilljam / :none
or ADBM_rewiring_frequency = :interval / :gillespie / :onextinction
@evadelmas I like these options. With the rewire_method
formulation, I think we need a way to specify what the interval would be for :ADBM_interval
.
So maybe the ADBM_rewiring_frequency
formulation is easier, with :interval
being an integer equal to how often (number of timesteps) between rewiring updates.
Then presumably any value of ADBM_rewiring_frequency
is ignored if rewire_method
is not equal to :ADBM
.
When using rewiring with the ADBM model, the whole web is rewired following extinction events, independently of the identity of the extinct species.
We could add a parameter (
adbm_directlinks = true / false
) to chose whether we want only species that are directly affected by the extinction -- because they have lost a direct resource or consumer (adbm_directlinks = true
), or the whole web (adbm_directlinks = false
) to be subject to rewiring.