Skip to content

Assembly growth along the assembly index

The numbers of objects at successive assembly indices.

  • Class: AssemblyGrowthSystem
  • Import: from skcomplex.systems.biology.evolution import AssemblyGrowthSystem
  • Field: biology/evolution
  • Topics: assembly theory, selection, open-ended evolution, ode
  • References:
    • Sharma et al. 2023

Use this system

The block imports the class and simulates the system with its default parameters and its tuned run settings.

from skcomplex.systems.biology.evolution import AssemblyGrowthSystem

trajectory = AssemblyGrowthSystem().prepare().simulate()

Parameters

The model parameters take these defaults, and set_params changes them.

Parameter Default
levels 10
k 1.0
alpha 1.0
solver 'auto'
backend 'auto'

Tags

The system with its default parameters has these capability tags, which solvers and analyses check.

Tag Values
Time continuous
Space none
Laws rate
Randomness deterministic
Domains real
Structure fixed

Class

The source of the class shows how it builds its components from its model parameters.

class AssemblyGrowthSystem(BaseSystem):
    """The numbers of objects at successive assembly indices.

    Each level is discovered from the level below.

    The objects of assembly index `a + 1` grow as `dN_{a+1}/dt = k (N_a)^alpha` from a constant pool of building blocks.
    Without selection, `alpha = 1`, every object built before is reused and `N_a(t) = (k t)^a / a!`, the exponential
    expansion of the assembly possible. Selection, `alpha < 1`, reuses only a subset, so the discovery of new objects
    slows down and the deeper levels fill far later. The system has the numbers `levels.N` of the group `levels`,
    ordered by assembly index from 1.

    Args:
        levels:
            The number of assembly indices above the building blocks.

        k:
            The rate of discovery.

        alpha:
            The selectivity of reuse, 1 for no selection.

        label:
            The label of the system, which names it when it is nested in another one.

        solver:
            The solver of the problem, or `'auto'` for the one the system chooses.

        backend:
            The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.

    Examples:
        >>> from skcomplex.systems.biology.evolution import AssemblyGrowthSystem
        >>> AssemblyGrowthSystem(5).prepare().system_.elements[0].size
        5
    """

    field = 'biology/evolution'
    topics = ('assembly theory', 'selection', 'open-ended evolution', 'ode')
    references = ('Sharma et al. 2023',)
    until = 10.0
    dt = 0.1

    def __init__(
        self,
        levels: int = 10,
        *,
        k: float = 1.0,
        alpha: float = 1.0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.levels = levels
        self.k = k
        self.alpha = alpha

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the numbers of objects at successive assembly indices.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        group = AssemblyLevelElement('levels', k=self.k, alpha=self.alpha, size=self.levels)
        discovery = AssemblyDiscoveryInteraction('discovery', target='levels')
        self.system_ = System(self.label, elements=[group], interactions=[discovery])

Components

The system uses these element and interaction classes, each with its nearest class of the core.

Elements:

  • AssemblyLevelElement, from Element

Interactions:

  • AssemblyDiscoveryInteraction, from Interaction
class AssemblyLevelElement(Element):
    """Objects of one assembly index.

    They are discovered from the objects one assembly step below them.

    In a group ordered by assembly index, an `AssemblyDiscoveryInteraction` grows the objects of index `a + 1` as
    `dN_{a+1}/dt = k (N_a)^alpha`, Eq. (3) of Sharma et al. (2022), where the first member reads the constant pool
    `N_0` of building blocks. The selectivity `alpha = 1` reuses every object built before, and `alpha < 1` only a
    subset, the signature of selection.

    Args:
        label:
            The label of the level or of the group of levels.

        N:
            The initial number of objects.

        k:
            The rate of discovery.

        alpha:
            The selectivity of reuse.

        size:
            The number of levels, or `None` for one.

    Examples:
        >>> from skcomplex.systems.biology.evolution import AssemblyLevelElement
        >>> AssemblyLevelElement('levels', alpha=0.5).alpha
        0.5
    """

    def __init__(
        self,
        label: str,
        *,
        N: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.0,
        k: Annotated[float | Array, RealSet.closed_open(0, oo)] = 1.0,
        alpha: Annotated[float | Array, RealSet.closed(0, 1)] = 1.0,
        size: int | None = None,
    ) -> None:
        super().__init__(label, size=size)
        self.N = N
        self.k = k
        self.alpha = alpha

class AssemblyDiscoveryInteraction(Interaction):
    """Discovery of the objects of every assembly level from the level below, `dN_{a+1}/dt = k (N_a)^alpha`.

    The rate `k` and the selectivity `alpha` are values of the levels, an `AssemblyLevelElement`, and the first level
    is discovered from the pool of building blocks `N0`.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the group of levels, ordered by assembly index.

        N0:
            The number of building blocks below the first level.

    Examples:
        >>> from skcomplex.systems.biology.evolution import AssemblyDiscoveryInteraction
        >>> AssemblyDiscoveryInteraction('discovery', target='levels').N0
        1.0
    """

    law_classes = (RateLaw,)

    def __init__(self, label: str, *, target: Role, N0: float = 1.0) -> None:
        super().__init__(label)
        self.target = target
        self.N0 = N0

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the discovery of the objects of every level from the level below.

        Args:
            context:
                The namespace of the group of levels.
        """
        super()._prepare(context)
        s = context.target
        below = shift_member(s.N, -1, boundary='fixed', fill=self.N0)
        self.laws_: list[BaseLaw] = [RateLaw(s.N, s.k * below**s.alpha)]

Equations

The equations are those that symbolic returns for the system with its default parameters.

levels.N[i]: diff(N_levels(t), t) == N_levels__shift0^alpha_levels*k_levels