Minimizing negative welfare

Try following the steps outlined here:
[Loop over parameters)
to program a more efficient loop.
The issue seems to be that you do not allow for stoch_simul to fail, e.g. due to Blanchard-Kahn violations. In this case, the eigenvalues will not be computed/stored. At the previous link, you will see that

info=stoch_simul(var_list_)

is called. Here, info stores the exit code of stoch_simul. If it is 0, everything is fine. If info>0, the solution could not be computed and you need to attach a penalty for this outcome to deal with your optimizer.