FirmsPayWages#
- class bamengine.events.production.FirmsPayWages[source]#
Bases:
EventFirms pay wages by deducting wage bill from available funds.
Firms transfer funds to cover their wage obligations. This reduces firm cash (total_funds) by the wage bill amount. Workers receive these wages in the next event (WorkersReceiveWage).
Algorithm
For each firm i:
\[A_i \leftarrow A_i - W_i\]where \(A_i\) = total_funds, \(W_i\) = wage_bill.
Examples
>>> import bamengine as be >>> sim = be.Simulation.init(n_firms=100, seed=42) >>> initial_funds = sim.emp.total_funds.copy() >>> event = sim.get_event("firms_pay_wages") >>> event.execute(sim) >>> # Funds reduced by wage bill >>> import numpy as np >>> reduction = initial_funds - sim.emp.total_funds >>> np.allclose(reduction, sim.emp.wage_bill) True
Notes
This event must execute after FirmsFireWorkers (wage_bill finalized).
See also
WorkersReceiveWageWorkers receive wages (counterpart event)
bamengine.events._internal.production.firms_pay_wagesImplementation
- execute(sim)[source]#
Execute the event’s logic.
Mutates simulation state in-place. This method must be implemented by all Event subclasses.
- Parameters:
sim (
Simulation) – The simulation instance containing all state and configuration.- Returns:
All mutations are in-place.
- Return type:
Examples
Implement execute in a custom event:
>>> from bamengine import event, ops >>> >>> @event ... class CustomPricingEvent: ... def execute(self, sim): ... prod = sim.get_role("Producer") ... # Apply 10% markup to all prices ... new_prices = ops.multiply(prod.price, 1.1) ... ops.assign(prod.price, new_prices)
Access configuration and RNG:
>>> @event ... class StochasticEvent: ... def execute(self, sim): ... shock = sim.config.h_rho ... random_values = sim.rng.uniform(0, shock, size=sim.n_firms) ... # Use random_values in calculations
Notes
The execute method receives full Simulation access, including: - All roles: sim.get_role(“RoleName”) or sim.prod, sim.wrk, etc. - Configuration: sim.config - RNG: sim.rng - Economy state: sim.ec
- __init__()#
- name = 'firms_pay_wages'#