Skip to content

Commit

Permalink
More robust optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
jlperla committed Nov 19, 2024
1 parent aea41f6 commit 40315e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lectures/dynamic_programming_squared/amss.md
Original file line number Diff line number Diff line change
Expand Up @@ -1309,12 +1309,18 @@ function get_policies_time0(T::BellmanEquation_Recursive,
U, Uc, Un = model.U, model.Uc, model.Un
function objf(z, grad)
if any(isnan, z)
return -Inf
end
c, xprime = z[1], z[2]
n = (c + G[s0]) / Theta[s0]
return -(U(c, n) + beta * Vf[s0](xprime))
end
function cons(z, grad)
if any(isnan, z)
return -Inf
end
c, xprime, TT = z[1], z[2], z[3]
n = (c + G[s0]) / Theta[s0]
return -Uc(c, n) * (c - B_ - TT) - Un(c, n) * n - beta * xprime
Expand Down

0 comments on commit 40315e0

Please sign in to comment.