extended path: use deterministic_simulation.status instead of maxerror
parent
0ce2834281
commit
e0475fd4ef
|
@ -57,8 +57,8 @@ if flag
|
||||||
options.lmmcp = olmmcp;
|
options.lmmcp = olmmcp;
|
||||||
options.solve_algo = solve_algo;
|
options.solve_algo = solve_algo;
|
||||||
options.stack_solve_algo = stack_solve_algo;
|
options.stack_solve_algo = stack_solve_algo;
|
||||||
[tmp, maxerror] = perfect_foresight_solver_core(M, options, oo);
|
tmp = perfect_foresight_solver_core(M, options, oo);
|
||||||
if maxerror>options.dynatol.f
|
if ~tmp.deterministic_simulation.status
|
||||||
info_convergence = false;
|
info_convergence = false;
|
||||||
else
|
else
|
||||||
info_convergence = true;
|
info_convergence = true;
|
||||||
|
|
|
@ -18,10 +18,8 @@ function [info_convergence, endo_simul] = extended_path_homotopy(endo_simul, exo
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
endo_simul0 = endo_simul;
|
||||||
if ismember(method, [1, 2])
|
if ismember(method, [1, 2])
|
||||||
if isequal(method, 2)
|
|
||||||
endo_simul0 = endo_simul;
|
|
||||||
end
|
|
||||||
noconvergence = true;
|
noconvergence = true;
|
||||||
iteration = 0;
|
iteration = 0;
|
||||||
weight = .1;
|
weight = .1;
|
||||||
|
@ -34,9 +32,10 @@ if ismember(method, [1, 2])
|
||||||
while noconvergence
|
while noconvergence
|
||||||
iteration = iteration + 1;
|
iteration = iteration + 1;
|
||||||
oo.endo_simul = endo_simul;
|
oo.endo_simul = endo_simul;
|
||||||
|
oo.endo_simul(:,1) = oo.steady_state + weight*(endo_simul0(:,1) - oo.steady_state);
|
||||||
oo.exo_simul = bsxfun(@plus, weight*exo_simul, (1-weight)*transpose(oo.exo_steady_state));
|
oo.exo_simul = bsxfun(@plus, weight*exo_simul, (1-weight)*transpose(oo.exo_steady_state));
|
||||||
if order==0
|
if order==0
|
||||||
[tmp, maxerror] = perfect_foresight_solver_core(M, options, oo);
|
tmp = perfect_foresight_solver_core(M, options, oo);
|
||||||
else
|
else
|
||||||
switch(algo)
|
switch(algo)
|
||||||
case 0
|
case 0
|
||||||
|
@ -49,7 +48,7 @@ if ismember(method, [1, 2])
|
||||||
end
|
end
|
||||||
if isequal(order, 0)
|
if isequal(order, 0)
|
||||||
% Logical variable flag is false iff the solver fails.
|
% Logical variable flag is false iff the solver fails.
|
||||||
flag = ~(maxerror>options.dynatol.f);
|
flag = ~tmp.deterministic_simulation.status;
|
||||||
else
|
else
|
||||||
% Fix convention issue on the value of flag.
|
% Fix convention issue on the value of flag.
|
||||||
flag = ~flag;
|
flag = ~flag;
|
||||||
|
@ -105,7 +104,7 @@ if isequal(method, 3) || (isequal(method, 2) && noconvergence)
|
||||||
oo.endo_simul = endo_simul;
|
oo.endo_simul = endo_simul;
|
||||||
oo.exo_simul = bsxfun(@plus, weight*exo_simul, (1-weight)*transpose(oo.exo_steady_state));
|
oo.exo_simul = bsxfun(@plus, weight*exo_simul, (1-weight)*transpose(oo.exo_steady_state));
|
||||||
if order==0
|
if order==0
|
||||||
[tmp, maxerror] = perfect_foresight_solver_core(M, options, oo);
|
tmp = perfect_foresight_solver_core(M, options, oo);
|
||||||
else
|
else
|
||||||
switch(algo)
|
switch(algo)
|
||||||
case 0
|
case 0
|
||||||
|
@ -118,7 +117,7 @@ if isequal(method, 3) || (isequal(method, 2) && noconvergence)
|
||||||
end
|
end
|
||||||
if isequal(order, 0)
|
if isequal(order, 0)
|
||||||
% Logical variable flag is false iff the solver fails.
|
% Logical variable flag is false iff the solver fails.
|
||||||
flag = ~(maxerror>options.dynatol.f);
|
flag = ~tmp.deterministic_simulation.status;
|
||||||
else
|
else
|
||||||
% Fix convention issue on the value of flag.
|
% Fix convention issue on the value of flag.
|
||||||
flag = ~flag;
|
flag = ~flag;
|
||||||
|
|
Loading…
Reference in New Issue