@@ -1309,12 +1309,18 @@ function get_policies_time0(T::BellmanEquation_Recursive,
13091309 U, Uc, Un = model.U, model.Uc, model.Un
13101310
13111311 function objf(z, grad)
1312+ if any(isnan, z)
1313+ return -Inf
1314+ end
13121315 c, xprime = z[1], z[2]
13131316 n = (c + G[s0]) / Theta[s0]
13141317 return -(U(c, n) + beta * Vf[s0](xprime))
13151318 end
13161319
13171320 function cons(z, grad)
1321+ if any(isnan, z)
1322+ return -Inf
1323+ end
13181324 c, xprime, TT = z[1], z[2], z[3]
13191325 n = (c + G[s0]) / Theta[s0]
13201326 return -Uc(c, n) * (c - B_ - TT) - Un(c, n) * n - beta * xprime
@@ -1511,7 +1517,7 @@ sim_seq_h_plot = hcat(sim_seq_h[1:3]..., sim_seq_h[4],
15111517sim_bel_h_plot = hcat(sim_bel_h[1:3]..., sim_bel_h[5],
15121518 time_example.G[sHist_h],
15131519 time_example.Theta[sHist_h] .* sim_bel_h[2])
1514- p = plot(size = (920, 750 ), layout = (3, 2),
1520+ p = plot(size = (700, 700 ), layout = (3, 2),
15151521 xaxis = (0:6), grid = false, titlefont = Plots.font("sans-serif", 10))
15161522plot!(p, title = titles)
15171523for i in 1:6
@@ -1626,7 +1632,7 @@ sim_bel_plot = hcat(sim_bel[1:3]...,
16261632 log_example.Theta[sHist] .* sim_bel[2])
16271633
16281634#plot policies
1629- p = plot(size = (920, 750 ), layout = grid(3, 2),
1635+ p = plot(size = (700, 700 ), layout = grid(3, 2),
16301636 xaxis = (0:T), grid = false, titlefont = Plots.font("sans-serif", 10))
16311637labels = fill(("", ""), 6)
16321638labels[3] = ("Complete Market", "Incomplete Market")
@@ -1671,7 +1677,7 @@ sim_bel_long_plot = hcat(sim_bel_long[1:3]..., sim_bel_long[5],
16711677 log_example.G[sHist_long],
16721678 log_example.Theta[sHist_long] .* sim_bel_long[2])
16731679
1674- p = plot(size = (920, 750 ), layout = (3, 2), xaxis = (0:50:T_long),
1680+ p = plot(size = (700, 700 ), layout = (3, 2), xaxis = (0:50:T_long),
16751681 grid = false,
16761682 titlefont = Plots.font("sans-serif", 10))
16771683plot!(p, title = titles)
0 commit comments