| 1 |
// Example that triggers homotopy in perfect foresight simulation. |
| 2 |
// Tests homotopy_linearization_fallback with perfect_foresight_controlled_paths |
| 3 |
|
| 4 |
@#include "homotopy_linearization.inc" |
| 5 |
|
| 6 |
perfect_foresight_controlled_paths; |
| 7 |
exogenize LoggedProductivity; |
| 8 |
periods 8:9; |
| 9 |
values 5; |
| 10 |
endogenize LoggedProductivityInnovation; |
| 11 |
end; |
| 12 |
|
| 13 |
perfect_foresight_setup(periods=200, endval_steady); |
| 14 |
|
| 15 |
perfect_foresight_solver(homotopy_max_completion_share = 0.7, |
| 16 |
homotopy_linearization_fallback, |
| 17 |
steady_solve_algo = 13); |
| 18 |
|
| 19 |
if ~oo_.deterministic_simulation.status |
| 20 |
error('Perfect foresight simulation failed') |
| 21 |
end |
| 22 |
|
| 23 |
if ~(all(abs(oo_.endo_simul(3, 9:10) - 5) < 1e-15) && abs(oo_.exo_simul(10) - 0.5) < 1e-15) |
| 24 |
error('Homotopy with linearization and controlled paths failed') |
| 25 |
end |