From 24d5ba029064bb82c4043767ff48c420ac69c7bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Ry=C3=BBk=29?=
 <stepan@adjemian.eu>
Date: Fri, 25 Mar 2022 12:12:32 +0100
Subject: [PATCH] Change nonlinear solvers in some integration tests.

Trust region with block decomposition (as provided by dmperm) fails to provide
correct simulations (most likely due to the interpretation of tolf which
depends on the number and size of blocks).
---
 tests/pac/var-10e/example1.mod                |  1 +
 tests/pac/var-10e/example2.mod                |  1 +
 .../solow_cd_with_steadystate.mod             | 34 ++++++++++---------
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/tests/pac/var-10e/example1.mod b/tests/pac/var-10e/example1.mod
index c7e8fe0e65..94f0237805 100644
--- a/tests/pac/var-10e/example1.mod
+++ b/tests/pac/var-10e/example1.mod
@@ -75,6 +75,7 @@ pac.update.expectation('pacman');
 initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names));
 
 // Simulate the model for 500 periods
+options_.solve_algo = 9;
 TrueData = simul_backward_model(initialconditions, 500);
 
 TrueData.save('example1.data')
diff --git a/tests/pac/var-10e/example2.mod b/tests/pac/var-10e/example2.mod
index fdce3ec6ab..6880b4ac51 100644
--- a/tests/pac/var-10e/example2.mod
+++ b/tests/pac/var-10e/example2.mod
@@ -59,6 +59,7 @@ pac.update.expectation('pacman');
 initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names));
 
 // Simulate the model for 500 periods
+options_.solve_algo = 9;
 TrueData = simul_backward_model(initialconditions, 500);
 
 TrueData.save('example2.data')
diff --git a/tests/stochastic-backward-models/solow_cd_with_steadystate.mod b/tests/stochastic-backward-models/solow_cd_with_steadystate.mod
index 96296313be..52368e19e8 100644
--- a/tests/stochastic-backward-models/solow_cd_with_steadystate.mod
+++ b/tests/stochastic-backward-models/solow_cd_with_steadystate.mod
@@ -11,10 +11,10 @@ varexo e_x   // $\varepsilon_x$
 parameters alpha                               // $\alpha$
 	   delta                               // $\delta$
 	   s                                   // $s$
-           rho_x                               // $\rho_x$
-           rho_n                               // $\rho_n$
-           EfficiencyGrowth_ss                 // $X^{\star}$
-           PopulationGrowth_ss ;               // $N^{\star}$
+rho_x                               // $\rho_x$
+rho_n                               // $\rho_n$
+EfficiencyGrowth_ss                 // $X^{\star}$
+PopulationGrowth_ss ;               // $N^{\star}$
 
 alpha = .33;
 delta = .02;
@@ -25,27 +25,27 @@ EfficiencyGrowth_ss = 1.00; // Do not change this calibration
 PopulationGrowth_ss = 1.00; // Do not change this calibration
 
 model;
-    Efficiency = EfficiencyGrowth*Efficiency(-1);
-    EfficiencyGrowth/EfficiencyGrowth_ss = (EfficiencyGrowth(-1)/EfficiencyGrowth_ss)^(rho_x)*exp(e_x);
-    Population = PopulationGrowth*Population(-1);
-    PopulationGrowth/PopulationGrowth_ss = (PopulationGrowth(-1)/PopulationGrowth_ss)^(rho_n)*exp(e_n);
-    Output = PhysicalCapitalStock(-1)^alpha*(Efficiency*Population)^(1-alpha);
-    PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output;
+  Efficiency = EfficiencyGrowth*Efficiency(-1);
+  EfficiencyGrowth/EfficiencyGrowth_ss = (EfficiencyGrowth(-1)/EfficiencyGrowth_ss)^(rho_x)*exp(e_x);
+  Population = PopulationGrowth*Population(-1);
+  PopulationGrowth/PopulationGrowth_ss = (PopulationGrowth(-1)/PopulationGrowth_ss)^(rho_n)*exp(e_n);
+  Output = PhysicalCapitalStock(-1)^alpha*(Efficiency*Population)^(1-alpha);
+  PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output;
 end;
 
 d = dseries([.5 1 1 1.04 15], 2000Q1, {'Efficiency'; 'EfficiencyGrowth'; 'Population'; 'PopulationGrowth'; 'PhysicalCapitalStock'});
 
 histval;
-    Efficiency(0) = .5;
-    EfficiencyGrowth(0) = 1;
-    Population(0) = 1;
-    PopulationGrowth(0) = 1.04;
-    PhysicalCapitalStock(0) = 15;
+  Efficiency(0) = .5;
+  EfficiencyGrowth(0) = 1;
+  Population(0) = 1;
+  PopulationGrowth(0) = 1.04;
+  PhysicalCapitalStock(0) = 15;
 end;
 
 LongRunEfficiency = d.Efficiency*d.EfficiencyGrowth^(rho_x/(1-rho_x));
 LongRunPopulation = d.Population*d.PopulationGrowth^(rho_n/(1-rho_n));
-LongRunEfficiencyGrowth = EfficiencyGrowth_ss; 
+LongRunEfficiencyGrowth = EfficiencyGrowth_ss;
 LongRunPopulationGrowth = PopulationGrowth_ss;
 LongRunIntensiveCapitalStock = (s/(LongRunEfficiencyGrowth*LongRunPopulationGrowth-1+delta))^(1/(1-alpha)); //LongRunEfficiencyGrowth*LongRunPopulationGrowth*
 
@@ -54,6 +54,8 @@ T = 5*floor(log(precision)/log(max(rho_x, rho_n)));
 
 e = dseries(zeros(T, 2), 2000Q2, {'e_x'; 'e_n'});
 
+options_.solve_algo = 9;
+
 simulations = simul_backward_model([], T, e);
 
 if abs(simulations.Efficiency.data(end)-LongRunEfficiency.data)>1e-10
-- 
GitLab