Stigmergy
Stigmergy realizations shared by the biology packages: marks that animals leave in the environment.
EvaporationInteraction(label, *, target, state='level', evaporation='evaporation')
Bases: RateInteraction
Evaporation of a mark, dm/dt = -e m, where the rate e is a parameter of the element that holds the mark.
Animals leave marks such as pheromone or emotional traces in the cells of a field, and every mark evaporates at the rate its cell holds, so the rate can vary from cell to cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Annotated[str, RoleSpec()]
|
The path of the element or field that holds the mark. |
required |
state
|
str
|
The name of the state of the target that holds the mark. |
'level'
|
evaporation
|
str
|
The name of the parameter of the target that holds the rate of evaporation. |
'evaporation'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The state or the name of the rate of evaporation is not a name. |
Examples:
>>> from typing import Annotated
>>> from skcomplex.core.elements import Element
>>> from skcomplex.core.system import System
>>> from skcomplex.engine.runtime import Simulation
>>> from skcomplex.models.biology.common.stigmergy import EvaporationInteraction
>>> from skcomplex.specs import ParameterSpec, StateSpec
>>> class ScentElement(Element):
... def __init__(
... self, label, level: Annotated[float, StateSpec()] = 8.0, e: Annotated[float, ParameterSpec()] = 0.5
... ):
... super().__init__(label)
... self.level = level
... self.e = e
>>> evaporation = EvaporationInteraction('evaporation', target='scent', state='level', evaporation='e')
>>> system = System(elements=[ScentElement('scent')], interactions=[evaporation])
>>> trajectory = Simulation(system, dt=0.01).check().prepare().run(until=2.0).trajectory_
>>> round(float(trajectory.values('scent.level')[-1]), 3)
2.943
Source code in src/skcomplex/models/biology/common/stigmergy/_evaporation.py
60 61 62 63 64 65 66 67 68 69 | |