GCDM: Part 1 - Isolated patches and constant production
Hello everyone, here is (at long last) my attempt to draw a diffusion model for compounds,
that operates across the patches, and finally allows for them to evolve over time.
It’s been on my mind for a while, but I haven’t been able to get everything through,
hence the long time before this post. I’ve still not wrapped everything up,
but I believe it is about time I just present intermediate findings and proposals.
With that said, let’s start with the presentation of the first part of this model!
We’ll begin by a very simple (and inaccurate) model of isolated patches,
which will nonetheless set the ground for more complex models afterwards.
We’ll also introduce a first essential hypothesis of constant production.
Math warning
This model will most likely use advanced mathematics (matrices, calculus). Some proofs will be essential to the good functioning of the implementation! So feel free to ask if you don’t understand some elements, especially for this first part: things will get more complicated afterwards, so I did not dwelve too much into maths details here, for the sake of clarity. I’ll probably detail it a bit more for future parts though, especially when very situational properties will be used.
Basics
Let’s start with what’s pretty obvious: this model will account for compounds (no kidding?),
with two perspectives. First, a global perspective, that is the amount of compounds across the whole planet. This amount should of course be varying over time. For a compound C :
- N_{C}(t+dt) = N_{C}(t) + production_{C}(t) \times dt (1)
With N_{C}(t) being the total amount of compound at instant t, production_{C}(t) the production (per time unit) at this time (relative production; it can actually be negative if there is more consumption). Production can include cell production/consumption, but also other phenomenons like non-organic reactions, or compounds escaping the atmosphere. This allows for models of varying complexity and accuracy, depending on the trade-off we want to go for.
The second perspective is a more local one, tied to the patches: each patch P would have a definite amount of the compound N_{P, C}(t) and a (constant!) local production production_{P, C}(t).
Under the assumption that the world amounts to the set of patches, the two perspectives are linked by the following relationships:
- N_{C}(t) = \sum_P N_{P,C}(t)
- production_{C}(t) = \sum_P production_{P,C}(t)
If equation (1) is to be adapted to patches, we now have to consider local exchanges between patches:
- N_{P,C}(t+dt) = N_{P,C}(t) + (production_{P,C}(t) + \sum_{P'} exchanged_{P'\rightarrow P, C}(t))\times dt (2)
where exchanged_{P'\rightarrow P, C}(t) is the (relative) exchanged amount of C
from patch P' to P at time t.
The isolated patches model (IPM)
However, this can be simplified by assuming that the exchange rate between patches is constant (Isolated Patches Hypothesis, or IPH). The only situation where this is plausible is when this exchange rate is zero (else the resource can always get depleted, preventing exchange). This amounts to saying that the patches are isolated regarding to compounds.
While not a very accurate model (why would bacteria migrate but not compounds?), this is yet a very simple one: under this assumption, our local formula (2) becomes much simpler and similar to our global one (1).
- N_{P,C}(t+dt) = N_{P,C}(t) + production_{P,C}(t) \times dt (2-IPM)
Generational shift
Now is time to say that we actually don’t truly care about all this continuous stuff: all that interests us is the compound distribution during gameplay phases (unless we want to account for these changes in auto-evo, but this sounds like a pipe dream). We thus want to shift to a discrete perspective. The most straight-forward way to do it is of course integration:
- N_{P,C}(t_{n+1}) = N_{P,C}(t_n) +\int_{t'=t_n}^{t_{n+1}} \delta N_{P,C}(t')dt' (3)
(\delta N being a generic notation for local compound amount changes, regardless of the chosen model - IPM or full one).
Obviously, having to deal with unknown integrals is not ideal: computers need to use costly approximation methods, so this is definitely something we want to avoid. Thus, we are going to need further assumptions.
Constant Production Hypothesis (CPH)
Let’s first tackle the variation of production, which is a problem in both models: local production is essentially dependent on two things:
- production from cells;
- and production from non-organic sources.
Production from cells
Production from cells is essentially dependent on the amount of cells. While the concentration of compounds can play a role (e.g. if cells don’t get enough of it), we may consider that the auto-evo ensured that cells aren’t consuming more compounds than there is! This means that cells consume/produce as much compounds as they can:
- cells\_production(t) = N_{cells}(t) \times CELL\_PRODUCTION
NB: this formula is assuming a single cell species, but it can be easily adapted for more,
by summing per-species productions.
As explained above, CELL\_PRODUCTION is a species-defined constant, so we only care about variations of the number of cells. Also, under current implementation, auto-evo algorithm computes discrete species population changes. We may thus follow suit with a Population Jump Hypothesis (PJH), meaning that population is constant during time skips. Adapting previous formula, we thus got a generation-constant production from cells: at generation n
- cells\_production_n = N_{cells}(t_n) \times CELL\_PRODUCTION
Non-organic production
Non-organic “production” can however be more complicated. We may split it into two categories:
- external interactions;
- chemical reactions.
External interactions
External interactions cover cases where the compounds enters/exit from elsewhere than the patches, e.g. atoms exiting the atmosphere. These are likely small enough to be neglected. Furthermore, as we’ll see later, the atmosphere (or other) can be modeled as a specific patch in our model. For now, we’ll consider an Isolated World Hypothesis (IWH), meaning that there is no interaction with external elements.
Chemical reactions
The second category, the one of chemical reactions, is more complicated: reactions usually depend on both the amount of reactives and products (given that they often work two-ways, and thus reach a balance).
Can we discard these? Probably not, as some compounds such as iron come from dissolution reactions. However, dissolution, whose most important factor is the surface between solid and solvant,
is a specific exception to the equilibrium rule. Of course, saturation may cause this exposed surface to shrink as it get obstructed by the solved product, but saturation requires either a tremendous amount of compounds or heterogeneous patches. The latter is specifically excluded by our patch definition, and the former is extremely unlikely, if not outright impossible given the huge volume of the patches. Thus, dissolution production is only dependent on the total surface of the dissolving element. Assuming that this surface is constant (which is probably a good approximation for things like iron, that dissolve from the “walls” of our patches), dissolution can be considered a constant production.
What about other reactions? Well, I fail to see much other reactions that would produce our current compounds, so I believe we can safely make a Dissolution-Only Hypothesis (DOH), meaning that chemical reactions yield a constant production.
Combining hypotheses
Combining the three hypotheses presented in this section, we can thus assume a Constant Production Hypothesis (CPH), summarized as (PJH + IWH + DOH \Rightarrow CPH). In other words, during generation n, production_{P,C}(t) = production_{P,C}(t_n).
Discrete Isolated Patches Model (DIPM)
This brings us to our first computationally friendly model: the Discrete Isolated Patches Model (DIPM). This model combines the Isolated Patches Hypothesis and the Constant Production Hypothesis, i.e. (DIPM = IPH + CPH).
Adapting our discrete formula of compound amount evolution (2-IPM), we have the following, cheap-to-compute formula:
- N_{P,C}(t_{n+1}) = N_{P,C}(t_n) + production_{P,C}(t_n) \times \Delta t (2-DIPM)
with \Delta t the duration of the time skip, i.e. 1 My under current implementation.
Discussion
As stated above, this model is very inaccurate, as compounds have no reason not to flow across patches when microbes do. However, the Constant Production Hypothesis (CPH) is very important for the latter parts, as it simplifies computations a lot, while being fairly reasonable (at least, I hope I’ve convinced you of it). For this very reason, if you wish to cast doubts on what is proposed with regards to this hypothesis, please do so!
The next part will focus on removing the Isolated Patches Hypothesis (IPH). Stay tuned!
Thank you for reading, and enjoy your day!