Ecology
Ecology systems.
They cover population growth, predation, competition, food webs, succession, grazing, and neutral communities.
AbundanceElement(label, *, x=0.01, age=0.0, threshold=0.001, space=None)
Bases: Element
Species of an ecosystem with its relative abundance and its age.
It goes extinct below a threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the species or of the group of species. |
required |
x
|
Annotated[float | Array, closed_open(0, oo)]
|
The relative abundance. |
0.01
|
age
|
Annotated[float | Array, closed_open(0, oo)]
|
The number of steps since the species appeared. |
0.0
|
threshold
|
Annotated[float | Array, closed_open(0, oo)]
|
The abundance below which the species goes extinct. |
0.001
|
space
|
BaseSpace | None
|
The network whose nodes hold one species each, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import AbundanceElement
>>> AbundanceElement('species').threshold
0.001
Source code in src/skcomplex/systems/biology/ecology/_sequential.py
61 62 63 64 65 66 67 68 69 70 71 72 73 | |
AgentBasedLotkaVolterraSystem(width=30, height=30, *, prey=300, predators=60, birth=0.2, conversion=0.5, death=0.1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Prey and predators that walk on a grid, whose numbers cycle.
Their numbers cycle like the Lotka-Volterra equations.
Prey give birth only in cells they do not share with other prey, which limits their density, and predators eat prey
they meet and breed after a meal. Demographic noise makes the cycles irregular and can end them by extinction. The
system has the groups prey and predators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
The number of columns of the torus. |
30
|
height
|
int
|
The number of rows of the torus. |
30
|
prey
|
int
|
The initial number of prey. |
300
|
predators
|
int
|
The initial number of predators. |
60
|
birth
|
float
|
The probability that a prey gives birth at every step. |
0.2
|
conversion
|
float
|
The probability that a predator breeds after eating a prey. |
0.5
|
death
|
float
|
The probability that a predator dies at every step. |
0.1
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import AgentBasedLotkaVolterraSystem
>>> system = AgentBasedLotkaVolterraSystem(10, 10, prey=50, predators=5).prepare().system_
>>> [group.size for group in system.elements]
[50, 5]
Source code in src/skcomplex/systems/biology/ecology/_agent_predation.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
ColonyCellElement(label, *, values=None, size=None, space=None, on=None)
Bases: Element
Cell of a colony, whose values hold the fluxes of its network, drawn as an image of its growth flux.
Examples:
>>> from skcomplex.systems.biology.ecology import ColonyCellElement
>>> ColonyCellElement('cells', values={'v_grow': 0.0}).values
{'v_grow': 0.0}
Source code in src/skcomplex/core/components/elements/_element.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
CometsSystem(shape=(50, 50), *, box=0.02, inoculum=3e-07, glucose=5.0, plate_glucose=0.0088, biomass_diffusion=3e-10, glucose_diffusion=5e-06, vmax=10.0, km=0.01, interval=STEP, label='system', solver='auto', backend='auto')
Bases: BaseSystem
An expanding colony of the E. coli core system on a lattice.
It needs the extra metabolism.
Run with IMEXEulerSolver, every step is a growth step and then a diffusion step, the two steps that COMETS
alternates (Raman 2021, Section 11.1.3.4). The growth step solves the program of every site that holds biomass and
applies the update rules of Harcombe et al. (2014). The diffusion step solves one implicit Euler system, where
Harcombe et al. use an alternating direction implicit scheme. Biomass and glucose both diffuse, as in Harcombe et
al., while the short description of Raman names metabolites only.
The states are gDW per L and mM of the medium under a box. A site whose program has no solution has zero fluxes, which happens when its glucose cannot pay for the maintenance flux of the network.
Harcombe et al. in what follows is the main text of Harcombe et al. (2014), and the source of each default is named under its argument. The time step of 0.1 h of the registered run is from its In silico experiments. The length of the registered run keeps it within the budget of the gallery and has no source.
These choices have no source in that text. The periodic edges are those of LatticeSpace, since the text does not
state the outer boundary. The volume under a box is the amount of glucose under it over the concentration of the
medium, since the text defers the volume to its supplement, which was not read. The molar mass of glucose is 180.16
g/mol.
The network is the E. coli core system, where Harcombe et al. use iJO1366. The death rate of 1% per step, the largest colony height of 200 um, and the oxygen of 0.25 mmol/cm^2 of Harcombe et al. are left out, so the biomass of a box has no upper limit and oxygen is limited only by the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
tuple[int, int]
|
The number of boxes along each side, by default from Harcombe et al., Colony expansion comparisons. |
(50, 50)
|
box
|
float
|
The side of a box in cm, by default from Harcombe et al., Colony expansion comparisons. |
0.02
|
inoculum
|
float
|
The initial biomass of the central box in g, by default from Harcombe et al., Colony expansion comparisons. |
3e-07
|
glucose
|
float
|
The glucose of the medium in g/L, by default from Harcombe et al., In silico experiments. |
5.0
|
plate_glucose
|
float
|
The glucose of the medium per area of the plate in mmol/cm^2, by default from Harcombe et al., In silico experiments. |
0.0088
|
biomass_diffusion
|
float
|
The diffusion coefficient of the biomass in cm^2/s, by default the value for colonies from Harcombe et al., Table 1. |
3e-10
|
glucose_diffusion
|
float
|
The diffusion coefficient of the glucose in cm^2/s, by default from Harcombe et al., Table 1. |
5e-06
|
vmax
|
float
|
The largest glucose uptake in mmol/g/h, by default from Harcombe et al., Table 1. |
10.0
|
km
|
float
|
The half-saturation concentration of glucose in mM, by default from Harcombe et al., Table 1. |
0.01
|
interval
|
float
|
The time in h over which the glucose of a site must last, by default the time step, the bound of Raman (2021, Section 9.6). |
STEP
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
MissingExtraError
|
The extra is not installed. |
Examples:
>>> from skcomplex.systems.biology.ecology import CometsSystem
>>> [element.label for element in CometsSystem(shape=(2, 2)).prepare().system_.elements]
['cells', 'biomass', 'glucose']
Source code in src/skcomplex/systems/biology/ecology/_comets.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
CommunityFBASystem(knockouts=('ICDHyr', 'NH4t'), *, abundances=(0.5, 0.5), exchanges=None, common_rate=False, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Two members of the E. coli core system that share a medium.
It needs the extra metabolism.
The programs of the members merge through a medium, and the joint program minimises the growth weighted by the
abundances with its sign changed, recorded as medium.objective_0 (Raman 2021, Section 11.1.3). By default one
member lacks isocitrate dehydrogenase and takes up 2-oxoglutarate, and the other lacks ammonium transport and takes
up glutamate, each from what the other secretes, so neither grows alone, and together both grow.
community_growth gives SteadyCom and the cooperative trade-off of the same members. The pair is an illustration
found on the E. coli core system: the consortium of Raman (Section 11.1.3.6) has four mutants that need amino
acids, whose synthesis the core system does not hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
knockouts
|
Sequence[str]
|
The reaction to close in each member, or the empty string for none. |
('ICDHyr', 'NH4t')
|
abundances
|
Sequence[float]
|
The abundance of each member. |
(0.5, 0.5)
|
exchanges
|
Mapping[str, float] | None
|
The lower bound of the net exchange of the community, by reaction, or |
None
|
common_rate
|
bool
|
Whether the members grow at one specific rate, as in community FBA, rather than each at its own, as in joint FBA. |
False
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
MissingExtraError
|
The extra is not installed. |
Examples:
>>> from skcomplex.systems.biology.ecology import CommunityFBASystem
>>> trajectory = CommunityFBASystem().prepare().simulate(until=0.0)
>>> round(-float(trajectory.get_values('medium.objective_0')[0]), 3)
0.862
Source code in src/skcomplex/systems/biology/ecology/_community_fba.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
CompetitionInteraction(label, *, first, second, r1=1.0, r2=1.0, K1=100.0, K2=100.0, alpha12=0.5, alpha21=0.5)
Bases: Interaction
Lotka-Volterra competition of two species for the same resources.
Each species grows logistically, and the other species fills its carrying capacity in proportion to a competition
coefficient, dn1/dt = r1 n1 (1 - (n1 + alpha12 n2) / K1) and dn2/dt = r2 n2 (1 - (n2 + alpha21 n1) / K2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
first
|
Role
|
The path of the first population. |
required |
second
|
Role
|
The path of the second population. |
required |
r1
|
Annotated[float, closed_open(0, oo)]
|
The growth rate of the first population. |
1.0
|
r2
|
Annotated[float, closed_open(0, oo)]
|
The growth rate of the second population. |
1.0
|
K1
|
Annotated[float, open(0, oo)]
|
The carrying capacity of the first population. |
100.0
|
K2
|
Annotated[float, open(0, oo)]
|
The carrying capacity of the second population. |
100.0
|
alpha12
|
Annotated[float, closed_open(0, oo)]
|
The effect of one member of the second population on the first, relative to one of its own. |
0.5
|
alpha21
|
Annotated[float, closed_open(0, oo)]
|
The effect of one member of the first population on the second, relative to one of its own. |
0.5
|
Examples:
>>> from skcomplex.systems.biology.ecology import CompetitionInteraction
>>> CompetitionInteraction('competition', first='deer', second='elk', alpha12=0.5).alpha12
0.5
Source code in src/skcomplex/systems/biology/ecology/_communities.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
CompetitionSystem(first=10.0, second=10.0, *, r1=1.0, r2=0.8, K1=100.0, K2=80.0, alpha12=0.5, alpha21=0.6, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Two species that compete for the same resources.
They coexist or exclude each other.
The species coexist at n1 = (K1 - alpha12 K2) / (1 - alpha12 alpha21) and n2 = (K2 - alpha21 K1) / (1 - alpha12
alpha21) when both are positive and alpha12 alpha21 < 1. Otherwise one species excludes the other. The system has
the populations first and second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
float
|
The initial size of the first population. |
10.0
|
second
|
float
|
The initial size of the second population. |
10.0
|
r1
|
float
|
The growth rate of the first population. |
1.0
|
r2
|
float
|
The growth rate of the second population. |
0.8
|
K1
|
float
|
The carrying capacity of the first population. |
100.0
|
K2
|
float
|
The carrying capacity of the second population. |
80.0
|
alpha12
|
float
|
The effect of one member of the second population on the first, relative to one of its own. |
0.5
|
alpha21
|
float
|
The effect of one member of the first population on the second, relative to one of its own. |
0.6
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import CompetitionSystem
>>> CompetitionSystem(alpha12=0.2).prepare().system_.interactions[0].alpha12
0.2
Source code in src/skcomplex/systems/biology/ecology/_communities.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
ConsumerElement(label, *, N=0.1, e=1.0, m=1.0, size=None)
Bases: Element
Consumer species that grows on the energy it takes from resources.
It needs a maintenance energy to persist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the species or of the group of species. |
required |
N
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The initial population size. |
0.1
|
e
|
Annotated[float | ArrayLike, open(0, oo)]
|
The efficiency that converts the energy taken in into growth. |
1.0
|
m
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The maintenance energy, the intake at which the population neither grows nor declines. |
1.0
|
size
|
int | None
|
The number of species, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import ConsumerElement
>>> ConsumerElement('consumers', m=0.5).m
0.5
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
59 60 61 62 63 64 65 66 67 68 69 70 71 | |
ConsumerGrowthInteraction(label, *, consumers, resources, c=((1.0,),), kind='substitutable', n=-10.0)
Bases: ConsumptionInteraction
Growth of consumers on the resources they take up, minus their maintenance.
On substitutable resources, dN_i/dt = e_i N_i (sum_b w_b c_ib R_b - m_i). On essential resources, dN_i/dt =
N_i (g_i - m_i) with g_i = (sum_b (c_ib R_b)^n)^(1/n).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
consumers
|
Role
|
The path of the group of consumers. |
required |
resources
|
Role
|
The path of the group of resources. |
required |
c
|
Sequence[Sequence[float]]
|
The uptake rates, one row per consumer and one column per resource. |
((1.0,),)
|
kind
|
str
|
|
'substitutable'
|
n
|
float
|
The exponent of the growth on essential resources, below -1. |
-10.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import ConsumerGrowthInteraction
>>> ConsumerGrowthInteraction('growth', consumers='consumers', resources='resources').c
((1.0,),)
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
ConsumerResourceSystem(consumers=None, resources=None, *, c=UPTAKE, m=1.0, e=1.0, w=1.0, r=1.0, K=CAPACITIES, kappa=CAPACITIES, omega=1.0, supply='logistic', kind='substitutable', n=-10.0, v=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Consumer species that compete only through the resources they take up.
It follows MacArthur's niche theory.
The 'logistic' supply of substitutable resources is MacArthur's consumer-resource model, dN_i/dt = e_i N_i
(sum_b w_b c_ib R_b - m_i) and dR_a/dt = r_a R_a (K_a - R_a) / K_a - sum_j c_ja N_j R_a. The 'chemostat' supply
kappa_a - omega_a R_a models nutrients that flow in from outside, and essential resources limit growth jointly
through (sum_b (c_ib R_b)^n)^(1/n), consumed by the stoichiometry v. At most as many consumers as resources
coexist, at the point where their zero net growth isoclines g_i(R) = m_i cross. With the defaults, the settings of
Mehta and Blumenthal (2024, figure 4), both consumers coexist at R = (5/3, 5/9), the point of the region where
no consumer can invade that is closest to the supply point K.
The competition for one resource of Gros (2015, exercise 8), dx_i/dt = (f r_i - d) x_i and df/dt = a - f sum_i
r_i x_i, is the chemostat with one resource, c = r, m = d, kappa = a, and omega = 0. The total population
tends to a / d, the resource to min_i d / r_i, and only the consumer with the largest r_i survives. The system
has the populations consumers.N and the resources resources.R.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
consumers
|
Sequence[float] | None
|
The initial population sizes, or |
None
|
resources
|
Sequence[float] | None
|
The initial resource abundances, or |
None
|
c
|
Sequence[Sequence[float]]
|
The uptake rates, one row per consumer and one column per resource. |
UPTAKE
|
m
|
Sequence[float] | float
|
The maintenance energies of the consumers. |
1.0
|
e
|
Sequence[float] | float
|
The efficiencies of the consumers. |
1.0
|
w
|
Sequence[float] | float
|
The energies of the resources. |
1.0
|
r
|
Sequence[float] | float
|
The growth rates of self-renewing resources. |
1.0
|
K
|
Sequence[float] | float
|
The carrying capacities of self-renewing resources. |
CAPACITIES
|
kappa
|
Sequence[float] | float
|
The inflows of supplied resources. |
CAPACITIES
|
omega
|
Sequence[float] | float
|
The dilution rates of supplied resources. |
1.0
|
supply
|
str
|
|
'logistic'
|
kind
|
str
|
|
'substitutable'
|
n
|
float
|
The exponent of the growth on essential resources, below -1. |
-10.0
|
v
|
Sequence[Sequence[float]] | None
|
The stoichiometry of essential resources, one row per consumer, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The uptake rates are not one row per consumer with one column per resource. |
Examples:
>>> from skcomplex.systems.biology.ecology import ConsumerResourceSystem
>>> [group.size for group in ConsumerResourceSystem().prepare().system_.elements]
[2, 2]
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
ConsumptionInteraction(label, *, consumers, resources, c=((1.0,),), kind='substitutable', n=-10.0)
Bases: Interaction
Consumption of substitutable or essential resources by consumer species.
Consumption is the only way the consumers interact.
Consumer i takes up resource a at the rate c_ia R_a per individual. Substitutable resources add their
energies w_b c_ib R_b, and essential resources all limit the growth, g_i = (sum_b (c_ib R_b)^n)^(1/n) for
n < -1, which tends to Liebig's law g_i = min_b c_ib R_b as n goes to minus infinity. Its subclasses give the
laws of the consumers and of the resources, which read the other group through reductions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
consumers
|
Role
|
The path of the group of consumers. |
required |
resources
|
Role
|
The path of the group of resources. |
required |
c
|
Sequence[Sequence[float]]
|
The uptake rates, one row per consumer and one column per resource. |
((1.0,),)
|
kind
|
str
|
|
'substitutable'
|
n
|
float
|
The exponent of the growth on essential resources, below -1. |
-10.0
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The kind is unknown, or the exponent of essential resources is not below -1. |
Examples:
>>> from skcomplex.systems.biology.ecology import ConsumptionInteraction
>>> uptake = ((0.5, 0.3), (0.4, 0.6))
>>> ConsumptionInteraction('consumption', consumers='consumers', resources='resources', c=uptake).kind
'substitutable'
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
CowElement(label, *, bite=0.75, values=None, size=None, space=None)
Bases: Element
Cow of the meadow.
The grazing and herding interactions feed and move it every week.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
bite
|
Annotated[float | Array, closed_open(0, oo)]
|
The grass a cow eats in a week. |
0.75
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of cows, or |
None
|
space
|
BaseSpace | None
|
The lattice of the meadow, whose axes |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import CowElement
>>> CowElement('cows', size=10).size
10
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
67 68 69 70 71 72 73 74 75 76 77 | |
DroopCellQuotaSystem(Q=1.5, P=1.0, *, r_inf=1.0, q=1.0, vmax=2.0, g=1.0, R=1.0, d=0.1, label='system', solver='auto', backend='auto')
Bases: DynamicalSystem
The Droop system of a phytoplankton that grows on its stored nutrient.
The growth rate of the phytoplankton follows the nutrient stored in its cells.
The growth rate r_inf (1 - q / Q) rises with the quota Q and saturates at r_inf. Under a constant external
nutrient the quota settles at Q* = q + v / r_inf, where v = vmax R / (g + R) is the uptake, and the biomass then
grows exponentially at r_inf (1 - q / Q*) - d. The book gives no values for this system, so the defaults are in
units of the minimum quota, the maximum growth rate, and the half saturation, with time in days. The system has the
quota algae.Q and the biomass algae.P.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
float
|
The initial cell quota. |
1.5
|
P
|
float
|
The initial biomass. |
1.0
|
r_inf
|
float
|
The growth rate for an infinite quota. |
1.0
|
q
|
float
|
The minimum quota, at which growth stops. |
1.0
|
vmax
|
float
|
The maximum uptake rate. |
2.0
|
g
|
float
|
The external nutrient at which the uptake is half its maximum. |
1.0
|
R
|
float
|
The external nutrient concentration. |
1.0
|
d
|
float
|
The death rate. |
0.1
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import DroopCellQuotaSystem
>>> DroopCellQuotaSystem(R=4.0).prepare().system_.elements[0].values['R']
4.0
Source code in src/skcomplex/systems/biology/ecology/_cell_quota.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
DynamicMultispeciesFBASystem(*, fast_vmax=10.0, slow_vmax=8.0, biomass=0.01, glucose=10.0, km=0.015, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Two E. coli core strains that differ in maximal glucose uptake on one medium.
It needs the extra metabolism.
Each strain has its own program, uptake kinetics, and biomass, and they read one glucose pool (Raman 2021, Section 11.1.3.4). The strain with the larger uptake grows faster, so its share rises until the glucose runs out. The two strains and their uptakes of 10 and 8 are an illustration of the framework, whose example in the source is the competition between Rhodoferax and Geobacter (Zhuang et al. 2011).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fast_vmax
|
float
|
The largest glucose uptake of the fast strain, in mmol per gDW per h. |
10.0
|
slow_vmax
|
float
|
The largest glucose uptake of the slow strain, in mmol per gDW per h. |
8.0
|
biomass
|
float
|
The initial biomass of each strain in gDW per L. |
0.01
|
glucose
|
float
|
The initial glucose in mM. |
10.0
|
km
|
float
|
The half-saturation concentration of glucose in mM. |
0.015
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
MissingExtraError
|
The extra is not installed. |
Examples:
>>> from skcomplex.systems.biology.ecology import DynamicMultispeciesFBASystem
>>> [element.label for element in DynamicMultispeciesFBASystem().prepare().system_.systems[1].elements]
['biomass_fast', 'biomass_slow', 'glucose']
Source code in src/skcomplex/systems/biology/ecology/_dynamic_multispecies_fba.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
EmotionMarksElement(label, *, prey_happiness=0.0, prey_fear=0.0, predator_happiness=0.0, predator_anger=0.0, decay=0.2, space=None)
Bases: Element
Marks of one cell, the emotions of prey and predators.
They are the happiness and fear of prey and the happiness and anger of predators.
Animals with emotions leave their feelings in the cell they stand on, and the marks evaporate at the rate decay,
which the system adds as an evaporation of every mark.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the element or the lattice field. |
required |
prey_happiness
|
Annotated[object, closed_open(0, oo)]
|
The initial happiness left by prey. |
0.0
|
prey_fear
|
Annotated[object, closed_open(0, oo)]
|
The initial fear left by prey. |
0.0
|
predator_happiness
|
Annotated[object, closed_open(0, oo)]
|
The initial happiness left by predators. |
0.0
|
predator_anger
|
Annotated[object, closed_open(0, oo)]
|
The initial anger left by predators. |
0.0
|
decay
|
Annotated[object, closed_open(0, oo)]
|
The rate at which every mark evaporates. |
0.2
|
space
|
BaseSpace | None
|
The lattice with one cell of marks per site, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import EmotionMarksElement
>>> EmotionMarksElement('marks').decay
0.2
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
ExponentialGrowthSystem(n=10.0, r=0.1, *, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A population that grows or declines at a constant per-capita rate.
The system has the population population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The initial size. |
10.0
|
r
|
float
|
The per-capita growth rate. |
0.1
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import ExponentialGrowthSystem
>>> ExponentialGrowthSystem(r=0.2).prepare().system_.interactions[0].r
0.2
Source code in src/skcomplex/systems/biology/ecology/_factories.py
189 190 191 192 193 194 195 196 197 198 199 200 | |
FibonacciRabbitsSystem(pairs=1.0, previous=0.0, *, label='system', solver='auto', backend='auto')
Bases: DynamicalSystem
Fibonacci's rabbits, N_{t+1} = N_t + N_{t-1}.
Every pair older than one month breeds a new pair.
The previous population counts the pairs old enough to breed, so the recurrence is an age structure of two classes.
The system has the population rabbits.pairs and last month's rabbits.pairs_lag1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
float
|
The number of pairs this month. |
1.0
|
previous
|
float
|
The number of pairs last month. |
0.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import FibonacciRabbitsSystem
>>> FibonacciRabbitsSystem().prepare().system_.elements[0].values['pairs']
1.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
581 582 583 584 585 586 587 588 589 590 591 592 | |
FisherKPPSystem(length=800, *, D=1.0, r=1.0, spacing=0.25, front=0.05, label='system', solver='auto', backend='auto')
Bases: ReactionDiffusionSystem
The Fisher-KPP equation, whose step invades the empty line as a front.
The front has the speed 2 sqrt(r D).
The system has the density line.u.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
The number of sites of the line. |
800
|
D
|
float
|
The diffusion coefficient. |
1.0
|
r
|
float
|
The growth rate. |
1.0
|
spacing
|
float
|
The distance between sites. |
0.25
|
front
|
float
|
The fraction of the line that starts occupied, on its left. |
0.05
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import FisherKPPSystem
>>> int(FisherKPPSystem(100, front=0.1).prepare().system_.elements[0].values['u'].sum())
10
Source code in src/skcomplex/systems/biology/ecology/_fronts.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
FoodWebsSystem(populations=None, *, growth=None, mortality=None, links=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A food web of logistic basal species and Lotka-Volterra consumers.
The basal species grow logistically and the consumers live on Lotka-Volterra predation.
The default web has frogs and mice at its base, snakes that eat frogs and mice, and hawks that eat snakes and mice. Its four species coexist at a stable equilibrium. The system has one population per species.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
populations
|
Mapping[str, float] | None
|
The initial size of every species by name, or |
None
|
growth
|
Mapping[str, tuple[float, float]] | None
|
The growth rate and the carrying capacity of every basal species, or |
None
|
mortality
|
Mapping[str, float] | None
|
The death rate of every consumer, or |
None
|
links
|
Sequence[tuple[str, str, float, float]] | None
|
The links |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import FoodWebsSystem
>>> [element.label for element in FoodWebsSystem().prepare().system_.elements]
['frogs', 'mice', 'snakes', 'hawks']
Source code in src/skcomplex/systems/biology/ecology/_communities.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
ForagerElement(label, *, age=0.0, hunger=0.0, happiness=0.0, distress=0.0, experience=0.0, maturity=5.0, reproduction=0.3, starvation=10.0, memory=0.3, communication=0.1, emotions=1.0, values=None, size=None, space=None)
Bases: Element
Animal that hunts its food guided by emotions, and breeds.
The emotions are its own and those its kind left on the ground.
Every step the animal ages and grows hungry, and starves when its hunger passes starvation. It moves to the
neighbouring cell, empty or holding food, of highest preference: 1 for food, plus, with emotions, the happiness
marked there minus its own and its own distress minus the distress marked there. It eats food it moves onto.
Its emotions follow E' = (1 - memory) (X + communication C) + memory E, with the experience X of the step and
the mean emotion C marked around it, and it marks its cell with them. A mature animal breeds into an empty
neighbouring cell with a probability that happiness raises and distress lowers, and its offspring shares its
hunger, so a lineage starves together when its food is gone. Subclasses name their food and the marks they read,
and the system adds the ageing, the hunger, the starvation, the experience of distress, the move, the meal, the
emotions, the marks, and the breeding as member interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
age
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last bred. |
0.0
|
hunger
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last ate. |
0.0
|
happiness
|
Annotated[float, closed_open(0, oo)]
|
The happiness, which eating raises. |
0.0
|
distress
|
Annotated[float, closed_open(0, oo)]
|
The fear or anger. |
0.0
|
experience
|
Annotated[float, closed_open(0, oo)]
|
The distress the animal experienced in the step, before it moved. |
0.0
|
maturity
|
Annotated[float, open(0, oo)]
|
The age at which the animal can breed. |
5.0
|
reproduction
|
Annotated[float, closed_open(0, oo)]
|
The probability of breeding at maturity without emotions. |
0.3
|
starvation
|
Annotated[float, open(0, oo)]
|
The hunger at which the animal dies. |
10.0
|
memory
|
Annotated[float, closed_open(0, oo)]
|
The share of its previous emotion that an animal keeps. |
0.3
|
communication
|
Annotated[float, closed_open(0, oo)]
|
The weight of the emotions marked around the animal. |
0.1
|
emotions
|
Annotated[float, FiniteEnumeratedSet([0, 1])]
|
Whether emotions guide the animal, 1 or 0. |
1.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of animals, or |
None
|
space
|
BaseSpace | None
|
The grid the animals live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import StigmergicPreyElement
>>> StigmergicPreyElement('prey', size=10).size
10
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
ForestSizeStructureSystem(positions=40, heights=100, *, width=10.0, dispersal=1.0, hurst=1.0, sapling=0.1, top=50.0, shading=1.0, fecundity=0.01, resources=125.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The McKendrick-von Foerster density of trees over position and height.
The position runs across a strip.
The density f(x, h) of trees of height h at position x across a forest strip grows in height at the rate I (1
- h / top), where the light I = exp(-shading int_h^top f(x, h') h'^(2H) dh') falls through the canopy of taller
trees by the Beer-Lambert law. Trees die from competition for canopy space at the rate I h^(2H) f and for
resources at the rate I (1 - h / top) a / h, where a = R / resources and R = int h^(1+2H) f dh is the resource
consumption of the trees at x. Saplings enter at the height sapling from the seeds int K(x - x') R(x') dx' of
the trees around, dispersed by the exponential kernel K of length dispersal and integral fecundity, and no
seed comes from beyond the edges of the strip, where the forest was removed. Time and density are rescaled so that
the growth rate and the canopy mortality are one (Grilletta et al. 2026, arXiv 2608.11918 Eq. 9, 10, 16, and 25).
The kernel is the exponential of Eq. 35 along the axis across the strip, normalized in one dimension. The system has
the density forest.x over position and height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
int
|
The number of positions across the strip. |
40
|
heights
|
int
|
The number of cells of the height axis. |
100
|
width
|
float
|
The width |
10.0
|
dispersal
|
float
|
The dispersal length |
1.0
|
hurst
|
float
|
The Hurst exponent |
1.0
|
sapling
|
float
|
The height |
0.1
|
top
|
float
|
The asymptotic height |
50.0
|
shading
|
float
|
The light attenuation |
1.0
|
fecundity
|
float
|
The integral |
0.01
|
resources
|
float
|
The resource flux |
125.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import ForestSizeStructureSystem
>>> ForestSizeStructureSystem(8, 12).prepare().system_.elements[0].space.prepare().shape_
(8, 12)
Source code in src/skcomplex/systems/biology/ecology/_forest_size_structure.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
GeneralizedLotkaVolterraInteraction(label, *, target, a=-1.0, state='x')
Bases: Interaction
Interactions of the species of a group, dx_i/dt += x_i sum_j a_ij x_j.
They act through an interaction matrix a.
Every species i couples to every species j of the group, itself included, through the term x_i x_j weighted
by the entry a_ij of the interaction matrix, a parameter with one row and one column per species, so a schedule or
an experiment changes it. The diagonal entries are the interactions of a species with itself, negative for
self-limitation. With the growth b_i x_i as a rate, it gives the generalized Lotka-Volterra equations
dx_i/dt = x_i (b_i + sum_j a_ij x_j).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of species. |
required |
a
|
object
|
The interaction matrix, where |
-1.0
|
state
|
str
|
The name of the state that holds the abundance of a species. |
'x'
|
Examples:
>>> from skcomplex.systems.biology.ecology import GeneralizedLotkaVolterraInteraction
>>> matrix = ((-1.0, 0.5), (0.5, -1.0))
>>> GeneralizedLotkaVolterraInteraction('glv', target='species', a=matrix).a
((-1.0, 0.5), (0.5, -1.0))
Source code in src/skcomplex/systems/biology/ecology/_microbial_communities.py
132 133 134 135 136 137 138 139 140 141 142 143 | |
GeneralizedLotkaVolterraSystem(x=None, *, b=COMMUNITY_GROWTH, a=COMMUNITY_INTERACTIONS, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The generalized Lotka-Volterra system of a microbial community.
It follows dx_i/dt = x_i (b_i + sum_j a_ij x_j).
Every species grows at its intrinsic rate b_i and its growth changes with the abundance of every species through
the pairwise interaction a_ij. A feasible interior fixed point solves b + a x = 0. The book gives no parameter
values. The default is a choice, a community of three self-limiting species with weak competition and one weak
mutualism, whose fixed point x = -a^-1 b is positive and stable, so the species coexist. Abundances and time are
in arbitrary units. The system has the abundances species.x of the members of the group species, the growth
growth, and the interactions glv, whose matrix is the parameter glv.a.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Sequence[float] | None
|
The initial abundances, or |
None
|
b
|
Sequence[float]
|
The intrinsic growth rates. |
COMMUNITY_GROWTH
|
a
|
Sequence[Sequence[float]]
|
The interaction matrix, one row per species. |
COMMUNITY_INTERACTIONS
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The growth rates, the matrix, and the abundances do not have one entry per species. |
Examples:
>>> from skcomplex.systems.biology.ecology import GeneralizedLotkaVolterraSystem
>>> GeneralizedLotkaVolterraSystem().prepare().system_.elements[0].size
3
Source code in src/skcomplex/systems/biology/ecology/_microbial_communities.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
GrassElement(label, *, grown=1.0, countdown=0.0, regrowth=30.0, values=None, size=None, space=None)
Bases: Element
Grass patch that regrows a fixed number of steps after it is eaten, by GrassRegrowthInteraction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
grown
|
Annotated[object, NN]
|
Whether the grass is grown, 1 or 0. |
1.0
|
countdown
|
Annotated[object, closed_open(0, oo)]
|
The steps left until the grass is grown again. |
0.0
|
regrowth
|
Annotated[object, open(0, oo)]
|
The number of steps the grass takes to regrow. |
30.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of members, or |
None
|
space
|
BaseSpace | None
|
The grid the members live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import GrassElement
>>> GrassElement('grass', grown=1.0, size=4).size
4
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
GrassRegrowthInteraction(label, *, target)
Bases: Interaction
Regrowth of eaten grass, which counts down its steps and grows back when the countdown ends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the grass patches. |
required |
Examples:
>>> from skcomplex.systems.biology.ecology import GrassRegrowthInteraction
>>> GrassRegrowthInteraction('regrowth', target='grass').target
'grass'
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
114 115 116 | |
regrow(agent, system)
Count down eaten grass and grow it back when the countdown ends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
GrassView
|
The patch. |
required |
system
|
SystemView
|
The system. |
required |
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
GrazingInteraction(label, *, cows, pasture)
Bases: Interaction
Weekly meal of every cow, a bite of the grass of the patch in its cell.
Every patch loses the bite of the cow in its cell, or what grass is left. The pairs of patches and cows eat in random order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
cows
|
Role
|
The path of the group of cows. |
required |
pasture
|
Role
|
The path of the group of patches. |
required |
Examples:
>>> from skcomplex.systems.biology.ecology import GrazingInteraction
>>> GrazingInteraction('grazing', cows='cows', pasture='pasture').pasture
'pasture'
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
206 207 208 209 | |
feed(system)
Let every cow eat its bite of the grass of the patch in its cell, or what grass is left.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
SystemViewProtocol
|
The system. |
required |
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
HabitatPatchElement(label, *, x=10.0, size=None, space=None)
Bases: Element
Patch of space, a compartment of x organisms that divide and die.
The divisions and deaths of NeutralClusteringSystem happen at the same rate, so the number of organisms is a
symmetric random walk, and an empty patch stays empty without arrivals from its neighbours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the patch or of the lattice of patches. |
required |
x
|
Annotated[float | ArrayLike, NN]
|
The initial number of organisms. |
10.0
|
size
|
int | None
|
The number of patches, or |
None
|
space
|
BaseSpace | None
|
The lattice with one patch per site, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import HabitatPatchElement
>>> HabitatPatchElement('patch', x=5.0).x
5.0
Source code in src/skcomplex/systems/biology/ecology/_clustering.py
54 55 56 57 58 59 60 61 62 63 | |
HerdingInteraction(label, *, cows, pasture, threshold=0.9)
Bases: MovementInteraction
Weekly move of every cow to the nearest free patch with enough grass, or death.
The cows move in random order.
It is a movement of the cows whose step leads every cow to the patch nearest to it that no other cow occupies and
whose grass reaches threshold, and removes a cow that finds none. Every cow moves every week, the probability
of movement fixed to 1 without a parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
cows
|
Role
|
The path of the group of cows. |
required |
pasture
|
Role
|
The path of the group of patches. |
required |
threshold
|
Annotated[float, closed_open(0, oo)]
|
The least grass a patch needs for a cow to move there. |
0.9
|
Examples:
>>> from skcomplex.systems.biology.ecology import HerdingInteraction
>>> HerdingInteraction('herding', cows='cows', pasture='pasture').threshold
0.9
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
265 266 267 268 269 270 271 272 273 274 275 276 | |
HigherOrderRandomLotkaVolterraSystem(size=200, *, mu=-4.0, sigma=1.0, gamma=0.0, k=1.0, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A random Lotka-Volterra community with third-order interactions.
The abundances follow dx_i/dt = x_i (k - x_i + sum_(j<k) a_ijk x_j x_k) (Sidhom and Galla 2024, Eq. 2), where the
sum runs over the pairs of other species. The coefficients are Gaussian with mean mu / binom(N - 1, 2) and
variance 3 sigma^2 / (2 binom(N - 1, 2)), and the three coefficients of a set of three species have the
correlation gamma (Eqs. 4 and 5). The defaults are the competitive community of the paper's Fig. 2, 200 species
with uncorrelated coefficients at mu = -4 and sigma = 1, in its phase with a unique stable fixed point, where
the theory gives a fraction 0.928 of surviving species and a mean abundance 0.392. The paper does not state the
distribution of the initial abundances, which are drawn uniformly from the interval from 0 to 1. The system has the
abundances species.x of the members of the group species, the growth growth, and the interactions triplets,
whose tensor is the parameter triplets.a.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of species. |
200
|
mu
|
float
|
The mean of the interactions, negative for competition. |
-4.0
|
sigma
|
float
|
The heterogeneity of the interactions. |
1.0
|
gamma
|
float
|
The correlation of the three coefficients of a set of three species, from |
0.0
|
k
|
float
|
The growth rate at low abundance, which is also the carrying capacity without interactions. |
1.0
|
random_state
|
int | Generator | None
|
The seed or the generator that draws the tensor and the initial abundances. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import HigherOrderRandomLotkaVolterraSystem
>>> HigherOrderRandomLotkaVolterraSystem(5).prepare().system_.interactions[1].a.shape
(5, 5, 5)
Source code in src/skcomplex/systems/biology/ecology/_higher_order.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
HoppingInteraction(label, *, patches, beta=0.5, links=())
Bases: Interaction
Hops of single organisms between neighbouring patches.
Each organism moves to each neighbour at the rate beta.
The patches are the entries of a variadic role, and every pair (i, j) of links gives a jump that moves one
organism from the patch of entry i to the patch of entry j at the rate beta n_i.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
patches
|
tuple[Role, ...]
|
The paths of the patches, such as the members |
required |
beta
|
Annotated[float, closed_open(0, oo)]
|
The rate at which an organism hops to one neighbouring patch. |
0.5
|
links
|
Sequence[tuple[int, int]]
|
The ordered pairs of entries of |
()
|
Examples:
>>> from skcomplex.systems.biology.ecology import HoppingInteraction
>>> HoppingInteraction('hopping', patches=['a', 'b'], links=[(0, 1), (1, 0)]).beta
0.5
Source code in src/skcomplex/systems/biology/ecology/_clustering.py
95 96 97 98 99 100 101 102 103 104 105 106 | |
HutchinsonSystem(n=50.0, *, r=1.0, K=100.0, tau=2.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Hutchinson's delayed logistic equation.
It oscillates around K when r * tau exceeds π/2.
The history before the start is the initial size. The system has the population population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The initial size, also its history. |
50.0
|
r
|
float
|
The per-capita growth rate at low density. |
1.0
|
K
|
float
|
The carrying capacity. |
100.0
|
tau
|
float
|
The delay of the density feedback. |
2.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import HutchinsonSystem
>>> HutchinsonSystem(tau=1.0).prepare().system_.interactions[0].tau
1.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
IntrinsicInstabilitySystem(*, x=1.1, eta=0.1, alpha=0.01, beta=0.01, nu=0.01, p=0.001, sigma=0.01, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Jensen's coupled populations, whose steady state becomes unstable.
It becomes unstable without a change of the surroundings.
The resident population fluctuates about its level X = 1 until a rare mutation seeds the invader. The invader then
grows by the factor 1 + beta per step and suppresses the resident, so the trajectory leaves the fixed point (X,
0) along its unstable direction, with eigenvalue beta, and the resident declines although no parameter has
changed. The system has the populations populations.x and populations.y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The initial resident population. |
1.1
|
eta
|
float
|
The restoring rate of the resident population. |
0.1
|
alpha
|
float
|
The suppression of the resident population by the invader. |
0.01
|
beta
|
float
|
The growth rate of the invader. |
0.01
|
nu
|
float
|
The share of the resident population that a mutation moves to the invader. |
0.01
|
p
|
float
|
The probability of a mutation per step. |
0.001
|
sigma
|
float
|
The amplitude of the noise. |
0.01
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import IntrinsicInstabilitySystem
>>> IntrinsicInstabilitySystem().prepare().system_.interactions[1].beta
0.01
Source code in src/skcomplex/systems/biology/ecology/_instability.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
InvaderMapInteraction(label, *, target, beta=0.01, nu=0.01, p=0.001, sigma=0.01)
Bases: Interaction
Jensen's map of an invading population fed by mutations of a resident, equation (13.4).
With probability p a mutation from the resident x adds nu x to the invader y, and otherwise
y ← y (1 + beta) + √y sigma chi'. The noise chi' is a standard normal value, scaled by the square root of the
population size, and the size is cut at 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the populations, with the resident |
required |
beta
|
Annotated[float, closed_open(0, oo)]
|
The growth rate |
0.01
|
nu
|
Annotated[float, closed_open(0, oo)]
|
The share |
0.01
|
p
|
Annotated[float, closed_open(0, oo)]
|
The probability of a mutation per step. |
0.001
|
sigma
|
Annotated[float, closed_open(0, oo)]
|
The amplitude |
0.01
|
Examples:
>>> from skcomplex.systems.biology.ecology import InvaderMapInteraction
>>> InvaderMapInteraction('invader', target='populations').p
0.001
Source code in src/skcomplex/systems/biology/ecology/_instability.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
LinearGrowthInteraction(label, *, species, influences, rate=0.2)
Bases: Interaction
Linear growth of every species by the abundances of the species it reads.
The abundances are normalised to one.
Every species grows by rate times the sum of the abundances of the species it reads weighted by the strengths w
of the influences, its abundance stays nonnegative, and the abundances are normalised to sum to one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
species
|
Role
|
The path of the group of species on the nodes. |
required |
influences
|
Role
|
The path of the variable group on the edges. |
required |
rate
|
Annotated[float, open(0, oo)]
|
The growth per step per unit of influence. |
0.2
|
Examples:
>>> from skcomplex.systems.biology.ecology import LinearGrowthInteraction
>>> LinearGrowthInteraction('growth', species='species', influences='influences').rate
0.2
Source code in src/skcomplex/systems/biology/ecology/_sequential.py
111 112 113 114 115 116 117 118 119 120 121 122 | |
LogisticGrowthSystem(n=10.0, r=1.0, K=100.0, *, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A population that grows logistically towards its carrying capacity.
The system has the population population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The initial size. |
10.0
|
r
|
float
|
The intrinsic growth rate. |
1.0
|
K
|
float
|
The carrying capacity. |
100.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import LogisticGrowthSystem
>>> LogisticGrowthSystem(K=500.0).prepare().system_.interactions[0].K
500.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
LotkaVolterraSystem(prey=40.0, predators=9.0, *, r=1.1, a=0.4, b=0.1, d=0.4, K=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Prey and predators whose populations oscillate through predation.
The system has the populations prey and predators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prey
|
float
|
The initial number of prey. |
40.0
|
predators
|
float
|
The initial number of predators. |
9.0
|
r
|
float
|
The growth rate of the prey. |
1.1
|
a
|
float
|
The rate at which predation removes prey. |
0.4
|
b
|
float
|
The rate at which predation feeds predators. |
0.1
|
d
|
float
|
The mortality rate of the predators. |
0.4
|
K
|
float | None
|
The carrying capacity of the prey, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import LotkaVolterraSystem
>>> [element.label for element in LotkaVolterraSystem().prepare().system_.elements]
['prey', 'predators']
Source code in src/skcomplex/systems/biology/ecology/_factories.py
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | |
LotkaVolterraWithHarvestingSystem(prey=16.0, predators=8.0, *, r=1.0, a=0.1, b=0.05, d=0.5, prey_harvest=0.4, predator_harvest=0.4, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Lotka-Volterra predation where both species are harvested.
The harvest has a constant effort.
The populations cycle around prey = (d + predator_harvest) / b and predators = (r - prey_harvest) / a, which are
also their averages over a cycle. Harvesting raises the average prey and lowers the average predators, and a prey
harvest above r drives the predators extinct. The system has the populations prey and predators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prey
|
float
|
The initial number of prey. |
16.0
|
predators
|
float
|
The initial number of predators. |
8.0
|
r
|
float
|
The growth rate of the prey. |
1.0
|
a
|
float
|
The rate at which predation removes prey. |
0.1
|
b
|
float
|
The rate at which predation feeds predators. |
0.05
|
d
|
float
|
The mortality rate of the predators. |
0.5
|
prey_harvest
|
float
|
The harvesting effort on the prey. |
0.4
|
predator_harvest
|
float
|
The harvesting effort on the predators. |
0.4
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import LotkaVolterraWithHarvestingSystem
>>> system = LotkaVolterraWithHarvestingSystem().prepare().system_
>>> [interaction.label for interaction in system.interactions][-2:]
['prey_harvest', 'predator_harvest']
Source code in src/skcomplex/systems/biology/ecology/_predation.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
MangroveSuccessionSystem(keora=0.0, gewa=0.0, sundari=0.0, *, g_gewa=0.05, g_sundari=0.03, seedlings=0.01, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The regrowth of a mangrove forest of the Sundarbans after a clear cut.
It goes from pioneers to climax trees.
Keora, the pioneer, regrows fastest, Gewa, the intermediate group, follows, and Sundari, the climax group, grows
slowest but comes to dominate the mature forest and suppresses the others. Volumes, mature volumes, and competition
weights follow Bala et al. (2017), and the growth rates of Gewa and Sundari are illustrative. The system has the
stands keora, gewa, and sundari.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keora
|
float
|
The initial stem volume of Keora, the pioneer. |
0.0
|
gewa
|
float
|
The initial stem volume of Gewa, the intermediate group. |
0.0
|
sundari
|
float
|
The initial stem volume of Sundari, the climax group. |
0.0
|
g_gewa
|
float
|
The specific growth rate of Gewa. |
0.05
|
g_sundari
|
float
|
The specific growth rate of Sundari. |
0.03
|
seedlings
|
float
|
The constant input of Gewa and Sundari seedlings. |
0.01
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import MangroveSuccessionSystem
>>> [element.mature for element in MangroveSuccessionSystem().prepare().system_.elements]
[196.11, 80.0, 320.0]
Source code in src/skcomplex/systems/biology/ecology/_succession.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
MeadowCapacitySystem(width=40, height=40, *, cows=80, growth=0.2, bite=0.75, threshold=0.9, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Cows that graze a meadow for a summer of 25 weeks.
It shows how many cows the meadow can carry.
Every week the grass regrows logistically, each cow eats bite of the grass of its patch, and each cow moves to the
nearest patch that no other cow occupies and whose grass reaches threshold. A cow that finds none dies. Without
regrowth a cow grazes its first patch and 25 more over the summer, so the meadow feeds about width * height / 26
cows, and regrowth raises its carrying capacity. The cows graze the patches down at the same pace, so a herd above
the capacity runs out of grown patches all at once and dies out within a week, instead of shrinking to the capacity.
The system has the groups pasture and cows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
The number of columns of the meadow. |
40
|
height
|
int
|
The number of rows of the meadow. |
40
|
cows
|
int
|
The initial number of cows. |
80
|
growth
|
float
|
The weekly growth rate of the grass. |
0.2
|
bite
|
float
|
The grass a cow eats in a week. |
0.75
|
threshold
|
float
|
The least grass a patch needs for a cow to move there. |
0.9
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells of the cows. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import MeadowCapacitySystem
>>> [group.size for group in MeadowCapacitySystem(10, 10, cows=5).prepare().system_.elements]
[100, 5]
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
MicrobeElement(label, *, x=0.1, b=1.0, size=None)
Bases: Element
Species of a microbial community.
It has an abundance and an intrinsic growth rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the species or of the group of species. |
required |
x
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The initial abundance. |
0.1
|
b
|
float | ArrayLike
|
The intrinsic growth rate. |
1.0
|
size
|
int | None
|
The number of species, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import MicrobeElement
>>> MicrobeElement('species', x=0.1, b=0.8).b
0.8
Source code in src/skcomplex/systems/biology/ecology/_microbial_communities.py
54 55 56 57 58 59 60 61 62 63 64 | |
MicrobialGrowthInteraction(label, *, target)
Bases: Interaction
Growth of every species of a group at its own intrinsic rate, dx_i/dt += b_i x_i.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of species, whose members hold the abundance |
required |
Examples:
>>> from skcomplex.systems.biology.ecology import MicrobialGrowthInteraction
>>> MicrobialGrowthInteraction('growth', target='species').target
'species'
Source code in src/skcomplex/systems/biology/ecology/_microbial_communities.py
85 86 87 | |
MutualismInteraction(label, *, first, second, a=0.1, b=0.1, handling=0.5)
Bases: Interaction
Mutualism with a handling time, where encounters feed both species.
Each species gains a b n1 n2 / (1 + a T n).
The benefit to each species saturates with the abundance of its partner, as the handling time T limits how much
of the partner's resource it can use. A handling time of 0 gives the unbounded type I mutualism a b n1 n2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
first
|
Role
|
The path of the first population. |
required |
second
|
Role
|
The path of the second population. |
required |
a
|
Annotated[float, closed_open(0, oo)]
|
The effective search rate. |
0.1
|
b
|
Annotated[float, closed_open(0, oo)]
|
The rate of encounters. |
0.1
|
handling
|
Annotated[float, closed_open(0, oo)]
|
The handling time |
0.5
|
Examples:
>>> from skcomplex.systems.biology.ecology import MutualismInteraction
>>> MutualismInteraction('pollination', first='orchids', second='bees', handling=0.5).handling
0.5
Source code in src/skcomplex/systems/biology/ecology/_communities.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
MutualismSystem(first=10.0, second=10.0, *, r1=1.0, r2=1.0, K1=50.0, K2=50.0, a=0.1, b=0.5, handling=0.5, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Two species that grow logistically and feed each other.
They can grow above their carrying capacities.
With a positive handling time the benefit saturates and the populations settle above their capacities. Without it,
strong mutualism grows without bound. The system has the populations first and second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
float
|
The initial size of the first population. |
10.0
|
second
|
float
|
The initial size of the second population. |
10.0
|
r1
|
float
|
The growth rate of the first population. |
1.0
|
r2
|
float
|
The growth rate of the second population. |
1.0
|
K1
|
float
|
The carrying capacity of the first population alone. |
50.0
|
K2
|
float
|
The carrying capacity of the second population alone. |
50.0
|
a
|
float
|
The effective search rate. |
0.1
|
b
|
float
|
The rate of encounters. |
0.5
|
handling
|
float
|
The handling time of the resource of the partner, 0 for type I mutualism. |
0.5
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import MutualismSystem
>>> [interaction.label for interaction in MutualismSystem().prepare().system_.interactions]
['growth_first', 'growth_second', 'mutualism']
Source code in src/skcomplex/systems/biology/ecology/_communities.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
NeutralBiodiversitySystem(individuals=200, *, nu=0.01, species=1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A neutral community of constant size with speciation and drift.
Its species arise by speciation and vanish by drift.
Every species is transient, yet the number of species settles around S_N = sum_n theta / (theta + n) for n from
0 to N - 1, with theta = (N - 1) nu / (1 - nu), and the mean number of species of k individuals around phi_k
= theta / k prod_j (N - j + 1) / (N - j + theta) for j from 1 to k. The system has the group community and
the number richness of species.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
individuals
|
int
|
The number of individuals |
200
|
nu
|
float
|
The probability that an offspring founds a new species. |
0.01
|
species
|
int
|
The initial number of species, to which the individuals belong at random. |
1
|
random_state
|
int | Generator | None
|
The seed or generator of the initial species. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import NeutralBiodiversitySystem
>>> NeutralBiodiversitySystem(20).prepare().system_.elements[0].size
20
Source code in src/skcomplex/systems/biology/ecology/_speciation.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
NeutralClusteringSystem(shape=64, *, n=10.0, alpha=1.0, beta=0.5, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Organisms that divide, die, and hop between patches on a periodic lattice.
They gather in clusters.
Births balance deaths, so the mean number of organisms per patch stays n while its variance grows. Without hops it
grows as 2 alpha n t, so most patches empty while a few fill. Hops at the rate beta slow the growth to t^(1/2)
in one dimension and ln t in two, so the clusters persist in low dimension although the mean density obeys a
diffusion equation. The system has the numbers patches.x of organisms on the lattice patches, and their mean
mean and variance variance over the patches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
int | Sequence[int]
|
The number of patches of a ring, or the shape of a periodic lattice of patches. |
64
|
n
|
float
|
The initial number of organisms in every patch. |
10.0
|
alpha
|
float
|
The rate at which an organism divides, equal to the rate at which it dies. |
1.0
|
beta
|
float
|
The rate at which an organism hops to one neighbouring patch. |
0.5
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import NeutralClusteringSystem
>>> len(NeutralClusteringSystem(8).prepare().system_.elements[0].x)
8
Source code in src/skcomplex/systems/biology/ecology/_clustering.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
NeutralMacroecologySystem(species=100, n=10.0, *, b0=1.0, b1=0.9, d0=0.0, d1=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Many species under neutral birth, death, and immigration.
Their abundances follow a gamma-like law.
Without emigration, d0 = 0, the abundances settle on the negative binomial distribution of mean b0 / (d1 - b1),
the discrete form of the gamma distribution that the Fokker-Planck equation of macroecology predicts and that fits
the abundances of tropical trees. The system has the abundances species.x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
species
|
int
|
The number of species. |
100
|
n
|
float
|
The initial number of individuals of every species. |
10.0
|
b0
|
float
|
The rate of immigration or speciation. |
1.0
|
b1
|
float
|
The per capita birth rate. |
0.9
|
d0
|
float
|
The rate of emigration or extinction. |
0.0
|
d1
|
float
|
The per capita death rate, above |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import NeutralMacroecologySystem
>>> NeutralMacroecologySystem(20).prepare().system_.elements[0].size
20
Source code in src/skcomplex/systems/biology/ecology/_neutral.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
NeutralReplacementInteraction(label, *, target, mutation=0.01)
Bases: EvolutionInteraction
Deaths of random individuals at unit rate, each replaced by an offspring.
The offspring is of another individual, and of a new species at rate nu.
One unit of time holds N deaths. The offspring belongs to the species of a parent drawn among the individuals, or
with the probability mutation to a new species, labelled one above the largest label present. It is the neutral
Moran replacement of EvolutionInteraction with mutation to new labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of individuals. |
required |
mutation
|
Annotated[float, closed(0, 1)]
|
The probability |
0.01
|
Examples:
>>> from skcomplex.systems.biology.ecology import NeutralReplacementInteraction
>>> NeutralReplacementInteraction('replacement', target='community', mutation=0.01).change
'new'
Source code in src/skcomplex/systems/biology/ecology/_speciation.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
NeutralSpeciesElement(label, *, x=10.0, size=None, space=None)
Bases: Element
Species of neutral theory, a compartment of x individuals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the species or of the group of species. |
required |
x
|
Annotated[float | ArrayLike, NN]
|
The initial number of individuals. |
10.0
|
size
|
int | None
|
The number of species, or |
None
|
space
|
BaseSpace | None
|
The space with one species per site, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import NeutralSpeciesElement
>>> NeutralSpeciesElement('trees', size=50).size
50
Source code in src/skcomplex/systems/biology/ecology/_neutral.py
43 44 45 46 47 48 49 50 51 52 | |
NicholsonBaileySystem(hosts=25.0, parasitoids=10.0, *, k=2.0, a=0.05, c=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Hosts and parasitoids in discrete generations.
Their equilibrium is unstable to growing oscillations.
The equilibrium is H = k ln k / ((k - 1) a c) and P = ln k / a. The system has the populations hosts and
parasitoids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hosts
|
float
|
The initial number of hosts. |
25.0
|
parasitoids
|
float
|
The initial number of parasitoids. |
10.0
|
k
|
float
|
The reproductive rate of the hosts. |
2.0
|
a
|
float
|
The searching efficiency of the parasitoids. |
0.05
|
c
|
float
|
The number of viable eggs a parasitoid lays in a host. |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import NicholsonBaileySystem
>>> NicholsonBaileySystem(k=3.0).prepare().system_.interactions[0].k
3.0
Source code in src/skcomplex/systems/biology/ecology/_predation.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
OrganismElement(label, *, species=0.0, values=None, size=None, space=None)
Bases: Element
Individual of a neutral community, labelled by its species.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
species
|
Annotated[object, NN]
|
The label of the species. |
0.0
|
values
|
Mapping[str, object] | None
|
Further values by name, or |
None
|
size
|
int | None
|
The number of individuals, or |
None
|
space
|
BaseSpace | None
|
The space of the individuals, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import OrganismElement
>>> OrganismElement('community', species=0.0, size=10).size
10
Source code in src/skcomplex/systems/biology/ecology/_speciation.py
64 65 66 67 68 69 70 71 72 73 74 | |
ParasitismInteraction(label, *, host, parasitoid, k=2.0, a=0.05, c=1.0)
Bases: Interaction
Nicholson-Bailey parasitism of hosts by parasitoids in discrete generations.
Parasitoids search at random, so a host escapes with probability exp(-a P), giving H' = k H exp(-a P) and
P' = c H (1 - exp(-a P)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
host
|
Role
|
The path of the host population |
required |
parasitoid
|
Role
|
The path of the parasitoid population |
required |
k
|
Annotated[float, open(0, oo)]
|
The reproductive rate of the hosts. |
2.0
|
a
|
Annotated[float, open(0, oo)]
|
The searching efficiency of the parasitoids. |
0.05
|
c
|
Annotated[float, open(0, oo)]
|
The number of viable eggs a parasitoid lays in a host. |
1.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import ParasitismInteraction
>>> ParasitismInteraction('parasitism', host='moths', parasitoid='wasps', k=2.0).k
2.0
Source code in src/skcomplex/systems/biology/ecology/_predation.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
PastureElement(label, *, grass=1.0, growth=0.2, values=None, size=None, space=None)
Bases: Element
Patch of grass that regrows logistically every week, G' = G + g G (1 - G).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
grass
|
Annotated[float | Array, closed_open(0, oo)]
|
The amount of grass, between 0 and 1. |
1.0
|
growth
|
Annotated[float | Array, closed_open(0, oo)]
|
The weekly growth rate |
0.2
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of patches, or |
None
|
space
|
BaseSpace | None
|
The lattice of the meadow, whose axes |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import PastureElement
>>> PastureElement('pasture', growth=0.1, size=4).size
4
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
120 121 122 123 124 125 126 127 128 129 130 131 132 | |
PastureRegrowthInteraction(label, *, pasture)
Bases: Interaction
Weekly logistic regrowth of the grass of every patch of a pasture, G' = G + g G (1 - G).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
pasture
|
Role
|
The path of the group of patches. |
required |
Examples:
>>> from skcomplex.systems.biology.ecology import PastureRegrowthInteraction
>>> PastureRegrowthInteraction('regrowth', pasture='pasture').pasture
'pasture'
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
153 154 155 | |
regrow(agent, system)
staticmethod
Grow the grass by one week of logistic growth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
PastureView
|
The patch. |
required |
system
|
SystemView
|
The system. |
required |
Source code in src/skcomplex/systems/biology/ecology/_meadow.py
167 168 169 170 171 172 173 174 175 176 177 178 179 | |
PenaeidShrimpSystem(gut=0.5, biomass=1.0, *, ration=2.5, respiration=0.05, L_inf=29.9, K=0.013, label='system', solver='auto', backend='auto')
Bases: DynamicalSystem
The growth of one penaeid shrimp from the juvenile stage.
The growth is forced by the food and the water temperature.
The individual ingests food up to a maximum ration set by its biomass and the water temperature, assimilates its
gut content, respires, and spawns, while its gonads grow and its carapace length follows von Bertalanffy's curve
L(t) = L_inf (1 - exp(-K t)) from zero, which nears its asymptote after six to eight months. The gut content
settles near I / A_e, the ingestion over the assimilation efficiency.
The coefficients are those of the listing of Bala et al. (2017). With them the respiration of a juvenile at 28 C,
respiration exp(0.07 T) (phi B)^0.185, is about half its biomass per day, more than its maximum ration, so the
total biomass declines slowly while the gonads and the length grow. The weight gain the source describes needs a
lower respiration coefficient, such as 0.02. The system has the states shrimp.gut, shrimp.biomass,
shrimp.gonads, and shrimp.length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gut
|
float
|
The initial gut content, in grams of dry weight. |
0.5
|
biomass
|
float
|
The initial total biomass, in grams of dry weight. |
1.0
|
ration
|
float
|
The factor of the maximum ration, lower for males. |
2.5
|
respiration
|
float
|
The coefficient of the weight-specific respiration, per day. |
0.05
|
L_inf
|
float
|
The asymptotic carapace length, in millimetres. |
29.9
|
K
|
float
|
The growth coefficient of the length, per day. |
0.013
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import PenaeidShrimpSystem
>>> PenaeidShrimpSystem().prepare().system_.elements[0].values['K']
0.013
Source code in src/skcomplex/systems/biology/ecology/_factories.py
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | |
PioneerGrowthInteraction(label, *, target, intermediate, climax, half_time=3.65, w_intermediate=0.32, w_climax=0.68)
Bases: Interaction
Michaelis-Menten regrowth of pioneer trees.
The other groups suppress their input from seeds.
Alone, the volume follows V(t) = V_mat t / (K_M + t) after a clear cut, which is
dV/dt = V (V / V_mat - 2) / K_M + C V_mat / K_M with C = 1. The other groups reduce the factor
C = 1 - w_I V_I / V_mat,I - w_C V_C / V_mat,C, with weights normalized to sum to one, and no lower than 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the pioneer stand. |
required |
intermediate
|
Role
|
The path of the intermediate stand. |
required |
climax
|
Role
|
The path of the climax stand. |
required |
half_time
|
Annotated[float, open(0, oo)]
|
The time |
3.65
|
w_intermediate
|
Annotated[float, closed_open(0, oo)]
|
The weight of the intermediate group in the competition. |
0.32
|
w_climax
|
Annotated[float, closed_open(0, oo)]
|
The weight of the climax group in the competition. |
0.68
|
Examples:
>>> from skcomplex.systems.biology.ecology import PioneerGrowthInteraction
>>> PioneerGrowthInteraction('growth', target='keora', intermediate='gewa', climax='sundari').half_time
3.65
Source code in src/skcomplex/systems/biology/ecology/_succession.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
PlantElement(label, *, age=0.0, maturity=4.0, values=None, size=None, space=None)
Bases: Element
Plant that spreads into an empty neighbouring cell whenever it reaches maturity.
The system adds the ageing and the spreading as member interactions, and a plant that spreads starts its age anew.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
age
|
Annotated[float | Array, closed_open(0, oo)]
|
The steps since the plant last spread. |
0.0
|
maturity
|
Annotated[float, open(0, oo)]
|
The age at which the plant spreads. |
4.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of plants, or |
None
|
space
|
BaseSpace | None
|
The grid the plants live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import PlantElement
>>> PlantElement('plants', size=100).size
100
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
380 381 382 383 384 385 386 387 388 389 390 391 392 | |
PredationInteraction(label, *, predator, prey, a=0.1, b=0.01)
Bases: Interaction
Lotka-Volterra predation, where encounters remove prey and feed predators.
The prey loses a * predator * prey per unit time and the predator gains b * predator * prey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
predator
|
Role
|
The path of the predator population. |
required |
prey
|
Role
|
The path of the prey population. |
required |
a
|
Annotated[float, closed_open(0, oo)]
|
The attack rate. |
0.1
|
b
|
Annotated[float, closed_open(0, oo)]
|
The conversion rate of eaten prey into predators. |
0.01
|
Examples:
>>> from skcomplex.systems.biology.ecology import PredationInteraction
>>> PredationInteraction('hunt', predator='foxes', prey='rabbits', a=0.4, b=0.1).prey
'rabbits'
Source code in src/skcomplex/systems/biology/common/populations/_predation.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
PredatorElement(label, *, meals=0.0, conversion=0.5, death=0.1, values=None, size=None, space=None)
Bases: Element
Predator that walks at random, eats prey, breeds after a meal, and dies.
In its own activation a predator walks to a random neighbouring cell, eats and removes one random prey of the new
cell, counted in meals, breeds with the probability conversion after a meal, dies with the probability
death, and digests its meals, by member interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
meals
|
Annotated[float | Array, NN]
|
The prey the predator ate in the current step. |
0.0
|
conversion
|
Annotated[float | Array, closed_open(0, oo)]
|
The probability of breeding after eating a prey. |
0.5
|
death
|
Annotated[float | Array, closed_open(0, oo)]
|
The probability of dying at every step. |
0.1
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of predators, or |
None
|
space
|
BaseSpace | None
|
The grid the predators walk on, whose axes |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import PredatorElement
>>> PredatorElement('foxes', size=50).size
50
Source code in src/skcomplex/systems/biology/ecology/_agent_predation.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
PredatorPreyEventsInteraction(label, *, prey, predators, r=1.0, K=200.0, a=0.02, h=0.5, e=0.5, m=0.3, stochastic=True)
Bases: Interaction
Births, crowding, saturating predation, and deaths of prey and predators.
They are events of single individuals.
Prey are born at the rate r x and die of crowding at the rate r x^2 / K. Predators kill prey at the Holling
type II rate a x y / (1 + a h x), are born at e times that rate, and die at the rate m y. In deterministic
mode the rates drive the populations as differential equations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
prey
|
Role
|
The path of the prey population |
required |
predators
|
Role
|
The path of the predator population |
required |
r
|
Annotated[float, closed_open(0, oo)]
|
The birth rate of the prey. |
1.0
|
K
|
Annotated[float, open(0, oo)]
|
The carrying capacity of the prey. |
200.0
|
a
|
Annotated[float, closed_open(0, oo)]
|
The attack rate. |
0.02
|
h
|
Annotated[float, closed_open(0, oo)]
|
The handling time. |
0.5
|
e
|
Annotated[float, closed_open(0, oo)]
|
The number of predators born per prey eaten. |
0.5
|
m
|
Annotated[float, closed_open(0, oo)]
|
The death rate of the predators. |
0.3
|
stochastic
|
bool
|
Whether births, deaths, and kills are random events. |
True
|
Examples:
>>> from skcomplex.systems.biology.ecology import PredatorPreyEventsInteraction
>>> PredatorPreyEventsInteraction('events', prey='voles', predators='weasels', K=200.0).K
200.0
Source code in src/skcomplex/systems/biology/ecology/_predation.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
PreyElement(label, *, birth=0.2, values=None, size=None, space=None)
Bases: Element
Prey that walks at random and gives birth when alone in its cell.
In its own activation a prey walks to a random neighbouring cell and then gives birth with the probability
birth when no other prey shares the new cell, by member interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
birth
|
Annotated[float | Array, closed_open(0, oo)]
|
The probability of giving birth at every step. |
0.2
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of prey, or |
None
|
space
|
BaseSpace | None
|
The grid the prey walk on, whose axes |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import PreyElement
>>> PreyElement('rabbits', size=200).size
200
Source code in src/skcomplex/systems/biology/ecology/_agent_predation.py
134 135 136 137 138 139 140 141 142 143 144 | |
ResidentMapInteraction(label, *, target, eta=0.1, mean=1.0, alpha=0.01, sigma=0.01)
Bases: Interaction
Jensen's map of a resident population damped by an invader, equation (13.3).
At every step x ← [x - eta (x - X)] exp(-alpha y) + √x sigma chi, an Ornstein-Uhlenbeck step damped by the
invader y. The noise chi is a standard normal value, scaled by the square root of the population size as in
birth and death processes, and the size is cut at 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the populations, with the resident |
required |
eta
|
Annotated[float, closed_open(0, oo)]
|
The restoring rate |
0.1
|
mean
|
Annotated[float, closed_open(0, oo)]
|
The level |
1.0
|
alpha
|
Annotated[float, closed_open(0, oo)]
|
The suppression |
0.01
|
sigma
|
Annotated[float, closed_open(0, oo)]
|
The amplitude |
0.01
|
Examples:
>>> from skcomplex.systems.biology.ecology import ResidentMapInteraction
>>> ResidentMapInteraction('resident', target='populations').eta
0.1
Source code in src/skcomplex/systems/biology/ecology/_instability.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
ResourceElement(label, *, R=1.0, w=1.0, r=1.0, K=1.0, kappa=1.0, omega=1.0, size=None)
Bases: Element
Resource that consumers take up, self-renewing or supplied from outside.
A self-renewing resource grows logistically.
A self-renewing resource grows as r R (K - R) / K, and a supplied one flows in at kappa and is washed out at
the rate omega. The interaction that couples the resource to its consumers chooses which supply applies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the resource or of the group of resources. |
required |
R
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The initial abundance. |
1.0
|
w
|
Annotated[float | ArrayLike, open(0, oo)]
|
The energy a unit of the resource carries. |
1.0
|
r
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The growth rate of a self-renewing resource at low abundance. |
1.0
|
K
|
Annotated[float | ArrayLike, open(0, oo)]
|
The carrying capacity of a self-renewing resource. |
1.0
|
kappa
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The inflow of a supplied resource. |
1.0
|
omega
|
Annotated[float | ArrayLike, closed_open(0, oo)]
|
The dilution rate of a supplied resource. |
1.0
|
size
|
int | None
|
The number of resources, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import ResourceElement
>>> ResourceElement('resources', K=4.8).K
4.8
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
ResourceTurnoverInteraction(label, *, consumers, resources, c=((1.0,),), kind='substitutable', n=-10.0, supply='logistic', v=None)
Bases: ConsumptionInteraction
Supply of resources and their depletion by the consumers.
The supply is a logistic renewal or a chemostat.
A 'logistic' supply renews resource a at r_a R_a (K_a - R_a) / K_a, and a 'chemostat' supply at kappa_a -
omega_a R_a. Substitutable resources lose sum_j c_ja N_j R_a, and essential resources lose sum_j v_ja N_j g_j
by the fixed stoichiometry v of the consumers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
consumers
|
Role
|
The path of the group of consumers. |
required |
resources
|
Role
|
The path of the group of resources. |
required |
c
|
Sequence[Sequence[float]]
|
The uptake rates, one row per consumer and one column per resource. |
((1.0,),)
|
kind
|
str
|
|
'substitutable'
|
n
|
float
|
The exponent of the growth on essential resources, below -1. |
-10.0
|
supply
|
str
|
|
'logistic'
|
v
|
Sequence[Sequence[float]] | None
|
The stoichiometry of essential resources in the consumers, one row per consumer, or |
None
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The supply or the kind is unknown, or the exponent of essential resources is not below -1. |
Examples:
>>> from skcomplex.systems.biology.ecology import ResourceTurnoverInteraction
>>> ResourceTurnoverInteraction('turnover', consumers='consumers', resources='resources').supply
'logistic'
Source code in src/skcomplex/systems/biology/ecology/_consumer_resources.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
RickerGrowthInteraction(label, *, target, r=2.0)
Bases: Interaction
Ricker growth of a population in discrete generations, x' = r x exp(-x).
It overcompensates at high density.
The size x is in units of the density at which the offspring of a generation peak, so a crowded generation
leaves fewer offspring than a sparser one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the population. |
required |
r
|
Annotated[float, closed_open(0, oo)]
|
The growth factor at low density. |
2.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import RickerGrowthInteraction
>>> RickerGrowthInteraction('growth', target='fish', r=12.0).r
12.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
70 71 72 73 74 75 76 77 78 79 | |
RickerSystem(n=0.5, *, r=2.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Ricker's map of a population in discrete generations, n' = r n exp(-n).
It is chaotic for large r.
The positive fixed point n = ln r is stable while 1 < r < e^2. Beyond e^2, about 7.39, it loses stability to a
two-cycle, and further period doublings lead to chaos near r = 14.8. The size stays positive for every r. The
system has the population population.x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The initial size, in units of the density at which the offspring peak. |
0.5
|
r
|
float
|
The growth factor at low density. |
2.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import RickerSystem
>>> RickerSystem(r=12.0).prepare().system_.interactions[0].r
12.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
657 658 659 660 661 662 663 664 665 666 667 668 | |
RosenzweigMacArthurInteraction(label, *, prey, predators, kappa=0.01, eta=0.8, phi=0.1, phi_end=0.2, rate=0.0)
Bases: Interaction
Rosenzweig-MacArthur predation of fast prey by slow predators.
The crowding of the prey grows at a constant rate.
In units of the predators' time scale, kappa dx/dt = x (1 - phi x) - x y / (1 + eta x) and
dy/dt = x y / (1 + eta x) - y. The crowding phi, the inverse of the prey's carrying capacity, rises at the rate
rate from phi to phi_end and stays there.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
prey
|
Role
|
The path of the prey population |
required |
predators
|
Role
|
The path of the predator population |
required |
kappa
|
Annotated[float, open(0, oo)]
|
The ratio of the time scales of the prey and the predators. |
0.01
|
eta
|
Annotated[float, closed_open(0, oo)]
|
The handling time of the predators. |
0.8
|
phi
|
Annotated[float, closed_open(0, oo)]
|
The initial crowding of the prey. |
0.1
|
phi_end
|
Annotated[float, closed_open(0, oo)]
|
The final crowding of the prey. |
0.2
|
rate
|
Annotated[float, closed_open(0, oo)]
|
The rate at which the crowding rises. |
0.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import RosenzweigMacArthurInteraction
>>> RosenzweigMacArthurInteraction('predation', prey='prey', predators='predators', rate=0.01).rate
0.01
Source code in src/skcomplex/systems/biology/ecology/_predation.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
RosenzweigMacarthurSystem(prey=None, predators=None, *, kappa=0.01, eta=0.8, phi=None, phi_end=None, rate=0.002, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Fast prey and slow predators whose carrying capacity shrinks at a rate.
A fast shrinking tips them.
By default the crowding rises from eta (1 - eta) / (1 + eta) to 1 - eta, the range where the coexistence point
at x = 1 / (1 - eta) is stable, and the run starts there. A slow rise lets the populations track the point, and a
rise faster than about 0.0004 makes the prey collapse for a while before they return.
In a collapse the prey fall to about 1e-30, far below any absolute tolerance, and an error of either sign there
decides whether they return or, below zero, run into the pole of the feeding at x = -1 / eta. The registered
solver therefore controls the relative error only, with ScipyODESolver(rtol=1e-8, atol=1e-300). The system has the
populations prey and predators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prey
|
float | None
|
The initial prey |
None
|
predators
|
float | None
|
The initial predators |
None
|
kappa
|
float
|
The ratio of the time scales of the prey and the predators. |
0.01
|
eta
|
float
|
The handling time of the predators. |
0.8
|
phi
|
float | None
|
The initial crowding, or |
None
|
phi_end
|
float | None
|
The final crowding, or |
None
|
rate
|
float
|
The rate at which the crowding rises. |
0.002
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import RosenzweigMacarthurSystem
>>> round(RosenzweigMacarthurSystem().prepare().system_.elements[0].x, 6)
5.0
Source code in src/skcomplex/systems/biology/ecology/_predation.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
SeasonalLogisticGrowthInteraction(label, *, target, r=1.0, K=100.0, amplitude=0.5, period=1.0)
Bases: LogisticGrowthInteraction
Logistic growth under a carrying capacity that varies periodically.
The capacity is K(t) = K (1 + amplitude sin(2 pi t / T)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the population. |
required |
r
|
Annotated[float, closed_open(0, oo)]
|
The per capita growth rate at low density. |
1.0
|
K
|
Annotated[float, open(0, oo)]
|
The mean carrying capacity. |
100.0
|
amplitude
|
Annotated[float, closed_open(0, oo)]
|
The relative amplitude of the variation of the capacity, below 1. |
0.5
|
period
|
Annotated[float, open(0, oo)]
|
The period |
1.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import SeasonalLogisticGrowthInteraction
>>> SeasonalLogisticGrowthInteraction('growth', target='rabbits', period=12.0).period
12.0
Source code in src/skcomplex/systems/biology/ecology/_factories.py
124 125 126 127 128 129 130 131 132 133 134 135 136 | |
SequentiallyLinearEcosystemSystem(n=60, k=4, *, rate=0.2, threshold=0.001, seed=1, label='system', solver='auto', backend='auto')
Bases: BaseSystem
An ecosystem with linear dynamics between extinctions that rewrite its network.
Every species reads k random species through influences of random sign and strength, and grows linearly with their
abundances. Between extinctions the dynamics is linear, so the abundances approach the dominant eigenvector of the
current network. A species whose abundance falls below threshold goes extinct with its influences, and a new
species with k random influences takes its place, which changes the network and starts a new linear stretch.
Extinctions come in bursts separated by quiet periods. The system has the abundances species.x and ages
species.age of the variable group species and the strengths influences.w of the variable group influences on
the edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
The number of species. |
60
|
k
|
int
|
The number of species every species reads. |
4
|
rate
|
float
|
The growth per step per unit of influence. |
0.2
|
threshold
|
float
|
The abundance below which a species goes extinct. |
0.001
|
seed
|
int | None
|
The seed of the network and of the initial strengths. |
1
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import SequentiallyLinearEcosystemSystem
>>> [component.label for component in SequentiallyLinearEcosystemSystem(n=10).prepare().system_.elements]
['species', 'influences']
Source code in src/skcomplex/systems/biology/ecology/_sequential.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
SheepElement(label, *, energy=8.0, gain=4.0, reproduction=0.04, values=None, size=None, space=None)
Bases: Element
Sheep that wanders, eats grown grass, reproduces, and dies without energy.
In its own activation, a sheep wanders to a neighbouring cell at a cost of one unit of energy, eats the grown grass
of its cell, and dies below zero energy or gives birth with probability reproduction, splitting its energy with
the lamb, by member interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
energy
|
object
|
The initial energy. |
8.0
|
gain
|
Annotated[object, closed_open(0, oo)]
|
The energy a sheep gains from grown grass. |
4.0
|
reproduction
|
Annotated[object, closed_open(0, oo)]
|
The probability of reproducing at every step. |
0.04
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of members, or |
None
|
space
|
BaseSpace | None
|
The grid the members live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import SheepElement
>>> SheepElement('sheep', size=100).size
100
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
SizeGrowthInteraction(label, *, target, state='u', drift=None, source=None, sources=())
Bases: Interaction
Size growth du/dt + divergence(a u) = source(ns) of a size density u by a growth rate.
Ecology names it the growth of individuals along a size axis, the transport term of a size-structured population.
The drift field is a(ns). The interaction sets the rate -divergence(a u) of the drift times the state, in
conservative form, so the total of the state on a periodic field stays constant and a finite-volume field takes
the differences of the flux between cells under its scheme. The drift is one expression for a field of one
dimension, or one per dimension, of the states and parameters of the field, and may read other states than the one
it carries, such as the flow of a fluid derived from a streamfunction, or the drift of a probability density in a
Fokker-Planck equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the field whose state is carried. |
required |
state
|
str
|
The name of the carried state of the field. |
'u'
|
drift
|
Callable[[SimpleNamespace], object] | None
|
A function of the namespace that returns the drift, or one drift per dimension. |
None
|
source
|
Callable[[SimpleNamespace], object] | None
|
A function of the namespace that returns the source, or |
None
|
sources
|
tuple[Role, ...]
|
The paths of other elements the drift and the source read, as the namespaces |
()
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The state is not a name, or a function is not callable. |
Examples:
>>> import numpy as np
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.components.spaces import LatticeSpace
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.ecology import SizeGrowthInteraction
>>> space = LatticeSpace((50,), spacing=0.1, boundary='periodic', discretization='finite-volume')
>>> values = {'u': np.exp(-((np.arange(50) - 25) / 5.0) ** 2)}
>>> field = Element('tracer', values=values, space=space)
>>> drift = SizeGrowthInteraction('drift', target='tracer', state='u', drift=lambda s: 1.0)
>>> system = System(elements=[field], interactions=[drift]).prepare()
>>> trajectory = system.simulate(1.0, dt=0.01)
>>> total = trajectory.get_values('tracer.u')[-1].sum()
>>> round(float(total), 6) == round(float(values['u'].sum()), 6)
True
Source code in src/skcomplex/systems/biology/ecology/_forest_size_structure.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
StandElement(label, *, volume=0.0, mature=100.0)
Bases: Element
Stand of trees of one successional group, measured by its stem volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the stand. |
required |
volume
|
Annotated[float, closed_open(0, oo)]
|
The initial stem volume. |
0.0
|
mature
|
Annotated[float, open(0, oo)]
|
The stem volume of the group in a mature forest. |
100.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import StandElement
>>> StandElement('keora', mature=196.11).mature
196.11
Source code in src/skcomplex/systems/biology/ecology/_succession.py
44 45 46 47 48 49 50 51 52 53 | |
StigmergicPredatorElement(label, *, age=0.0, hunger=0.0, happiness=0.0, distress=0.0, experience=0.0, maturity=5.0, reproduction=0.3, starvation=10.0, memory=0.3, communication=0.1, emotions=1.0, values=None, size=None, space=None)
Bases: ForagerElement
Predator that eats prey and grows angry with hunger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
age
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last bred. |
0.0
|
hunger
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last ate. |
0.0
|
happiness
|
Annotated[float, closed_open(0, oo)]
|
The happiness, which eating raises. |
0.0
|
distress
|
Annotated[float, closed_open(0, oo)]
|
The anger, which hunger raises. |
0.0
|
experience
|
Annotated[float, closed_open(0, oo)]
|
The distress the animal experienced in the step, before it moved. |
0.0
|
maturity
|
Annotated[float, open(0, oo)]
|
The age at which the animal can breed. |
5.0
|
reproduction
|
Annotated[float, closed_open(0, oo)]
|
The probability of breeding at maturity without emotions. |
0.3
|
starvation
|
Annotated[float, open(0, oo)]
|
The hunger at which the animal dies. |
10.0
|
memory
|
Annotated[float, closed_open(0, oo)]
|
The share of its previous emotion that an animal keeps. |
0.3
|
communication
|
Annotated[float, closed_open(0, oo)]
|
The weight of the emotions marked around the animal. |
0.1
|
emotions
|
Annotated[float, FiniteEnumeratedSet([0, 1])]
|
Whether emotions guide the animal, 1 or 0. |
1.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of animals, or |
None
|
space
|
BaseSpace | None
|
The grid the animals live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import StigmergicPredatorElement
>>> StigmergicPredatorElement.food
'prey'
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
StigmergicPredatorPreySystem(width=30, height=30, *, plants=300, prey=120, predators=20, emotions=True, decay=0.2, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Plants, prey, and predators on a grid.
The animals share emotions through decaying marks.
Every cell holds at most one organism. Prey eat plants and fear predators, and predators eat prey and grow angry
with hunger. Happiness draws animals of the same kind towards the cells where it was marked and distress drives them
away, a trail stigmergy of emotions that the cellular automaton of Olsen in Carmichael and Hadžikadić (2019) uses to
study cooperation within each species. The system has the groups life/plants, life/prey, and life/predators,
and the marks ground/marks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
The number of columns of the torus. |
30
|
height
|
int
|
The number of rows of the torus. |
30
|
plants
|
int
|
The initial number of plants. |
300
|
prey
|
int
|
The initial number of prey. |
120
|
predators
|
int
|
The initial number of predators. |
20
|
emotions
|
bool
|
Whether emotions guide the animals. |
True
|
decay
|
float
|
The rate at which the marks decay. |
0.2
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import StigmergicPredatorPreySystem
>>> system = StigmergicPredatorPreySystem(10, 10, plants=20, prey=10, predators=5).prepare().system_
>>> [child.label for child in system.systems]
['life', 'ground']
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
StigmergicPreyElement(label, *, age=0.0, hunger=0.0, happiness=0.0, distress=0.0, experience=0.0, maturity=5.0, reproduction=0.3, starvation=10.0, memory=0.3, communication=0.1, emotions=1.0, values=None, size=None, space=None)
Bases: ForagerElement
Prey that eats plants and fears the predators around it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
age
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last bred. |
0.0
|
hunger
|
Annotated[float, closed_open(0, oo)]
|
The steps since the animal last ate. |
0.0
|
happiness
|
Annotated[float, closed_open(0, oo)]
|
The happiness, which eating raises. |
0.0
|
distress
|
Annotated[float, closed_open(0, oo)]
|
The fear, which predators around it raise. |
0.0
|
experience
|
Annotated[float, closed_open(0, oo)]
|
The distress the animal experienced in the step, before it moved. |
0.0
|
maturity
|
Annotated[float, open(0, oo)]
|
The age at which the animal can breed. |
5.0
|
reproduction
|
Annotated[float, closed_open(0, oo)]
|
The probability of breeding at maturity without emotions. |
0.3
|
starvation
|
Annotated[float, open(0, oo)]
|
The hunger at which the animal dies. |
10.0
|
memory
|
Annotated[float, closed_open(0, oo)]
|
The share of its previous emotion that an animal keeps. |
0.3
|
communication
|
Annotated[float, closed_open(0, oo)]
|
The weight of the emotions marked around the animal. |
0.1
|
emotions
|
Annotated[float, FiniteEnumeratedSet([0, 1])]
|
Whether emotions guide the animal, 1 or 0. |
1.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of animals, or |
None
|
space
|
BaseSpace | None
|
The grid the animals live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import StigmergicPreyElement
>>> StigmergicPreyElement.food
'plants'
Source code in src/skcomplex/systems/biology/ecology/_stigmergy.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
StochasticPredatorPreySystem(prey=200.0, predators=200.0, *, r=1.0, K=600.0, a=0.005, h=0.5, e=0.5, m=0.3, stochastic=True, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Prey and predators born and killed one at a time.
The prey crowd and the predation saturates.
The deterministic limit has the coexistence point x = m / (a (e - m h)). It is stable while K < 2 x + 1 / (a h),
and enriching the prey beyond that turns it into large cycles, which demographic noise drives to extinction. The
system has the populations prey and predators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prey
|
float
|
The initial number of prey. |
200.0
|
predators
|
float
|
The initial number of predators. |
200.0
|
r
|
float
|
The birth rate of the prey. |
1.0
|
K
|
float
|
The carrying capacity of the prey. |
600.0
|
a
|
float
|
The attack rate. |
0.005
|
h
|
float
|
The handling time. |
0.5
|
e
|
float
|
The number of predators born per prey eaten. |
0.5
|
m
|
float
|
The death rate of the predators. |
0.3
|
stochastic
|
bool
|
Whether births, deaths, and kills are random events. |
True
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import StochasticPredatorPreySystem
>>> StochasticPredatorPreySystem(K=1000.0).prepare().system_.interactions[0].K
1000.0
Source code in src/skcomplex/systems/biology/ecology/_predation.py
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
SuccessionalGrowthInteraction(label, *, target, first, second, g=0.05, w_first=0.5, w_second=0.5, seedlings=0.01)
Bases: Interaction
Logistic growth of intermediate or climax trees with seedling input.
They are crowded by their own group and another.
The rate is dV/dt = a + g V (1 - w_1 V_1 / V_mat,1 - w_2 V_2 / V_mat,2), with weights normalized to sum to one.
One of the two crowding stands is usually the target itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the growing stand. |
required |
first
|
Role
|
The path of the first crowding stand. |
required |
second
|
Role
|
The path of the second crowding stand. |
required |
g
|
Annotated[float, closed_open(0, oo)]
|
The specific growth rate. |
0.05
|
w_first
|
Annotated[float, closed_open(0, oo)]
|
The weight of the first crowding stand. |
0.5
|
w_second
|
Annotated[float, closed_open(0, oo)]
|
The weight of the second crowding stand. |
0.5
|
seedlings
|
Annotated[float, closed_open(0, oo)]
|
The constant input |
0.01
|
Examples:
>>> from skcomplex.systems.biology.ecology import SuccessionalGrowthInteraction
>>> SuccessionalGrowthInteraction('growth', target='gewa', first='gewa', second='sundari', g=0.1).g
0.1
Source code in src/skcomplex/systems/biology/ecology/_succession.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
TripletInteraction(label, *, target, a=0.0, state='x')
Bases: Interaction
Interactions of every species with the pairs of other species.
They add dx_i/dt += x_i sum_(j<k) a_ijk x_j x_k.
The coefficient a_ijk is the effect of the combination of the species j and k on the growth of the species
i (Sidhom and Galla 2024, Eq. 2). The tensor holds it for both orders of the pair, a_ijk = a_ikj, so the sum
over the sets j < k is half the contraction of the tensor with the abundances, and it holds 0 where indices
coincide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of species. |
required |
a
|
object
|
The coupling tensor of order 3, with one index per species, or a number for every entry. |
0.0
|
state
|
str
|
The name of the state that holds the abundance of a species. |
'x'
|
Examples:
>>> from skcomplex.systems.biology.ecology import TripletInteraction
>>> TripletInteraction('triplets', target='species', a=0.0, state='x').state
'x'
Source code in src/skcomplex/systems/biology/ecology/_higher_order.py
57 58 59 60 61 62 63 64 65 66 67 68 | |
UnstablePopulationsElement(label, *, x=1.1, y=0.0)
Bases: Element
Resident population x and invading population y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the populations. |
required |
x
|
Annotated[float, closed_open(0, oo)]
|
The initial resident population. |
1.1
|
y
|
Annotated[float, closed_open(0, oo)]
|
The initial invading population. |
0.0
|
Examples:
>>> from skcomplex.systems.biology.ecology import UnstablePopulationsElement
>>> UnstablePopulationsElement('populations').x
1.1
Source code in src/skcomplex/systems/biology/ecology/_instability.py
46 47 48 49 50 51 52 53 54 55 | |
VaryingCapacityLogisticSystem(n=10.0, *, r=2.0, K=100.0, amplitude=0.5, period=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Logistic growth under a seasonal carrying capacity.
It settles on a cycle of the season's period.
Whatever its initial size, the population tends to a unique periodic solution, which lags behind the capacity and
varies less than it. The system has the population population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The initial size. |
10.0
|
r
|
float
|
The intrinsic growth rate. |
2.0
|
K
|
float
|
The mean carrying capacity. |
100.0
|
amplitude
|
float
|
The relative amplitude of the seasonal variation of the capacity, below 1. |
0.5
|
period
|
float
|
The period of the seasons. |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import VaryingCapacityLogisticSystem
>>> VaryingCapacityLogisticSystem(amplitude=0.2).prepare().system_.interactions[0].amplitude
0.2
Source code in src/skcomplex/systems/biology/ecology/_factories.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
WolfElement(label, *, energy=20.0, gain=20.0, reproduction=0.05, values=None, size=None, space=None)
Bases: Element
Wolf that wanders, eats a sheep, reproduces, and dies without energy.
In its own activation, a wolf wanders to a neighbouring cell at a cost of one unit of energy, eats and removes one
random sheep of its cell, and dies below zero energy or gives birth with probability reproduction, by member
interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the agent or group. |
required |
energy
|
object
|
The initial energy. |
20.0
|
gain
|
Annotated[object, closed_open(0, oo)]
|
The energy a wolf gains from a sheep. |
20.0
|
reproduction
|
Annotated[object, closed_open(0, oo)]
|
The probability of reproducing at every step. |
0.05
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the cells |
None
|
size
|
int | None
|
The number of members, or |
None
|
space
|
BaseSpace | None
|
The grid the members live on, or |
None
|
Examples:
>>> from skcomplex.systems.biology.ecology import WolfElement
>>> WolfElement('wolves', size=25).size
25
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
WolfSheepSystem(width=20, height=20, *, sheep=100, wolves=25, regrowth=30.0, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The wolf and sheep predation system with one grass patch per cell.
The system has the groups grass, sheep, and wolves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
The number of columns. |
20
|
height
|
int
|
The number of rows. |
20
|
sheep
|
int
|
The initial number of sheep. |
100
|
wolves
|
int
|
The initial number of wolves. |
25
|
regrowth
|
float
|
The number of steps grass takes to regrow. |
30.0
|
random_state
|
int | Generator | None
|
The seed or generator of the initial grass state. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.ecology import WolfSheepSystem
>>> [group.label for group in WolfSheepSystem(10, 10).prepare().system_.elements]
['grass', 'sheep', 'wolves']
Source code in src/skcomplex/systems/biology/ecology/_wolf_sheep.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |