Config#

class bamengine.config.schema.Config(h_rho, h_xi, h_phi, h_eta, max_M, max_H, max_Z, labor_productivity, theta, beta, delta, r_bar, v, max_loan_to_net_worth=2.0, max_leverage=10.0, cap_factor=None, job_search_method='all_firms', new_firm_size_factor=0.5, new_firm_production_factor=0.5, new_firm_wage_factor=0.5, new_firm_price_markup=1.15, consumer_matching='loyalty')[source]#

Bases: object

Immutable configuration for BAM simulation parameters.

This dataclass groups all simulation hyperparameters in one place, making them easier to manage and pass around. Config instances are created internally by Simulation.init() after parameter validation.

Parameters:
  • h_rho (float) – Maximum production-growth shock (0 to 1).

  • h_xi (float) – Maximum wage-growth shock (0 to 1).

  • h_phi (float) – Maximum bank operational costs shock (0 to 1).

  • h_eta (float) – Maximum price-growth shock (0 to 1).

  • max_M (int) – Maximum job applications per unemployed worker (positive).

  • max_H (int) – Maximum loan applications per firm (positive).

  • max_Z (int) – Maximum firm visits per consumer (positive).

  • labor_productivity (float) – Labor productivity (goods per worker, positive).

  • theta (int) – Job contract base duration in periods (positive).

  • beta (float) – Propensity to consume exponent (positive).

  • delta (float) – Dividend payout ratio (0 to 1).

  • r_bar (float) – Base interest rate (0 to 1).

  • v (float) – Bank capital requirement ratio (0 to 1).

  • max_loan_to_net_worth (float, optional) – Maximum loan as multiple of borrower’s net worth (default: 2.0). Caps individual loans at X × net_worth. Set to 0 for no limit.

  • max_leverage (float, optional) – Maximum leverage ratio (fragility cap) for interest rate calculation. Caps the fragility used in rate formula to prevent extreme rates. Set to 0 for no limit. Default: 10.0.

  • cap_factor (float or None, optional) – Cap factor for breakeven price calculation (>= 1.0 if specified). If None, no cap is applied.

  • job_search_method (str, optional) – How unemployed workers sample firms for job applications: “vacancies_only” = sample only from firms with open vacancies “all_firms” = sample from ALL firms (applications to non-hiring firms are wasted) (default). Default: “all_firms”.

  • new_firm_size_factor (float, optional) – Scale factor for new firm net worth vs survivor mean. Default: 0.5.

  • new_firm_production_factor (float, optional) – Scale factor for new firm production vs survivor mean. Default: 0.5.

  • new_firm_wage_factor (float, optional) – Scale factor for new firm wage offer vs survivor mean. Default: 0.5.

  • new_firm_price_markup (float, optional) – Price markup for new firms vs avg market price. Default: 1.15.

Examples

Config instances are typically created by Simulation.init():

>>> import bamengine as be
>>> sim = be.Simulation.init(n_firms=100, seed=42)
>>> cfg = sim.config
>>> cfg.h_rho
0.1
>>> cfg.max_M
4

Manual creation (rarely needed):

>>> from bamengine.config import Config
>>> cfg = Config(
...     h_rho=0.1,
...     h_xi=0.1,
...     h_phi=0.1,
...     h_eta=0.1,
...     max_M=4,
...     max_H=2,
...     max_Z=3,
...     labor_productivity=0.5,
...     theta=8,
...     beta=2.5,
...     delta=0.10,
...     r_bar=0.02,
...     v=0.10,
...     cap_factor=None,
... )
>>> cfg.beta
2.5

Config is immutable:

>>> cfg.beta = 3.0
FrozenInstanceError: cannot assign to field 'beta'

Notes

Config is a simple data container with no validation logic. All validation happens in ConfigValidator before Config creation. This separation keeps concerns cleanly separated: Config holds data, ConfigValidator ensures data validity.

See also

ConfigValidator

Validates parameters before Config creation

bamengine.simulation.Simulation.init

Factory for creating configured simulations

h_rho#

Maximum production-growth shock (0 to 1).

h_xi#

Maximum wage-growth shock (0 to 1).

h_phi#

Maximum bank operational costs shock (0 to 1).

h_eta#

Maximum price-growth shock (0 to 1).

max_M#

Maximum job applications per unemployed worker.

max_H#

Maximum loan applications per firm.

max_Z#

Maximum firm visits per consumer.

labor_productivity#

Labor productivity in goods per worker.

theta#

Job contract base duration in periods.

beta#

Propensity to consume exponent.

delta#

Dividend payout ratio (0 to 1).

__init__(h_rho, h_xi, h_phi, h_eta, max_M, max_H, max_Z, labor_productivity, theta, beta, delta, r_bar, v, max_loan_to_net_worth=2.0, max_leverage=10.0, cap_factor=None, job_search_method='all_firms', new_firm_size_factor=0.5, new_firm_production_factor=0.5, new_firm_wage_factor=0.5, new_firm_price_markup=1.15, consumer_matching='loyalty')#
r_bar#

Base interest rate (0 to 1).

v#

Bank capital requirement ratio (0 to 1).

max_loan_to_net_worth#

Maximum loan as multiple of borrower’s net worth (0 = no limit).

max_leverage#

Maximum leverage ratio (fragility cap) for interest rate calculation (0 = no cap).

cap_factor#

Cap factor for breakeven price calculation (>= 1.0 if set, None = no cap).

job_search_method#

"vacancies_only" or "all_firms".

Type:

How unemployed workers sample firms

new_firm_size_factor#

Scale factor for new firm net worth vs survivor mean.

new_firm_production_factor#

Scale factor for new firm production vs survivor mean.

new_firm_wage_factor#

Scale factor for new firm wage offer vs survivor mean.

new_firm_price_markup#

Price markup for new firms vs average market price.

consumer_matching#

"loyalty" or "random".

Type:

Consumer matching strategy