Economy#

class bamengine.Economy(avg_mkt_price, min_wage, min_wage_rev_period, avg_mkt_price_history, inflation_history, exiting_firms=<factory>, exiting_banks=<factory>, collapsed=False)[source]#

Bases: object

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

Stores global economy state including policy parameters (min wage), market statistics (average price, unemployment), and time-series histories. Unlike roles which store per-agent state, Economy stores single values or time series affecting the entire economy.

Variables:
  • avg_mkt_price (float) – Current average market price across all firms (P̄).

  • min_wage (float) – Minimum wage floor enforced by policy.

  • min_wage_rev_period (int) – Period when min wage was last revised.

  • avg_mkt_price_history (Float1D) – Time series of average market prices, shape (t+1,).

  • inflation_history (Float1D) – Time series of inflation rates, shape (t+1,).

  • exiting_firms (Idx1D) – Transient list of firms exiting this period (flushed each period).

  • exiting_banks (Idx1D) – Transient list of banks exiting this period (flushed each period).

  • collapsed (bool) – Termination flag indicating simulation should stop.

Examples

Access economy state in simulation:

>>> import bamengine as bam
>>> sim = bam.Simulation.init(n_firms=100, seed=42)
>>> sim.ec.avg_mkt_price
1.0
>>> sim.ec.min_wage
1.0
>>> len(sim.ec.avg_mkt_price_history)
1

Check time series after running:

>>> sim.run(n_periods=10)
>>> len(sim.ec.avg_mkt_price_history)
11

Notes

Economy is not a Role - it doesn’t inherit from the Role base class because it stores economy-wide state, not per-agent arrays.

See also

Role

Base class for per-agent state components

Simulation

Main simulation facade with ec attribute

avg_mkt_price#

Current average market price across all firms.

min_wage#

Minimum wage floor enforced by policy.

min_wage_rev_period#

Period when the minimum wage was last revised.

avg_mkt_price_history#

Time series of average market prices, length t + 1.

__init__(avg_mkt_price, min_wage, min_wage_rev_period, avg_mkt_price_history, inflation_history, exiting_firms=<factory>, exiting_banks=<factory>, collapsed=False)#
inflation_history#

Time series of inflation rates, length t + 1.

exiting_firms#

Indices of firms exiting this period (flushed each period).

exiting_banks#

Indices of banks exiting this period (flushed each period).

collapsed#

Whether the simulation has collapsed and should stop.