Producer#
- class bamengine.roles.producer.Producer(production, production_prev, inventory, expected_demand, desired_production, labor_productivity, breakeven_price, price, prod_shock=None, prod_mask_up=None, prod_mask_dn=None, price_shock=None)[source]#
Bases:
RoleProducer role for firms.
Represents the production and pricing state for firms. Each array index corresponds to a firm ID (0 to n_firms-1).
- Parameters:
production (
Float1D) – Current period’s production level (units of goods produced this period). Set byfirms_run_productionevent, zeroed at start of planning phase.production_prev (
Float1D) – Previous period’s production level, used as planning signal. Set byfirms_run_productionalongside production, retained across the planning phase for use infirms_decide_desired_production.inventory (
Float1D) – Unsold goods from previous periods.expected_demand (
Float1D) – Expected demand based on past sales history.desired_production (
Float1D) – Target production level for next period (based on expected demand).labor_productivity (
Float1D) – Units of output per worker.breakeven_price (
Float1D) – Minimum price needed to cover wage costs.price (
Float1D) – Current selling price for goods.prod_shock (
Float1D, optional) – Scratch buffer for production shock calculations (not persisted).prod_mask_up (
Bool1D, optional) – Scratch buffer for upward production adjustment mask (not persisted).prod_mask_dn (
Bool1D, optional) – Scratch buffer for downward production adjustment mask (not persisted).price_shock (
Float1D, optional) – Scratch buffer for price shock calculations (not persisted).
Examples
Access from simulation:
>>> import bamengine as bam >>> sim = bam.Simulation.init(n_firms=100, seed=42) >>> prod = sim.prod >>> prod.price.shape (100,) >>> prod.production.mean() 52.5
Check which firms have inventory:
>>> import numpy as np >>> has_inventory = prod.inventory > 0 >>> has_inventory.sum() 15
Find firms with high productivity:
>>> high_prod_mask = prod.labor_productivity > 2.0 >>> high_prod_ids = np.where(high_prod_mask)[0] >>> high_prod_ids.shape (45,)
Notes
The Producer role is one of three roles assigned to firms in the BAM model:
Producer: production and pricing
Employer: labor hiring and wages (see Employer)
Borrower: finance and credit (see Borrower)
These roles share some arrays (e.g., wage_bill) for memory efficiency.
See also
EmployerLabor hiring role for firms
BorrowerFinancial role for firms
planningProduction planning logic
productionProduction execution logic
- production#
Current period’s production level (units of goods produced).
- production_prev#
Previous period’s production level, used as planning signal.
- inventory#
Unsold goods carried from previous periods.
- expected_demand#
Expected demand based on past sales history.
- desired_production#
Target production level for next period.
- labor_productivity#
Units of output per worker.
- __init__(production, production_prev, inventory, expected_demand, desired_production, labor_productivity, breakeven_price, price, prod_shock=None, prod_mask_up=None, prod_mask_dn=None, price_shock=None)#
- name = 'Producer'#
- breakeven_price#
Minimum price needed to cover wage costs.
- price#
Current selling price for goods.
- prod_shock#
Scratch buffer for production shock calculations.
- prod_mask_up#
Scratch buffer for upward production adjustment mask.
- prod_mask_dn#
Scratch buffer for downward production adjustment mask.
- price_shock#
Scratch buffer for price shock calculations.