This code uses value function iteration. I feel confused where did they set the initial value for the value function. I could not see the initial guess around the for loop of iteration.
They only do some kinds of allocating memory for value functions. This is on the part of def init(self, …), at the beginning of the code.
So I wonder, whether this is indeed the initial guess for value functions?, which set all value functions are zeros matrix?
In this model, there are three value functions. There’s the value of paying (Vc), the value of defaulting (Vd), and the overall value of optimizing over the two (V). We can see this by looking at the error calculation in solve().
These are also explained a few lines above equation (4).
As for the initial values, the key is that the pre-allocation is done with specified values (as opposed to junk ones, such as what you might get from running Array{Float64}(undef, 10) in Julia, i.e.):
So, in this case, the initial guess for each vector is to make them identically zero. Note that these vectors are repeated/reshaped to account for the B grid, instead of just the y one.
As for your question about the def__init(...)__, I’ll defer to someone who’s more fluent in Python.