Skip to content

Stigmergy

Stigmergy realizations shared by the biology packages.

They cover marks that animals leave in the environment.

EvaporationInteraction(label, *, target, state='level', evaporation='evaporation')

Bases: Interaction

Evaporation of a mark, dm/dt = -e m.

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 Role

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 skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.common.stigmergy import EvaporationInteraction
>>> evaporation = EvaporationInteraction('evaporation', target='scent', state='level', evaporation='e')
>>> system = System(elements=[Element('scent', values={'level': 8.0, 'e': 0.5})], interactions=[evaporation])
>>> trajectory = system.prepare().simulate(until=2.0, dt=0.01)
>>> round(float(trajectory.get_values('scent.level')[-1]), 3)
2.943
Source code in src/skcomplex/systems/biology/common/stigmergy/_evaporation.py
57
58
59
60
61
62
63
64
65
66
67
68
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'level',
    evaporation: str = 'evaporation',
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.evaporation = evaporation