From 22a3ee6029a28d8671c7745c6b860cb2e5cd0d8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Puck=29?= <stepan@adjemian.eu>
Date: Fri, 20 Sep 2024 12:07:31 +0200
Subject: [PATCH] Add provisions for Julia benchmarks.

---
 models/modeqs.mod | 10 +++++-----
 models/pshock.mod | 20 ++++++++++++++++++++
 models/tshock.mod | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/models/modeqs.mod b/models/modeqs.mod
index d012c38..6a556d6 100644
--- a/models/modeqs.mod
+++ b/models/modeqs.mod
@@ -1,12 +1,12 @@
-@#if !BLOCKS && !BYTECODE && !USE_DLL // -> MATLAB
+@#if ISJULIA || !BLOCKS && !BYTECODE && !USE_DLL // -> MATLAB
 model;
-@#elseif BLOCKS && !BYTECODE && !USE_DLL // -> MATLAB WITH BLOCKS
+@#elseif !ISJULIA && BLOCKS && !BYTECODE && !USE_DLL // -> MATLAB WITH BLOCKS
 model(block, cutoff=@{CUTOFF_VALUE}, mfs=@{MFS_VALUE}, static_mfs=@{STATIC_MFS_VALUE});
-@#elseif !BLOCKS && BYTECODE && !USE_DLL // -> BYTECODE
+@#elseif !ISJULIA && !BLOCKS && BYTECODE && !USE_DLL // -> BYTECODE
 model(bytecode);
-@#elseif BLOCKS && BYTECODE && !USE_DLL // -> BYTECODE WITH BLOCKS
+@#elseif !ISJULIA && BLOCKS && BYTECODE && !USE_DLL // -> BYTECODE WITH BLOCKS
 model(block, bytecode, cutoff=@{CUTOFF_VALUE}, mfs=@{MFS_VALUE}, static_mfs=@{STATIC_MFS_VALUE});
-@#elseif !BLOCKS && !BYTECODE && USE_DLL // -> USE_DLL
+@#elseif !ISJULIA && !BLOCKS && !BYTECODE && USE_DLL // -> USE_DLL
 model(use_dll);
 @#else // USE_DLL WITH BLOCKS
 model(block, use_dll, cutoff=@{CUTOFF_VALUE}, mfs=@{MFS_VALUE}, static_mfs=@{STATIC_MFS_VALUE});
diff --git a/models/pshock.mod b/models/pshock.mod
index 0e44bdd..a6a647b 100644
--- a/models/pshock.mod
+++ b/models/pshock.mod
@@ -1,5 +1,9 @@
 @#define steady = 0
 
+@#ifndef ISJULIA
+@#define ISJULIA=false
+@#endif
+
 @#ifndef BLOCKS
 @#define BLOCKS=false
 @#endif
@@ -46,6 +50,8 @@
 
 @#include "modeqs.mod"
 
+@#if !ISJULIA
+
 for i=1:@{ITERATIONS}
 
 load_params_and_steady_state('eagle_steady.txt');
@@ -62,3 +68,17 @@ perfect_foresight_setup(periods=@{PERIODS});
 perfect_foresight_solver(no_homotopy, markowitz=@{MARKOWITZ_VALUE}, stack_solve_algo = @{STACK_SOLVE_ALGO_VALUE}, solve_algo = @{STEADY_SOLVE_ALGO_VALUE});
 
 end;
+
+@#else
+
+load_params_and_steady_state('eagle_steady.txt');
+
+initval;
+@#include "initial-condition.inc"
+end;
+
+endval;
+@#include "terminal-condition.inc"
+end;
+
+@#endif
diff --git a/models/tshock.mod b/models/tshock.mod
index 2edca9d..8735d28 100644
--- a/models/tshock.mod
+++ b/models/tshock.mod
@@ -1,5 +1,9 @@
 @#define steady = 0
 
+@#ifndef ISJULIA
+@#define ISJULIA=false
+@#endif
+
 @#ifndef BLOCKS
 @#define BLOCKS=false
 @#endif
@@ -46,6 +50,8 @@
 
 @#include "modeqs.mod"
 
+@#if !ISJULIA
+
 for i=1:@{ITERATIONS}
 
 load_params_and_steady_state('eagle_steady.txt');
@@ -90,3 +96,45 @@ perfect_foresight_setup(periods=@{PERIODS});
 perfect_foresight_solver(no_homotopy, markowitz=@{MARKOWITZ_VALUE}, stack_solve_algo = @{STACK_SOLVE_ALGO_VALUE}, solve_algo = @{STEADY_SOLVE_ALGO_VALUE});
 
 end;
+
+@#else
+
+load_params_and_steady_state('eagle_steady.txt');
+
+initval;
+@#include "initial-condition.inc"
+end;
+
+shocks;
+
+  var EAB_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var EAA_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var RW_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var US_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var CH_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var JP_epsg;
+  periods 1:4;
+  values 0.01;
+
+  var LAC_epsg;
+  periods 1:4;
+  values 0.01;
+
+end;
+
+@#endif
-- 
GitLab