Skip to content

Commit

Permalink
refactor: remove Standard from standard agent structs
Browse files Browse the repository at this point in the history
  • Loading branch information
AldoGl committed May 23, 2024
1 parent ed0856f commit 7fff430
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/model_init/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export AbstractBank,
AbstractFirms,
AbstractGovernment,
AbstractRestOfTheWorld,
AbstractRestOfTheWorld,
AbstractWorkers,
@worker,
@firm,
Expand Down
32 changes: 16 additions & 16 deletions src/model_init/agents.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export StandardWorkers,
StandardFirms,
StandardBank,
StandardCentralBank,
StandardGovernment,
StandardRestOfTheWorld,
StandardAggregates,
export Workers,
Firms,
Bank,
CentralBank,
Government,
RestOfTheWorld,
Aggregates,
Model
include("abstract.jl")
"""
Expand All @@ -24,7 +24,7 @@ For all fields the entry at index `i` corresponds to the `i`th worker.
- `C_h`: Realised consumption
- `I_h`: Realised investment
"""
struct StandardWorkers{T <: AbstractVector, I <: AbstractVector} <: AbstractWorkers
struct Workers{T <: AbstractVector, I <: AbstractVector} <: AbstractWorkers
@worker T I
end

Expand Down Expand Up @@ -82,7 +82,7 @@ For all fields the entry at index `i` corresponds to the `i`th firm.
- `K_h`: Capital stock
- `D_h`: Deposits of the owner of the firms
"""
mutable struct StandardFirms{T <: AbstractVector, I <: AbstractVector} <: AbstractFirms
mutable struct Firms{T <: AbstractVector, I <: AbstractVector} <: AbstractFirms
@firm T I
end

Expand All @@ -106,7 +106,7 @@ This is a Bank type. It represents the bank of the model.
- `D_h`: Deposits
"""
mutable struct StandardBank{P} <: AbstractBank
mutable struct Bank{P} <: AbstractBank
@bank P
end

Expand All @@ -124,7 +124,7 @@ This is a CentralBank type. It represents the central bank of the model.
- `xi_gamma`: Weight placed on economic
- `E_CB`: Central bank equity
"""
mutable struct StandardCentralBank{T} <: AbstractCentralBank
mutable struct CentralBank{T} <: AbstractCentralBank

@centralBank T
end
Expand All @@ -145,7 +145,7 @@ This is a Government type. It represents the government of the model.
- `C_j`: Realised government consumption
- `P_j`: Price inflation of government goods <- ??
"""
mutable struct StandardGovernment{T} <: AbstractGovernment
mutable struct Government{T} <: AbstractGovernment

@government T
end
Expand Down Expand Up @@ -180,7 +180,7 @@ This is a RestOfTheWorld type. It represents the rest of the world of the model.
- `P_m [vector]`: Price of imports per sector
- `P_l`: Price inflation of exports <- ??
"""
mutable struct StandardRestOfTheWorld{T} <: AbstractRestOfTheWorld
mutable struct RestOfTheWorld{T} <: AbstractRestOfTheWorld

@restOfTheWorld T
end
Expand All @@ -205,7 +205,7 @@ Note that `t` is an integer, while the rest are floats or vectors of floats.
- `t`: Time index
"""
mutable struct StandardAggregates{T, I}
mutable struct Aggregates{T, I}
@aggregates T I
end

Expand All @@ -229,8 +229,8 @@ mutable struct Model
bank::AbstractBank
cb::AbstractCentralBank
gov::AbstractGovernment
rotw::StandardRestOfTheWorld
agg::StandardAggregates
rotw::AbstractRestOfTheWorld
agg::Aggregates
prop::Any
end

Expand Down
16 changes: 8 additions & 8 deletions src/model_init/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
N_d_i = zeros(typeInt, I)
Pi_e_i = zeros(typeFloat, I)

firms = StandardFirms(
firms = Firms(
G_i,
alpha_bar_i,
beta_i,
Expand Down Expand Up @@ -346,7 +346,7 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
C_h = zeros(typeFloat, length(ids))
I_h = zeros(typeFloat, length(ids))
# active workers (both employed and unemployed)
workers_act = StandardWorkers(Y_h[1:H_W], D_h[1:H_W], K_h[1:H_W], w_h[1:H_W], O_h[1:H_W], C_d_h, I_d_h, C_h, I_h)
workers_act = Workers(Y_h[1:H_W], D_h[1:H_W], K_h[1:H_W], w_h[1:H_W], O_h[1:H_W], C_d_h, I_d_h, C_h, I_h)

# inactive workers
ids = Vector{typeInt}((I + H_W + 1):(I + H_W + H_inact))
Expand All @@ -356,7 +356,7 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
I_d_h = zeros(typeFloat, length(ids))
C_h = zeros(typeFloat, length(ids))
I_h = zeros(typeFloat, length(ids))
workers_inact = StandardWorkers(
workers_inact = Workers(
Y_h[(H_W + 1):(H_W + H_inact)],
D_h[(H_W + 1):(H_W + H_inact)],
K_h[(H_W + 1):(H_W + H_inact)],
Expand All @@ -377,18 +377,18 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
K_h = K_h[H_W + H_inact + I + 1]
D_h = D_h[H_W + H_inact + I + 1]
Pi_e_k = typeFloat(0.0)
bank = StandardBank(E_k, Pi_k, Pi_e_k, D_k, r, Y_h_k, C_d_h, I_d_h, C_h, I_h, K_h, D_h)
bank = Bank(E_k, Pi_k, Pi_e_k, D_k, r, Y_h_k, C_d_h, I_d_h, C_h, I_h, K_h, D_h)

id = typeInt(I + H_W + H_inact + 2)
central_bank = StandardCentralBank(r_bar, r_G, rho, r_star, pi_star, xi_pi, xi_gamma, E_CB)
central_bank = CentralBank(r_bar, r_G, rho, r_star, pi_star, xi_pi, xi_gamma, E_CB)

id = typeInt(I + H_W + H_inact + 3)
C_d_j = Vector{typeFloat}(zeros(J))
C_j = zero(typeFloat)
P_j = zero(typeFloat)
Y_G = zero(typeFloat)
government =
StandardGovernment(alpha_G, beta_G, sigma_G, Y_G, C_G[T_prime], L_G, sb_inact, sb_other, C_d_j, C_j, P_j)
Government(alpha_G, beta_G, sigma_G, Y_G, C_G[T_prime], L_G, sb_inact, sb_other, C_d_j, C_j, P_j)

id = typeInt(I + H_W + H_inact + 4)
C_d_l = Vector{typeFloat}(zeros(L))
Expand All @@ -398,7 +398,7 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
Q_m = Vector{typeFloat}(zeros(G))
Q_d_m = Vector{typeFloat}(zeros(G))
P_m = Vector{typeFloat}(zeros(G))
rotw = StandardRestOfTheWorld(
rotw = RestOfTheWorld(
alpha_E,
beta_E,
sigma_E,
Expand Down Expand Up @@ -435,7 +435,7 @@ function initialise_model(parameters, initial_conditions, T, typeInt = Int64, ty
epsilon_Y_EA = zero(typeFloat)
epsilon_E = zero(typeFloat)
epsilon_I = zero(typeFloat)
agg = StandardAggregates(
agg = Aggregates(
Y,
pi_,
P_bar,
Expand Down

0 comments on commit 7fff430

Please sign in to comment.