Perfect foresight with homotopy + marginal linearization: improve info messages

kalman-mex
Sébastien Villemot 2023-10-20 14:57:22 -04:00
parent 6027d31da2
commit 7449d26e51
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 8 additions and 1 deletions

View File

@ -160,13 +160,20 @@ elseif options_.simul.homotopy_linearization_fallback && completed_share > 0
elseif options_.simul.homotopy_marginal_linearization_fallback > 0 && completed_share > options_.simul.homotopy_marginal_linearization_fallback
% Now compute extra simulation. First try using the first simulation as guess value.
extra_share = completed_share - options_.simul.homotopy_marginal_linearization_fallback;
if ~options_.noprint
fprintf('Only %.1f%% of the shock could be simulated. Since marginal linearization was requested as a fallback, now running an extra simulation for %.1f%% of the shock\n\n', completed_share, extra_share)
fprintf('%s\n\n', repmat('*', 1, 80))
end
extra_simul_time_counter = tic;
[extra_success, extra_endo_simul, extra_exo_simul, extra_steady_state, extra_exo_steady_state] = create_scenario(extra_share, endoorig, exoorig, endobase, exobase, initperiods, lastperiods, recompute_final_steady_state, endo_simul, steady_state, exo_steady_state);
if extra_success
[extra_endo_simul, extra_success] = perfect_foresight_solver_core(extra_endo_simul, extra_exo_simul, extra_steady_state, extra_exo_steady_state, M_, options_);
end
if ~extra_success
fprintf('The extra simulation for %.1f%% of the shock did not run when using the first simulation as a guess value. Now trying a full homotopy loop to get that extra simulation working\n\n', extra_share)
if ~options_.noprint
fprintf('The extra simulation for %.1f%% of the shock did not run when using the first simulation as a guess value. Now trying a full homotopy loop to get that extra simulation working\n\n', extra_share)
fprintf('%s\n\n', repmat('*', 1, 80))
end
[extra_completed_share, extra_endo_simul] = homotopy_loop(extra_share, endoorig, exoorig, endobase, exobase, initperiods, simperiods, lastperiods, recompute_final_steady_state, oo_.endo_simul, oo_.steady_state, oo_.exo_steady_state);
extra_success = (extra_completed_share == extra_share);
end