Howardsgreedy option in infinite horizon

By running the simple Aiyagari example on the toolkit webpage, I found out that the default option for

vfoptions.howardsgreedy

is not set correctly. Howards greedy works well with small problems. I would change this block

if N_a<400 || N_z<20 % iterated (aka modified-Policy Fn Iteration) or greedy (aka Policy Fn Iteration)
                vfoptions.howardsgreedy=1; % small one endogenous state models, use Howards greedy, everything else uses Howards iterations
            else
                vfoptions.howardsgreedy=0;
            end

as

if N_a<400 && N_z<20 % iterated (aka modified-Policy Fn Iteration) or greedy (aka Policy Fn Iteration)
                vfoptions.howardsgreedy=1; % small one endogenous state models, use Howards greedy, everything else uses Howards iterations
            else
                vfoptions.howardsgreedy=0;
            end

You want to use Howards greedy if the number of grid points for a and for z is sufficiently small, and the criterion N_a<400 .AND. N_z<20 seems ok, but now the criterion is N_a<400 .OR. N_z<20 The code sets Howards greedy=1 if for example N_a=1200 and N_z=11 (my test case). This makes the code very slow

Grid sizes are: 1200 points for assets, and 11 points for exogenous shock 
vfoptions.howardsgreedy = 0 
Compute value function and stationary distribution 
  
Time vfi:           0.330606 
Time stat distrib:  0.109806 
Time agg variables: 0.016426

With the default options we get

Grid sizes are: 1200 points for assets, and 11 points for exogenous shock 
vfoptions.howardsgreedy = 1 
Compute value function and stationary distribution 
  
Time vfi:           12.047372 
Time stat distrib:  0.111783 
Time agg variables: 0.007656 

At first I thought my GPU broke down :slight_smile:

1 Like

Good point. Made change to &&.

I suspect that best option is rather hardware dependent and maybe the more powerful the GPU the bigger the N_a && N_z should be set for using howards greedy? But this is speculation, and other than changing the default setting again five years from now seems unlikely to be worth pursuing.

1 Like