Skip to content

Resources

Resource realizations shared by the economics packages: renewable resources that grow back.

RegrowthInteraction(label, *, target, state, capacity='capacity', growth='growth', relative=False, phase=None)

Bases: MapInteraction

Linear regrowth of a resource held by the agents of a group, by a fixed amount a step up to their capacity.

Every step the resource x of an agent grows by the amount g its parameter growth names, x = min(K, x + g), or by that share of its capacity K when the regrowth is relative, x = min(K, x + g K). It is a map of the agent form, such as the sugar of a patch of Sugarscape or the food of a plot of land.

Parameters:

Name Type Description Default
label str

The label of the interaction, unique among the parts of its system.

required
target Annotated[str, RoleSpec()]

The path of the group whose resource grows back.

required
state str

The name of the state that holds the resource.

required
capacity str

The name of the state or parameter of an agent that holds its capacity.

'capacity'
growth str

The name of the parameter of an agent that holds its regrowth in a step.

'growth'
relative bool

Whether the regrowth is a share of the capacity rather than an amount.

False
phase str | None

The phase of the step the regrowth runs in, or None for the default phase.

None

Examples:

>>> from skcomplex.models.economics.common.resources import RegrowthInteraction
>>> regrowth = RegrowthInteraction('regrowth', target='patches', state='sugar', growth='growback')
>>> regrowth.check().form
'agent'
Source code in src/skcomplex/models/economics/common/resources/_regrowth.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def __init__(
    self,
    label: str,
    *,
    target: Annotated[str, RoleSpec()],
    state: str,
    capacity: str = 'capacity',
    growth: str = 'growth',
    relative: bool = False,
    phase: str | None = None,
) -> None:
    super().__init__(label, target=target, state=state, function=self._get_regrown, form='agent', phase=phase)
    self.capacity = capacity
    self.growth = growth
    self.relative = relative