FirmsPlanBreakevenPrice#
- class bamengine.events.planning.FirmsPlanBreakevenPrice[source]#
Bases:
EventCalculate planning-phase breakeven price from previous period’s costs.
Computes minimum cost-covering price using last period’s wage bill and interest obligations as the numerator, and desired production (the firm’s current-period output target) as the denominator. This provides an early price signal before the labor and credit markets operate.
Algorithm
For each firm i:
Calculate total costs: \(C_i = W_{i,t-1} + I_{i,t-1}\)
Calculate breakeven: \(P_{\text{breakeven}} = C_i / Y^d_{i,t}\)
Apply cap (if configured): \(P_{\text{breakeven}} = \min(P_{\text{breakeven}}, P_i \times \text{cap\_factor})\)
where \(W_{t-1}\) is previous period’s wage bill, \(I_{t-1}\) is previous period’s interest, and \(Y^d_{t}\) is the desired production for the current period (freshly computed by FirmsDecideDesiredProduction).
Notes
At planning time, wage_bill and LoanBook interest naturally contain previous period’s values (recomputed only in Phases 2-3). This event exploits that timing to avoid introducing separate “previous expenses” fields.
Must run AFTER firms_decide_desired_production (needs desired_production).
See also
FirmsPlanPricePlanning-phase price adjustment using this breakeven
bamengine.events._internal.planning.firms_plan_breakeven_priceImplementation
- 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_plan_breakeven_price'#