From d0bc8128c7a614bda2eb356cb95c92aa17523cbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 29 Mar 2023 15:14:36 +0200
Subject: [PATCH] ramsey_model: remove useless checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Options “order”, “partial_information” and “k_order_solver” are not accepted by
the command (this code is probably a remnant of the deprecated “ramsey_policy”
command).
---
 src/ComputingTasks.cc | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 9d7d5035..ab0d9c38 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -482,30 +482,6 @@ RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct,
 {
   mod_file_struct.ramsey_model_present = true;
 
-  /* Fill in option_order of mod_file_struct
-     Since ramsey model needs one further order of derivation (for example, for 1st order
-     approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
-  if (auto opt = options_list.get_if<OptionsList::NumVal>("order"))
-    {
-      int order = stoi(*opt);
-      if (order > 2)
-        {
-          cerr << "ERROR: ramsey_model: order > 2 is not  implemented" << endl;
-          exit(EXIT_FAILURE);
-        }
-      mod_file_struct.order_option = max(mod_file_struct.order_option, order + 1);
-    }
-
-  // Fill in mod_file_struct.partial_information
-  if (auto opt = options_list.get_if<OptionsList::NumVal>("partial_information");
-      opt && *opt == "true")
-    mod_file_struct.partial_information = true;
-
-  // Option k_order_solver (implicit when order >= 3)
-  if (auto opt = options_list.get_if<OptionsList::NumVal>("k_order_solver");
-      (opt && *opt == "true") || mod_file_struct.order_option >= 3)
-    mod_file_struct.k_order_solver = true;
-
   // Fill list of instruments
   if (auto opt = options_list.get_if<OptionsList::SymbolListVal>("instruments"))
     mod_file_struct.instruments = *opt;
@@ -515,12 +491,6 @@ void
 RamseyModelStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename,
                                   [[maybe_unused]] bool minimal_workspace) const
 {
-  // Ensure that order 3 implies k_order (#844)
-  if (auto opt1 = options_list.get_if<OptionsList::NumVal>("order"),
-      opt2 = options_list.get_if<OptionsList::NumVal>("k_order_solver");
-      (opt2 && *opt2 == "true") || (opt1 && stoi(*opt1) >= 3))
-    output << "options_.k_order_solver = true;" << endl;
-
   options_list.writeOutput(output);
 }
 
-- 
GitLab