diff --git a/src/markets/search_and_matching_credit.jl b/src/markets/search_and_matching_credit.jl index f95ae1d..69dcf32 100644 --- a/src/markets/search_and_matching_credit.jl +++ b/src/markets/search_and_matching_credit.jl @@ -20,9 +20,9 @@ function search_and_matching_credit(firms::AbstractFirms, model) DL_i = zeros(size(DL_d_i)) I_FG = findall(DL_d_i .> 0) shuffle!(I_FG) - s = sum(L_e_i) + sum(DL_i) + s_L_e_i = sum(L_e_i) for i in I_FG - DL_i[i] = max(0.0, min(DL_d_i[i], zeta_LTV * K_e_i[i] - L_e_i[i], E_k / zeta - s)) + DL_i[i] = max(0.0, min(DL_d_i[i], zeta_LTV * K_e_i[i] - L_e_i[i], E_k / zeta - s_L_e_i - sum(DL_i))) end return DL_i end