PopComp by Andre Costopoulos 2020
Licence: DWYWWI (Do whatever you want with it)
I use Netlogo to build a simple environmental change and population expansion and diffusion model. Patches have a carrying capacity and can host two kinds of populations (APop and BPop). Each time step, the carrying capacity of each patch has a given probability of increasing or decreasing up to a maximum proportion.
Users can set the roughness of the initial environment by assigning a probability that a patch will vary from the maximum carrying capacity for the environment, and the degree by which patches vary. They can set the probability that a patch will undergo carrying capacity change in a time step, and the maximum amplitude of that change.
Users can set the growth rate, carrying capacity multiplier, diffusion rate, network radius, and minimum number of individuals in a viable network for each of APop and BPop, as well as the initial probability that a patch will be populated.
Each time step, APop and BPop grow at a specified rate. If the combined population of APop and BPop on a patch reach carrying capacity, both populations search neighbouring patches within a given network radius for available carrying capacity and move accordingly. I refer to this as overflow.
Independent of spread through overflow, APop and BPop also have diffusion rates. Even if a patch is not at maximum carrying capacity, a proportion of APop and BPop will search for available carrying capacity within their network radius and move accordingly.
At the end of a time step, any population over the carrying capacity in a given patch is removed. APop and BPop can use carrying capacity differently through a carrying capacity multiplier. For example, a carrying capacity multiplier of 2 for APop means that APop is multiplied by 2 for purposes of carrying capacity calculations. In other words, APop can sustain half the population that BPop could on the same patch.
Additionally, the population of any patch whose APop or BPop cannot form a minimum viable network (as specified by the user) within the network radius is removed. If the user specified that the minimum viable network for APop is 50, and that the network radius is 3, any patch whose APop cannot connect with 50 APop (including itself) within a 3 patch radius will be removed.
Users can set the maximum duration of a run in time steps, or specify a set of population stability conditions that will end it. Users can define a range of variation of BPop proportion over a number of time steps that will end the run. A run always ends when BPop proportion reaches 0 or exceeds 99%.
When a run begins, there is a two second trumpet sound. A synthesizer voice note indicates the proportion of BPop in the overall population. The pitch increases as BPop proportion increases. An underlying (slightly lower volume) flute note indicates the proportion of patches in which BPop are a majority of the population, showing the spatial extent of BPop areas. The pitch increases as the spatial extent of BPop increases. A one second tubular bell note sounds when a period of population stability ends. The longer the period of stability relative to the user-defined maximum, the higher the pitch. The soundscape has a bit of a delay as the simulation progresses.
The default display shows patches with no population as black. A red component shows APop and a blue component shows BPop. Patches in which both APop and BPop are present will show a proportional shade of purple.
An alternative display shows the carrying capacity a patch as a green component. In this mode, APop will show as amber to gold, and BPop will show as light turquoise to deep blue.