From 4b1e7357fa2f2b04e3d8b48c47e4bd83a65ad60d Mon Sep 17 00:00:00 2001 From: Adriano Meligrana <68152031+Tortar@users.noreply.github.com> Date: Sat, 30 Nov 2024 02:51:59 +0100 Subject: [PATCH] Some refactoring of market functions --- src/markets/search_and_matching_credit.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/markets/search_and_matching_credit.jl b/src/markets/search_and_matching_credit.jl index 33b89c2..f95ae1d 100644 --- a/src/markets/search_and_matching_credit.jl +++ b/src/markets/search_and_matching_credit.jl @@ -20,8 +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) for i in I_FG - DL_i[i] = max(0, min(min(DL_d_i[i], zeta_LTV * K_e_i[i] - L_e_i[i]), E_k / zeta - (sum(L_e_i) + sum(DL_i)))) + 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)) end return DL_i end