Code reference
In this page we document the functions which constitute the bulk of BeforeIT.jl functionality.
Agent types
BeforeIT.Aggregates
— TypeThis is a Aggregates type. It is used to store the aggregate variables of the economy. Note that t
is an integer, while the rest are floats or vectors of floats.
Fields
Y [vector]
: GDP data + predictionspi_ [vector]
: inflation data + predictionsP_bar
: Global price indexP_bar_g [vector]
: Producer price index for principal good gP_bar_HH
: Consumer price indexP_bar_CF
: Capital price indexP_bar_h
: CPI_hP_bar_CF_h
: Capital price index _hY_e
: Expected GDPgamma_e
: Expected growthpi_e
: Expected inflationt
: Time index
BeforeIT.Bank
— TypeThis is a Bank type. It represents the bank of the model.
Fields
E_k
: equity capital (common equity) of the bankPi_k
: Profits of the bankPi_e_k
: Expected profits of the bankD_k
: Residual and balancing item on the bank’s balance sheetr
: Rate for loans and morgages
Household fields (bank' owner)
Y_h
: Net disposable income of bank owner (investor)C_d_h
: Consumption budgetI_d_h
: Investment budgetC_h
: Realised consumptionI_h
: Realised investmentK_h
: Capital stockD_h
: Deposits
BeforeIT.CentralBank
— TypeThis is a CentralBank type. It represents the central bank of the model.
Fields
r_bar
: Nominal interest rater_G
: Interest rate on government bondsrho
: Parameter for gradual adjustment of the policy rater_star
: Real equilibrium interest ratepi_star
: Inflation target by CBxi_pi
: Weight the CB puts on inflation targetingxi_gamma
: Weight placed on economicE_CB
: Central bank equity
BeforeIT.Firms
— TypeThis is a Firms type. Each field is an array which stores the values for all the firms in the economy. Note that the G_i
, N_i
and V_i
fields are integers, while the rest are floats.
For all fields the entry at index i
corresponds to the i
th firm.
Fields
G_i
: Principal productalpha_bar_i
: Average productivity of laborbeta_i
: Productivity of intermediate consumptionkappa_i
: Productivity of capitalw_i
: Wagesw_bar_i
: Average wage ratedelta_i
: Depreciation rate for capitaltau_Y_i
: Net tax rate on productstau_K_i
: Net tax rate on productionN_i
: Number of persons employedY_i
: Production of goodsQ_i
: Sales of goodsQ_d_i
: Demand for goodsP_i
: PriceS_i
: InventoriesK_i
: Capital, in real termsM_i
: Intermediate goods/services and raw materials, in real termsL_i
: Outstanding loanspi_bar_i
: Operating marginD_i
: Deposits of the firmPi_i
: ProfitsV_i
: VacanciesI_i
: InvestmentsE_i
: EquityP_bar_i
: Price indexP_CF_i
: Price indexDS_i
: Differnece in stock of final goodsDM_i
: Difference in stock of intermediate goodsDL_i
: Obtained loansDL_d_i
: Target loansK_e_i
: Expected capitalL_e_i
: Expected loansQ_s_i
: Expected salesI_d_i
: Desired investmentsDM_d_i
: Desired materialsN_d_i
: Desired employmentPi_e_i
: Expected profits
Household fields (firms' owners)
Y_h
: Net disposable income of firm owner (investor)C_d_h
: Consumption budgetI_d_h
: Investment budgetC_h
: Realised consumptionI_h
: Realised investmentK_h
: Capital stockD_h
: Deposits of the owner of the firms
BeforeIT.Government
— TypeThis is a Government type. It represents the government of the model.
Fields
alpha_G
: Autoregressive coefficient for government consumptionbeta_G
: Scalar constant for government consumptionsigma_G
: Variance coefficient for government consumptionY_G
: Government revenuesC_G
: Consumption demand of the general governmentL_G
: Loans taken out by the governmentsb_inact
: Social benefits for inactive personssb_other
: Social benefits for allC_d_j [vector]
: Local governments consumption demandC_j
: Realised government consumptionP_j
: Price inflation of government goods <- ??
BeforeIT.Model
— TypeThis is a Model type. It is used to store all the agents of the economy.
Fields
w_act
: Workers that are activew_inact
: Workers that are inactivefirms
: Firmsbank
: Bankcb
: CentralBankgov
: Governmentrotw
: RestOfTheWorldagg
: Aggregates
BeforeIT.RestOfTheWorld
— TypeThis is a RestOfTheWorld type. It represents the rest of the world of the model.
Fields
alpha_E
: Autoregressive coefficient for exportsbeta_E
: Scalar constant for exportssigma_E
: Variance coefficient for exportsalpha_I
: Autoregressive coefficient for importsbeta_I
: Scalar constant for importssigma_I
: Variance coefficient for importsY_EA
: GDP euro areagamma_EA
: Growth euro areapi_EA
: Inflation euro areaalpha_pi_EA
: Autoregressive coefficient for euro area inflationbeta_pi_EA
: Autoregressive coefficient for euro area inflation Scalar constant for euro area inflationsigma_pi_EA
: Variance coefficient for euro area inflationalpha_Y_EA
: Autoregressive coefficient for euro area GDPbeta_Y_EA
: Autoregressive coefficient for euro area GDP Scalar constant for euro area GDPsigma_Y_EA
: Variance coefficient for euro area GDPD_RoW
: Net creditor/debtor position of the national economy to the rest of the worldY_I
: Supply of imports (in real terms)C_E
: Total demand for exportsC_d_l [vector]
: Demand for exports of specific productC_l
: Realised consumption by foreign consumersY_m [vector]
: Supply of imports per sectorQ_m [vector]
: Sales for imports per sectorQ_d_m [vector]
: Demand for goodsP_m [vector]
: Price of imports per sectorP_l
: Price inflation of exports <- ??
BeforeIT.Workers
— TypeThis is a Workers. Each field is an array which stores the values for all the workers in the economy. Note that the O_h
field is an integer, while the rest are floats.
For all fields the entry at index i
corresponds to the i
th worker.
Fields
Y_h
: Net disposable income of worker owner (investor)D_h
: DepositsK_h
: Capital stockw_h
: Wages (0 if inactive or unemployed)O_h
: Occupation (0 if unemployed, -1 if inactive)C_d_h
: Consumption budgetI_d_h
: Investment budgetC_h
: Realised consumptionI_h
: Realised investment
Initialisation function
BeforeIT.init_model
— Functioninit_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)
Initializes the model with given parameters and initial conditions.
Parameters:
parameters
: A dictionary containing the model parameters.- initial_conditions: A dictionary containing the initial conditions.
- T (integer): The time horizon of the model.
- typeInt: (optional, default: Int64): The data type to be used for integer values.
- typeFloat: (optional, default: Float64): The data type to be used for floating-point values.
Returns:
- model::Model: The initialized model.
BeforeIT.update_variables_with_totals!
— Methodupdate_variables_with_totals!(model::Model)
Update the variables in the given model
with some global quantities obtained from all agents. This is the last step in the initialization process and it must be performed after all agents have been initialized.
Arguments
model::Model
: The model object to update.
Returns
- Nothing
Functions to run an entire simulation
CommonSolve.step!
— Methodstep!(model; multi_threading = false)
This function simulates a single epoch the economic model, updating various components of the model based the interactions between different economic agents. It accepts a model
object, which encapsulates the state for the simulation, and an optional boolean parameter multi_threading
to enable or disable multi-threading.
Key operations performed include:
- Financial adjustments for firms and banks, including insolvency checks and profit calculations.
- Economic expectations and adjustments, such as growth, inflation, and central bank rates.
- Labor and credit market operations, including wage updates and loan processing.
- Household economic activities, including consumption and investment budgeting.
- Government and international trade financial activities, including budgeting and trade balances.
- General market matching and accounting updates to reflect changes in economic indicators and positions.
The function updates the model in-place and does not return any value.
BeforeIT.ensemblerun
— Methodensemblerun(model, n_sims; shock = NoShock(), multi_threading = true)
A function that runs n_sims
simulations in parallel with multiple threading and returns a vector of data objects of dimension n_sims
.
Arguments
model
: The model configuration used to simulate.n_sims
: The number of simulations to run in parallel.
Returns
data_vector
: A vector containing the data objects collected during each simulation.
BeforeIT.run!
— Methodrun!(model; shock = NoShock())
Run a single simulation based on the provided model
. The simulation runs for a number of epochs specified by model.prop.T
.
Arguments
model::Model
: The model configuration used for the simulation.
Returns
data::Data
: The data collected during the simulation.
Details
The function initializes the data using Bit.init_data(model)
, then iteratively updates the model and data for each epoch using Bit.step!(model)
and Bit.update_data!(data, model)
respectively.
Example
```julia model = Bit.initmodel(parameters, initialconditions, T) data = run!(model)
Firms actions
BeforeIT.firms_deposits
— Methodfirms_deposits(firms, model)
Calculate the new deposits of firms.
Arguments
firms
: Firms objectmodel
: Model object
Returns
DD_i
: Vector of new deposits
The new deposits DD_i
are calculated as follows:
DD_i = sales + labour_cost + material_cost + taxes_products + taxes_production + corporate_tax + dividend_payments + interest_payments + interest_received + investment_cost + new_credit + debt_installment
where:
sales = P_i * Q_i
labour_cost = (1 + tau_SIF) * w_i * N_i * P_bar_HH
material_cost = -DM_i * P_bar_i
taxes_products = -tau_Y_i * P_i * Y_i
taxes_production = -tau_K_i * P_i * Y_i
corporate_tax = -tau_FIRM * pos(Pi_i)
dividend_payments = -theta_DIV * (1 - tau_FIRM) * pos(Pi_i)
interest_payments = -r * (L_i + pos(-D_i))
interest_received = r_bar * pos(D_i)
investment_cost = -P_CF_i * I_i
new_credit = DL_i
debt_installment = -theta * L_i
BeforeIT.firms_equity
— Methodfirms_equity(firms, model)
Calculate the equity of firms.
Arguments
firms
: Firms objectmodel
: Model object
Returns
E_i
: Vector of equity
The equity E_i
is calculated as follows:
\[E_i = D_i + M_i * \sum(a_{sg}[:, G_i] * \bar{P}_g) + P_i * S_i + \bar{P}_{CF} * K_i - L_i\]
where:
D_i
: DepositsM_i
: Intermediate goodsa_sg
: Technology coefficient of the gth product in the sth industryG_i
: Vector of goodsP_bar_g
: Producer price index for principal good gP_i
: PriceS_i
: StockP_bar_CF
: Capital price indexK_i
: Capital stockL_i
: Loans
BeforeIT.firms_expectations_and_decisions
— Methodfirms_expectations_and_decisions(firms, model)
Calculate the expectations and decisions of firms. That is: compute firm quantity, price, investment and intermediate-goods, employment decisions, expected profits, and desired/expected loans and capital.
Arguments
firms
: Firms objectmodel
: Model object
Returns
Q_s_i
: Vector of desired quantitiesI_d_i
: Vector of desired investmentsDM_d_i
: Vector of desired intermediate goodsN_d_i
: Vector of desired employmentPi_e_i
: Vector of expected profitsDL_d_i
: Vector of desired new loansK_e_i
: Vector of expected capitalL_e_i
: Vector of expected loansP_i
: Vector of prices
BeforeIT.firms_loans
— Methodfirms_loans(firms, model)
Calculate the new loans of firms.
Arguments
firms
: Firms objectmodel
: Model object
Returns
L_i
: Vector of new loans
The new loans L_i
are calculated as follows:
\[L_i = (1 - theta) * L_i + DL_i\]
where:
theta
: Rate of repaymentL_i
: LoansDL_i
: Acquired new loans
BeforeIT.firms_production
— Methodfirms_production(firms)
Calculate the production of firms.
Arguments
firms
: Firms object
Returns
Y_i
: Vector of production
The production Y_i
is computed using a Leontief technology.
BeforeIT.firms_profits
— Methodfirms_profits(firms, model)
Calculate the profits of firms.
Arguments
firms
: Firms objectmodel
: Model object
Returns
Pi_i
: Vector of profits
The profits Pi_i
are calculated as follows:
Pi_i = in_sales + in_deposits - out_wages - out_expenses - out_depreciation - out_taxes_prods - out_taxes_capital - out_loans
where:
in_sales = P_i * Q_i + P_i * DS_i
in_deposits = r_bar * pos(D_i)
out_wages = (1 + tau_SIF) * w_i * N_i * P_bar_HH
out_expenses = 1 / beta_i * P_bar_i * Y_i
out_depreciation = delta_i / kappa_i * P_CF_i * Y_i
out_taxes_prods = tau_Y_i * P_i * Y_i
out_taxes_capital = tau_K_i * P_i * Y_i
out_loans = r * (L_i + pos(-D_i))
BeforeIT.firms_stocks
— Methodfirms_stocks(firms)
Calculate the stocks of firms.
Arguments
firms
: Firms object
Returns
K_i
: Vector of capital stockM_i
: Vector of intermediate goodsDS_i
: Vector of differneces in stock of final goodsS_i
: Vector of stock of final goods
The stocks are calculated as follows:
K_i = K_i - delta_i / kappa_i * Y_i + I_i
M_i = M_i - Y_i / beta_i + DM_i
DS_i = Y_i - Q_i
S_i = S_i + DS_i
BeforeIT.firms_wages
— Methodfirms_wages(firms)
Calculate the wages set by firms.
Arguments
firms
: Firms object
Returns
w_i
: Vector of wages
BeforeIT.init_firms
— Methodinit_firms(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)
Initialize firms with given parameters and initial conditions.
Arguments
parameters
: The parameters for initializing the firms.initial_conditions
: The initial conditions for the firms.typeInt
: (optional) The integer type to be used. Default isInt64
.typeFloat
: (optional) The floating-point type to be used. Default isFloat64
.
Returns
- firms::Firms: The initialized firms.
- firms_args::Tuple: The arguments used to initialize the firms.
BeforeIT.leontief_production
— Methodleontief_production(Q_s_i, N_i, alpha_i, K_i, kappa_i, M_i, beta_i)
Calculate the production function of firms.
Arguments
Q_s_i
: Vector of desired quantitiesN_i
: Vector of employmentalpha_i
: Vector of labour productivityK_i
: Vector of capital stockkappa_i
: Vector of capital productivityM_i
: Vector of intermediate goodsbeta_i
: Vector of intermediate goods productivity
Returns
Y_i
: Vector of production
The Leontief production function Y_i
is calculated as follows:
\[Y_i = \min(Q_s_i, \min(N_i \cdot \alpha_i, \min(K_i \cdot \kappa_i, M_i \cdot \beta_i)))\]
Households actions
Government actions
BeforeIT.gov_expenditure
— Methodgov_expenditure(gov::AbstractGovernment, model)
Computes government expenditure on consumption and transfers to households.
Arguments
gov
: government objectmodel
: model object
Returns
C_G
: government consumptionC_d_j
: local government consumptions
BeforeIT.gov_loans
— Methodgov_loans(gov::AbstractGovernment, model, Y_G)
Computes government new government debt.
Arguments
gov::AbstractGovernment
: government objectmodel
: model object
Returns
L_G
: new government debt
BeforeIT.gov_revenues
— Methodgov_revenues(model)
Computes government revenues from taxes and social security contributions. The government collects taxes on labour income, capital income, value added, and corporate income. It also collects social security contributions from workers and firms. The government also collects taxes on consumption and capital formation. Finally, the government collects taxes on exports and imports.
Arguments
model
: model object
Returns
Y_G
: government revenues
BeforeIT.gov_social_benefits
— Methodgov_social_benefits(gov::AbstractGovernment, model)
Computes social benefits paid by the government households.
Arguments
gov
: government objectmodel
: model object
Returns
sb_other
: social benefits for other householdssb_inact
: social benefits for inactive households
BeforeIT.init_government
— Methodinit_government(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)
Initialize the government agent.
Arguments
parameters
: The parameters.initial_conditions
: The initial conditions.typeInt
: The integer type to be used (default:Int64
).typeFloat
: The floating-point type to be used (default:Float64
).
Returns
- The initialized government model.
- The arguments used to initialize the government model.
Bank and Central Bank actions
BeforeIT._bank_deposits
— Method_deposit_bank(waD_h, wiD_h, fD_h, bD_h, fD_i, bE_k, fL_i)
Helper function to calculate the new deposits of a bank.
Arguments
waD_h
: Array of deposits from active workerswiD_h
: Array of deposits from inactive workersfD_h
: Array of deposits from firmsbD_h
: Deposits from the bank ownerfD_i
: Array of deposits from firmsbE_k
: Bank equityfL_i
: Array of loans to firms
Returns
D_k
: New deposits of the bank
The new deposits D_k
are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.
BeforeIT._bank_profits
— Method_bank_profits(L_i, D_i, D_h, D_k, r_bar, r)
Helper function to calculate the total profits of a bank.
Arguments
L_i
: Array of loans provided by the bankD_i
: Array of deposits from firmsD_h
: Array of deposits from householdsD_k
: Residual and balancing item on the bank’s balance sheetr_bar
: Base interest rater
: Interest rate set by the bank
Returns
Pi_k
: Total profits of the bank
The total profits Pi_k
are calculated as follows:
\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} \cdot \max(0, D_k) - r_{bar} \cdot \sum_i(\max(0, D_i)) - r_{bar} \cdot \sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]
BeforeIT._central_bank_profits
— Method_central_bank_profits(r_bar, D_k, L_G, r_G)
Helper function to calculate the profits of a central bank.
Arguments
r_bar
: The base interest rateD_k
: Deposits from commercial banksL_G
: Loans provided to the governmentr_G
: Interest rate on government loans
Returns
Pi_CB
: Profits of the central bank
The profits Pi_CB
are calculated as follows:
\[\{Pi}_{CB} = r_{G} \cdot L_{G} - r_{bar} \cdot D_{k}\]
BeforeIT.bank_deposits
— Methoddeposits_bank(bank, w_act, w_inact, firms)
Calculate the new deposits of a bank.
Arguments
bank
: TheBank
object containing the bank of the modelw_act
: TheWorkers
object containing the active workers of the modelw_inact
: TheWorkers
object containing the inactive workers of the modelfirms
: TheFirms
object containing the firms of the model
Returns
D_k
: New deposits of the bank
The new deposits D_k
are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.
BeforeIT.bank_equity
— Methodbank_equity(bank, model)
Calculate the net profits of a bank.
Arguments
bank
: The bank object.model
: The model object.
Returns
E_k
: The updated equity of the bank.
The net profits DE_k
are calculated as:
\[DE_k = \Pi_k - \theta_{DIV} \cdot (1 - \tau_{FIRM}) \cdot \max(0, \Pi_k) - \tau_{FIRM} \cdot \max(0, \Pi_k)\]
and the equity E_k
is updated as:
\[E_k = E_k + DE_k\]
BeforeIT.bank_expected_profits
— Methodbank_expected_profits(Pi_k, pi_e, gamma_e)
Calculate the expected profits of a bank.
Arguments
Pi_k
: Past profits of the bankpi_e
: Expected inflation rategamma_e
: Expected growth rate
Returns
E_Pi_k
: Expected profits of the bank
The expected profits E_Pi_k
are calculated as follows:
\[E_{\Pi_k} = \Pi_k \cdot (1 + \pi_e) \cdot (1 + \gamma_e)\]
BeforeIT.bank_profits
— Methodbank_profits(bank, model)
Calculate the total profits of a bank.
Arguments
bank
: The bank object.model
: The model object.
Returns
Pi_k
: The total profits of the bank.
The total profits Pi_k
are calculated as:
\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} \cdot \max(0, D_k) - r_{bar} \cdot \sum_i(\max(0, D_i)) - r_{bar} \cdot \sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]
BeforeIT.bank_rate
— Methodbank_rate(bank, model)
Update the interest rate set by the bank.
Arguments
bank
: The bank whose interest rate is to be updatedmodel
: Model object
Returns
r
: The updated interest rate
\[r = \bar{r} + \mu\]
BeforeIT.central_bank_equity
— Methodcentral_bank_equity(cb, model)
Calculate the equity of the central bank.
Arguments
cb
: The central bankmodel
: The model object
Returns
E_CB
: The equity of the central bank
The equity E_CB
is calculated as follows:
\[E_{CB} = E_{CB} + \Pi_{CB}\]
where \Pi_{CB}
are the profits of the central bank.
BeforeIT.central_bank_rate
— Methodcentral_bank_rate(cb, model)
Update the base interest rate set by the central bank according to the Taylor rule.
Arguments
cb
: The central bank whose base interest rate is to be updatedmodel
: The model object
Returns
r_bar
: The updated base interest rate
BeforeIT.finance_insolvent_firms!
— Methodfinance_insolvent_firms!(firms, bank, P_bar_CF, zeta_b, insolvent)
Rifinance insolvent firms using bank equity.
Arguments
firms
: TheFirms
object containing the firms of the modelbank
: TheBank
object containing the bank of the modelP_bar_CF
: Capital price indexzeta_b
: Parameter of loan-to-capital ratio for new firms after bankruptcy
Returns
- This function does not return a value. It modifies the
banks
andfirms
collections in-place.
BeforeIT.taylor_rule
— Methodtaylor_rule(rho, r_bar, r_star, pi_star, xi_pi, xi_gamma, gamma_EA, pi_EA)
Calculate the interest rate according to the Taylor rule.
Arguments
rho
: Parameter for gradual adjustment of the policy rate.r_bar
: Nominal interest rate.r_star
: Real equilibrium interest rate.pi_star
: The target inflation rate.xi_pi
: Weight the CB puts on inflation targeting.xi_gamma
: Weight placed on economic growth.gamma_EA
: The output growth rate.pi_EA
: The inflation rate.
Returns
rate
: The calculated interest rate.
The Taylor rule is given by the following equation:
\[r_t = ρ * r_{t-1} + (1 - ρ) * (r^* + π^* + ξ_π * (π_t - π^*) + ξ_γ * γ_t)```\]
Rest Of The World actions
BeforeIT.rotw_deposits
— Methodrotw_deposits(rotw, tau_EXPORT)
Calculate the deposits of the rest of the world.
Arguments
rotw
: The rest of the world object.tau_EXPORT
: The export tax.
Returns
D_RoW
: The deposits of the rest of the world.
The deposits D_RoW
are calculated as follows:
\[D_{RoW} = D_{RoW} + \left( \sum_{m} P_m \cdot Q_m \right) - (1 + \tau_{EXPORT}) \cdot C_l\]
BeforeIT.rotw_import_export
— Methodrotw_import_export(rotw, model, pi_e, epsilon_E, epsilon_I)
Calculate the demand for exports and supply of imports of the rest of the world.
Arguments
rotw
: The rest of the world object.model
: The model object.
Returns
C_E
: Total demand for exports.Y_I
: Supply of imports (in real terms).C_d_l
: TDemand for exports of specific product.Y_m
: Supply of imports per sector.P_m
: Price of imports per sector.
Markets
BeforeIT.search_and_matching_credit
— Methodsearch_and_matching_credit(firms::Firms, model)
This function calculates the credit allocation for each firm in the given firms object.
Parameters:
- firms::Firms: The firms object.
- model: The model object.
Returns:
- DL_i: An array of credit allocations for each firm.
BeforeIT.search_and_matching_labour
— Methodsearch_and_matching_labour(firms::Firms, model)
This function implements a labor search and matching algorithm. It takes in a Firms
object and a Model
object as input. The Firms
object contains information about the number of desired employees (N_d_i
) and the current number of employees (N_i
) for each firm. The model
object contains information about the current employment status (O_h
) of each worker.
The function performs the following steps:
- Calculates the vacancies (
V_i
) for each firm as the difference between desired and current employees. - Identifies employed workers and shuffles them randomly.
- Fires workers from firms with negative vacancies to adjust the workforce.
- Identifies unemployed workers and firms with positive vacancies.
- Randomly matches unemployed workers to firms with vacancies until all vacancies are filled or there are no more unemployed workers.
The function returns:
N_i
: An updated array of the number of employed workers for each firm.O_h
: An updated array where each element represents the firm a worker is employed with (0 if unemployed).
BeforeIT.perform_firms_market!
— MethodPerform the firms market exchange process
BeforeIT.perform_retail_market!
— MethodPerform the retail market exchange process
BeforeIT.search_and_matching!
— Functionsearch_and_matching!(model, multi_threading::Bool = false)
This function performs a search and matching algorithm for firms and for retail markets. It takes in a model object and an optional boolean argument for multi-threading. The function loops over all goods and performs the firms market and retail market operations for each good. Finally, it updates the aggregate variables based on the results of markets.
Args:
- model: The model object
- multi_threading: A boolean indicating whether to use multi-threading for the algorithm. Default is false.
This function updates the model in-place and does not return any value.