WorkersReceiveWage#
- class bamengine.events.production.WorkersReceiveWage[source]#
Bases:
EventWorkers receive wage income from employment.
Employed workers add their wages to their income (Consumer role). This is the counterpart to FirmsPayWages: money flows from firms to households.
Algorithm
For each employed worker j (\(\text{employer}_j \geq 0\)):
\[I_j \leftarrow I_j + w_j\]where \(I_j\) = income, \(w_j\) = wage.
Examples
>>> import bamengine as be >>> sim = be.Simulation.init(n_households=500, seed=42) >>> initial_income = sim.con.income.copy() >>> event = sim.get_event("workers_receive_wage") >>> event.execute(sim) >>> # Employed workers gained income >>> import numpy as np >>> employed_mask = sim.wrk.employed >>> income_gain = sim.con.income - initial_income >>> np.allclose(income_gain[employed_mask], sim.wrk.wage[employed_mask]) True
Notes
This event must execute after FirmsPayWages (firms have paid).
Only employed workers receive wages. Unemployed workers gain no income.
See also
FirmsPayWagesFirms pay wages (counterpart event)
bamengine.events._internal.production.workers_receive_wageImplementation
- 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 = 'workers_receive_wage'#