From 567156aad40b9bf07abc9346ef5ff365765ab881 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Thu, 4 Jun 2015 14:16:52 +0200
Subject: [PATCH] option occbin allows for more equations than variables

---
 ComputingTasks.cc | 9 +++++++++
 ModFile.cc        | 1 +
 Statement.cc      | 3 ++-
 Statement.hh      | 2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 4e95890d..32d3690b 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -126,6 +126,10 @@ void
 PerfectForesightSolverStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
   mod_file_struct.perfect_foresight_solver_present = true;
+  // Fill in option_occbin of mod_file_struct
+  OptionsList::string_options_t::const_iterator it = options_list.num_options.find("occbin");
+  if (it != options_list.string_options.end())
+    mod_file_struct.occbin_option = true;
 }
 
 void
@@ -4221,6 +4225,11 @@ ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
       cerr << "ERROR: the 'periods' option of 'extended_path' is mandatory" << endl;
       exit(EXIT_FAILURE);
     }
+
+  // Fill in option_occbin of mod_file_struct
+  OptionsList::string_options_t::const_iterator it = options_list.num_options.find("occbin");
+  if (it != options_list.string_options.end())
+    mod_file_struct.occbin_option = true;
 }
 
 void
diff --git a/ModFile.cc b/ModFile.cc
index 9c303b01..862fd4ca 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -421,6 +421,7 @@ ModFile::transformPass(bool nostrict)
   */
   if (!(mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present)
       && !(mod_file_struct.bvar_present && dynamic_model.equation_number() == 0)
+      && !(mod_file_struct.occbin_option)
       && (dynamic_model.equation_number() != symbol_table.endo_nbr()))
     {
       cerr << "ERROR: There are " << dynamic_model.equation_number() << " equations but " << symbol_table.endo_nbr() << " endogenous variables!" << endl;
diff --git a/Statement.cc b/Statement.cc
index b7669c11..a061a6b6 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -50,7 +50,8 @@ ModFileStructure::ModFileStructure() :
   estimation_data_statement_present(false),
   last_markov_switching_chain(0),
   calib_smoother_present(false),
-  estim_params_use_calib(false)
+  estim_params_use_calib(false),
+  occbin_option(false)
 {
 }
 
diff --git a/Statement.hh b/Statement.hh
index 4075524d..4c53f9fc 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -118,6 +118,8 @@ public:
   bool corr_options_statement_present;
   //! Whether a Markov Switching DSGE is present
   bool ms_dsge_present;
+  //! Whether occbin is present
+  bool occbin_option;
 };
 
 class Statement
-- 
GitLab