Skip to content

epymorph.simulator.basic.mm_exec

MMExecutor is part of the internal workings of BasicSimulator, implementing the logic for processing the movement phase of the simulation. Most users will not use this module directly.

MovementExecutor

MovementExecutor(
    rume: RUME,
    world: World,
    data: DataResolver,
    rng: Generator,
)

The standard implementation of movement execution.

rume : The RUME. world : The world state. data_resolver : The evaluated data attributes of the simulation. rng : The simulation RNG.

apply

apply(tick: Tick) -> None

Apply movement for this tick, mutating the world state.

Parameters:

  • tick (Tick) –

    The tick to process.

calculate_travelers

calculate_travelers(
    clause_name: str,
    clause_mobility: NDArray[bool_],
    requested_movers: NDArray[SimDType],
    available_movers: NDArray[SimDType],
    tick: Tick,
    rng: Generator,
) -> OnMovementClause

Calculate the number of travelers resulting from this movement clause for this tick. This evaluates the requested number movers, modulates that based on the available movers, then selects exactly which individuals (by compartment) should move.

Parameters:

  • clause_name (str) –

    The movement clause to process.

  • clause_mobility (NDArray[bool_]) –

    The mask describing which compartments are subject to movement.

  • requested_movers (NDArray[SimDType]) –

    The movers requested by the clause, an (N,N) array.

  • available_movers (NDArray[SimDType]) –

    The number of eligible movers in each location, an (N,C) array.

  • tick (Tick) –

    The tick to process.

  • rng (Generator) –

    The source of randomness.

Returns:

  • OnMovementClause

    The effecitve movement, as an (N,N,C) array; "from source to destination, by compartment".