pipeline#

Event Pipeline with explicit execution order.

The Pipeline manages event execution in a fixed, user-defined order. Unlike traditional ECS systems with dependency-based topological sorting, BAM Engine uses explicit ordering to ensure deterministic, reproducible simulation behavior.

Design Philosophy#

Explicit ordering over dependency resolution:

  • Users specify exact execution sequence via YAML

  • No automatic reordering or optimization

  • Guarantees pipeline matches legacy implementation

  • Makes execution trace obvious for debugging

Pipeline YAML Format#

events:
  • event_name # Single execution

  • event_name x N # Repeat N times

Parameter substitution:
  • event_{i} # Substitute {i} with parameter value

Examples

Load and execute the default pipeline:

>>> import bamengine as be
>>> sim = be.Simulation.init(n_firms=100, seed=42)
>>> pipeline = create_default_pipeline(max_M=5, max_H=3, max_Z=2)
>>> pipeline.execute(sim)

Load a custom pipeline from YAML:

>>> from bamengine.core import Pipeline
>>> pipeline = Pipeline.from_yaml("my_custom_pipeline.yml", max_M=5, max_H=3, max_Z=2)

Modify an existing pipeline:

>>> # Insert custom event after standard event
>>> pipeline.insert_after("firms_adjust_price", "my_custom_pricing")
>>>
>>> # Remove an event
>>> pipeline.remove("labor_market_round")
>>>
>>> # Replace an event with custom implementation
>>> pipeline.replace("firms_decide_desired_production", "my_production_rule")

See also

Event : Base class for all events create_default_pipeline() : Factory for canonical BAM pipeline ConfigValidator.validate_pipeline_yaml() : Pipeline validation

Classes#

Pipeline

Event execution pipeline with explicit ordering.

RepeatedEvent

Wrapper for events that execute multiple times per period.

Functions#

create_default_pipeline

Create default BAM simulation event pipeline.