RepeatedEvent#

class bamengine.core.pipeline.RepeatedEvent(event, n_repeats)[source]#

Bases: object

Wrapper for events that execute multiple times per period.

Used for market rounds where agents interact over multiple rounds (e.g., job applications, loan applications, shopping rounds).

Variables:
  • event (Event) – The event to repeat.

  • n_repeats (int) – Number of times to execute the event.

Examples

Wrap an event to repeat it multiple times:

>>> from bamengine.core.registry import get_event
>>> sim = Simulation.init(n_firms=100, seed=42)
>>> event_cls = get_event("labor_market_round")
>>> event = event_cls()
>>> repeated = RepeatedEvent(event, n_repeats=5)
>>> repeated.execute(sim)  # Executes 5 times

See also

Pipeline.from_event_list

Build pipeline with repeated events

event#
n_repeats#
execute(sim)[source]#

Execute the event n_repeats times.

Parameters:

sim (Simulation) – Simulation instance to operate on.

Returns:

All mutations are in-place.

Return type:

None

property name#

Return the name of the underlying event.

Returns:

Event name in snake_case.

Return type:

str

__init__(event, n_repeats)#