Skip to content

Commit 747894a

Browse files
authored
[overborrowing] MAINT: collect status messages (#178)
* [overborrowing] MAINT: collect status messages and print at the end of iteration * fix syntax
1 parent 78ae5c8 commit 747894a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lectures/overborrowing.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,17 @@ def compute_equilibrium(parameters, sizes, arrays,
634634
H = generate_initial_H(parameters, sizes, arrays)
635635
error = tol + 1
636636
i = 0
637+
msgs = []
637638
while error > tol and i < max_iter:
638639
H_new, vfi_num_iter = update_H(parameters, sizes, arrays, H, α)
639-
print(f"VFI terminated after {vfi_num_iter} iterations.")
640+
msgs.append(f"VFI terminated after {vfi_num_iter} iterations.")
640641
error = jnp.max(jnp.abs(b_grid[H] - b_grid[H_new]))
641-
print(f"Updated H at iteration {i} with error {error}.")
642+
msgs.append(f"Updated H at iteration {i} with error {error}.")
642643
H = H_new
643644
i += 1
644645
if i == max_iter:
645-
print("Warning: Equilibrium search iteration hit upper bound.")
646+
msgs.append("Warning: Equilibrium search iteration hit upper bound.")
647+
print("\n".join(msgs))
646648
return H
647649
```
648650

0 commit comments

Comments
 (0)