Testsuite: replace “simul” by “perfect_foresight_setup” + “perfect_foresight_solver”

silicon
Sébastien Villemot 2023-02-06 15:37:57 -05:00
parent be698d5f98
commit c3524d33d0
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
52 changed files with 123 additions and 67 deletions

View File

@ -72,6 +72,8 @@ end;
model_info;
simul(periods=2000, stack_solve_algo = 0,maxit=10);
perfect_foresight_setup(periods=2000);
perfect_foresight_solver(stack_solve_algo = 0, maxit=10);
rplot y;
rplot k;

View File

@ -44,7 +44,8 @@ end;
steady;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -51,7 +51,8 @@ end;
// steady;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -17,11 +17,12 @@ end;
check;
%% DETERMINISTIC SIMULATION
simul(periods = 40, stack_solve_algo=0, maxit=100);
perfect_foresight_setup(periods = 40);
perfect_foresight_solver(stack_solve_algo=0, maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
dsample 40;
rplot x;
rplot x;

View File

@ -115,13 +115,16 @@ steady;
check;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
endo_simul_0 = oo_.endo_simul;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
simul(linear_approximation,periods=300, stack_solve_algo=7);
perfect_foresight_setup(periods=300);
perfect_foresight_solver(linear_approximation, stack_solve_algo=7);
endo_simul_1 = oo_.endo_simul;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -27,7 +27,8 @@ end;
check;
// Deterministic simulation of the model for 200 periods
simul(periods=100, tolf=1e-12);
perfect_foresight_setup(periods=100);
perfect_foresight_solver(tolf=1e-12);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -29,7 +29,8 @@ end;
check;
// Deterministic simulation of the model for 200 periods
simul(periods=100, tolf=1e-12);
perfect_foresight_setup(periods=100);
perfect_foresight_solver(tolf=1e-12);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -52,7 +52,8 @@ values 1.2;
end;
// Deterministic simulation of the model for 200 periods
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -27,8 +27,9 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
end

View File

@ -38,7 +38,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -41,7 +41,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
@ -53,4 +54,4 @@ if max(abs(base_results.oo_.endo_simul(strmatch('c',base_results.M_.endo_names,'
max(abs(base_results.oo_.endo_simul(strmatch('k',base_results.M_.endo_names,'exact'),1+base_results.M_.maximum_endo_lag:end-base_results.M_.maximum_endo_lead) -...
oo_.endo_simul(strmatch('k',M_.endo_names,'exact'),1+M_.maximum_endo_lag:end-M_.maximum_endo_lead)))>1e-8
error('Autonomous system part is wrong')
end
end

View File

@ -36,7 +36,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -41,7 +41,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -40,7 +40,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -51,7 +51,8 @@ periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=100);
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -25,7 +25,8 @@ shocks;
values 1;
end;
simul(periods=10);
perfect_foresight_setup(periods=10);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -22,7 +22,8 @@ shocks;
values 1 -1;
end;
simul(periods=5);
perfect_foresight_setup(periods=5);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -35,7 +35,8 @@ periods 1 2;
values .3 -0.1;
end;
simul(periods=5);
perfect_foresight_setup(periods=5);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -22,4 +22,5 @@ shocks;
values 1 .5 .25 .125;
end;
simul(periods=4);
perfect_foresight_setup(periods=4);
perfect_foresight_solver;

View File

@ -69,11 +69,12 @@ histval;
Capital(0) = CapitalSS/2;
end;
simul(periods=20);
perfect_foresight_setup(periods=20);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -74,11 +74,12 @@ periods 1;
values -0.1;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -69,11 +69,12 @@ periods 4, 5, 6, 7, 8;
values 0.04, 0.05, 0.06, 0.07, 0.08;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -72,11 +72,12 @@ end;
steady;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -78,11 +78,12 @@ periods 1:5;
values 0;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -69,14 +69,16 @@ histval;
Capital(0) = CapitalSS/2;
end;
simul(periods=500);
perfect_foresight_setup(periods=500);
perfect_foresight_solver;
fff = oo_.endo_simul;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
simul(periods=500, endogenous_terminal_period);
perfect_foresight_setup(periods=500);
perfect_foresight_solver(endogenous_terminal_period);
ggg = oo_.endo_simul;
if ~oo_.deterministic_simulation.status

View File

@ -72,11 +72,12 @@ periods 3;
values -0.1;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
rplot Consumption;
rplot Capital;
rplot Capital;

View File

@ -73,7 +73,8 @@ periods 1;
values -0.1;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -73,7 +73,8 @@ periods 1;
values -0.1;
end;
simul(periods=300);
perfect_foresight_setup(periods=300);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -89,4 +89,5 @@ end;
steady;
check;
simul(periods=500);
perfect_foresight_setup(periods=500);
perfect_foresight_solver;

View File

@ -70,7 +70,8 @@ end;
options_.simul.maxit = 100;
simul(periods=4000);
perfect_foresight_setup(periods=4000);
perfect_foresight_solver;
n = 100;

View File

@ -35,4 +35,5 @@ x(0) = 0.9;
z(-1) = 0.1;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;

View File

@ -34,7 +34,8 @@ periods 2;
values 0.9;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')

View File

@ -68,4 +68,5 @@ end;
@#include "sw-common-footer.inc"
simul(periods=1000, lmmcp);
perfect_foresight_setup(periods=1000);
perfect_foresight_solver(lmmcp);

View File

@ -67,7 +67,8 @@ end;
@#include "sw-common-footer.inc"
simul(periods=1000);
perfect_foresight_setup(periods=1000);
perfect_foresight_solver;
newton_solution_is_wrong = abs(evaluate_max_dynamic_residual(str2func('sw_newton.dynamic'), oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, 1000, size(oo_.endo_simul, 1), 1, M_.lead_lag_incidence))>options_.dynatol.f;
@ -87,4 +88,4 @@ end
if lmmcp_solution_is_wrong
error('Failed to solve SW with ZLB (using LMMCP algorithm on stacked model)!')
end
end

View File

@ -35,7 +35,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -34,7 +34,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
dynasave('myfile') c x k;
dynatype('myfile1.txt') c x k;
@ -42,4 +43,4 @@ dynatype('myfile1.txt') c x k;
rplot c;
rplot k;
rplot dc;
rplot s;
rplot s;

View File

@ -31,7 +31,8 @@ periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -67,7 +67,8 @@ periods 1;
values 1.2;
end;
simul(periods=20);
perfect_foresight_setup(periods=20);
perfect_foresight_solver;
if(abs(oo_.steady_state(5) - erf(1)) > 1e-10)
error('Test failed in static @{mode_name} for erf')

View File

@ -31,7 +31,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -33,7 +33,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -32,7 +32,8 @@ periods 1:2;
values (a);
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -28,7 +28,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;

View File

@ -104,9 +104,9 @@ var epsilonA1; periods 1; values 2;
end;
options_.simul.robust_lin_solve=1;
simul( periods = 400 );
perfect_foresight_setup(periods=400);
perfect_foresight_solver(robust_lin_solve);
if ~oo_.deterministic_simulation.status
error('Model did not solve')
end
end

View File

@ -61,5 +61,7 @@ end;
resid;
steady;
simul(periods=200, solve_algo=4);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(solve_algo=4);
rplot k;

View File

@ -40,4 +40,5 @@ x=0;
z=0;
end;
steady;
simul(periods=1000,stack_solve_algo=0);
perfect_foresight_setup(periods=1000);
perfect_foresight_solver(stack_solve_algo=0);

View File

@ -87,7 +87,8 @@ periods 1:10;
values 1.05;
end;
simul(periods=40,maxit=1000);
perfect_foresight_setup(periods=40);
perfect_foresight_solver(maxit=1000);
rplot gdp_hat;
rplot R;

View File

@ -87,7 +87,8 @@ periods 1:10;
values 1.05;
end;
simul(periods=40,maxit=1000);
perfect_foresight_setup(periods=40);
perfect_foresight_solver(maxit=1000);
if oo_.deterministic_simulation.status==1
error('This model has no solution');

View File

@ -33,7 +33,8 @@ periods 1;
values 1.2;
end;
simul(periods=20);
perfect_foresight_setup(periods=20);
perfect_foresight_solver;
if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10)
error('Test failed in static M-file for steady_state')

View File

@ -33,7 +33,8 @@ periods 1;
values 1.2;
end;
simul(periods=20, stack_solve_algo=5);
perfect_foresight_setup(periods=20);
perfect_foresight_solver(stack_solve_algo=5);
if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10)
error('Test failed in static M-file for steady_state')

View File

@ -33,7 +33,8 @@ periods 1;
values 1.2;
end;
simul(periods=20);
perfect_foresight_setup(periods=20);
perfect_foresight_solver;
if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10)
error('Test failed in static M-file for steady_state')

View File

@ -33,7 +33,8 @@ periods 1;
values 1.2;
end;
simul(periods=20);
perfect_foresight_setup(periods=20);
perfect_foresight_solver;
if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10)
error('Test failed in static M-file for steady_state')

View File

@ -30,7 +30,8 @@ periods 1;
values 1.2;
end;
simul(periods=200);
perfect_foresight_setup(periods=200);
perfect_foresight_solver;
rplot c;
rplot k;