API#

This section contains the API reference for BAM Engine.

Core Classes#

Main classes for running simulations and collecting results.

Simulation

Main simulation facade for BAM Engine.

SimulationResults

Container for simulation results with convenient data access methods.

Extension

Immutable bundle of extension components.

ECS Base Classes#

Base classes for creating custom components in the ECS architecture.

Role

Base class for all roles (components) in the BAM-ECS architecture.

Event

Base class for all events (systems) in the BAM-ECS architecture.

Relationship

Base class for defining relationships between roles.

Agent Roles#

Built-in role components for the three agent types. See Roles for all available roles.

Relationships#

Built-in relationship types for agent connections. See Relationships for details.

Core Infrastructure#

Pipeline, economy state, and agent management infrastructure. Agent identity types (Agent, AgentType) are defined in bamengine.core.agent.

Pipeline

Event execution pipeline with explicit ordering.

Economy

Economy-wide state container for scalar parameters and time series.

Decorators#

Simplified syntax for defining custom components.

role

Decorator to define a Role with automatic inheritance and dataclass.

event

Decorator to define an Event with automatic inheritance and dataclass.

relationship

Decorator to define a Relationship with automatic inheritance and registration.

Registry Functions#

Functions for retrieving and listing registered components.

get_role

Retrieve a role class from the registry by name.

get_event

Retrieve an event class from the registry by name.

get_relationship

Retrieve a relationship class from the registry by name.

list_roles

Return sorted list of all registered role names.

list_events

Return sorted list of all registered event names.

list_relationships

Return sorted list of all registered relationship names.

Operations Module#

NumPy-free operations for writing custom events. See bamengine.ops for the full module documentation.

Arithmetic: add, subtract, multiply, divide

Assignment: assign

Comparisons: equal, not_equal, less, less_equal, greater, greater_equal

Logical: logical_and, logical_or, logical_not

Conditional: where

Element-wise: maximum, minimum, clip

Aggregation: sum, mean, std, min, max, any, all

Array creation: zeros, ones, full, empty, arange

Mathematical: log, exp

Utilities: unique, bincount, isin, argsort, sort

Random: uniform

Type System#

Type aliases for defining custom roles without NumPy knowledge. See Type System for details.

Float, Int, Bool, AgentId, Rng

Configuration#

Configuration and validation classes.

Config

Immutable configuration for BAM simulation parameters.

Utilities#

Helper functions and utilities.

make_rng

Create a new random number generator.