Get rid of the try-except
@@ -792,7 +792,6 @@ def solveConsPortfolio(solution_next,ShockDstn,IncomeDstn,RiskyDstn,
crossing = np.logical_and(FOC_s[:,1:] <= 0., FOC_s[:,:-1] >= 0.)
for j in range(aNrm_N):
if not (constrained_top[j] or constrained_bot[j]):
- try:
idx = np.argwhere(crossing[j,:])[0][0]
bot_s = ShareGrid[idx]
top_s = ShareGrid[idx+1]
@@ -803,8 +802,6 @@ def solveConsPortfolio(solution_next,ShockDstn,IncomeDstn,RiskyDstn,
alpha = 1. - top_f/(top_f-bot_f)
Share_now[j] = (1.-alpha)*bot_s + alpha*top_s
cNrmAdj_now[j] = (1.-alpha)*bot_c + alpha*top_c
- except:
- print('No optimal controls found for a=' + str(aNrmGrid[j]))
# Calculate the endogenous mNrm gridpoints when the agent adjusts his portfolio
mNrmAdj_now = aNrmGrid + cNrmAdj_now
