In the interpolation branch of [ValueFnFromPolicy_InfHorz.m (line 101)]: itercount is not incremented when gridinterplayer = 1, so maxiter is ineffective.
function V=ValueFnFromPolicy_InfHorz(Policy,n_d,n_a,n_z,d_grid,a_grid,z_grid, pi_z, ReturnFn, Parameters, DiscountFactorParamNames, vfoptions)
if ~exist('vfoptions','var')
vfoptions.gridinterplayer=0;
vfoptions.tolerance=10^(-9);
vfoptions.maxiter=10^4; % Can be used to stop the VFI after a finite number of iterations
% divide-and-conquer is not relevant for ValueFnFromPolicy
else
if gpuDeviceCount==0
error('ValueFnFromPolicy_InfHorz is only available on GPU')
end
if ~isfield(vfoptions,'gridinterplayer')
vfoptions.gridinterplayer=0;
end
if ~isfield(vfoptions,'tolerance')
vfoptions.tolerance=10^(-9);
end
if ~isfield(vfoptions,'maxiter')
vfoptions.maxiter=10^4; % Can be used to stop the VFI after a finite number of iterations
end
This file has been truncated. show original
One line fix, thanks for spotting!
committed 02:36AM - 12 Jul 26 UTC
Reported on forum: in the interpolation branch the while loop never
incremented … itercount, so vfoptions.maxiter had no effect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 Like