Perfect foresight with expectation errors: move computation of terminal steady states to the setup command

This is more logical, since those values are constraints from the point of view
of the solver.

Also, this allows to have maxit and tolf options for the steady state solver,
at the level of the setup command, without a clash with the same option names
for the deterministic solver at the level of the solver command.
fix-tolerance-parameters
Sébastien Villemot 2022-04-29 15:49:59 +02:00
parent 252a592f1a
commit b084c2e931
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 20 additions and 3 deletions

View File

@ -115,6 +115,24 @@ else
end
end
%% Compute the terminal steady state for all informational periods
oo_.pfwee.terminal_steady_state = NaN(M_.endo_nbr, periods);
orig_exo_steady_state = oo_.exo_steady_state;
for p = 1:periods
if p > 1 && all(oo_.pfwee.terminal_info(:, p) == oo_.pfwee.terminal_info(:, p-1))
oo_.pfwee.terminal_steady_state(:, p) = oo_.pfwee.terminal_steady_state(:, p-1);
else
if p == 1
init = oo_.steady_state;
else
init = oo_.pfwee.terminal_steady_state(:, p-1);
end
oo_.exo_steady_state = oo_.pfwee.terminal_info(:, p);
oo_.pfwee.terminal_steady_state(:, p) = evaluate_steady_state(init, M_, options_, oo_, true);
end
end
oo_.exo_steady_state = orig_exo_steady_state;
% Build initial paths for endos and exos (only initial conditions are set, the rest is NaN)
if isempty(ys0_)
oo_.endo_simul = [repmat(oo_.steady_state, 1, M_.maximum_lag) NaN(M_.endo_nbr, periods+M_.maximum_lead)];

View File

@ -42,8 +42,7 @@ end
while info_period <= periods
% Compute terminal steady state as anticipated
oo_.exo_steady_state = oo_.pfwee.terminal_info(:, info_period);
steady_state_prev = oo_.steady_state;
[oo_.steady_state,~,info] = evaluate_steady_state(steady_state_prev, M_, options_, oo_, true);
oo_.steady_state = oo_.pfwee.terminal_steady_state(:, info_period);
if options_.pfwee.constant_simulation_length && increment > 0
endo_simul = [ endo_simul NaN(M_.endo_nbr, increment)];

@ -1 +1 @@
Subproject commit 6509bc7d3651d7b82adbf4ca53042dbefe6fe7fb
Subproject commit 32761173e00e7e40932341de36507707c16a9311