diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index bc0cebf6088e713108fece5592c0ba2a815c16c6..28464a2c089374188c40aeb183ae0b52018b4430 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -786,6 +786,11 @@ RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol (it != options_list.num_options.end() && it->second == "true") || mod_file_struct.order_option >= 3) mod_file_struct.k_order_solver = true; + + // Fill list of instruments + if (auto it = options_list.symbol_list_options.find("instruments"); + it != options_list.symbol_list_options.end()) + mod_file_struct.instruments = it->second; } void @@ -944,6 +949,11 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso (it != options_list.num_options.end() && it->second == "true") || mod_file_struct.order_option >= 3) mod_file_struct.k_order_solver = true; + + // Fill list of instruments + if (auto it = options_list.symbol_list_options.find("instruments"); + it != options_list.symbol_list_options.end()) + mod_file_struct.instruments = it->second; } void @@ -1067,6 +1077,11 @@ DiscretionaryPolicyStatement::checkPass(ModFileStructure &mod_file_struct, Warni (it != options_list.num_options.end() && it->second == "true") || mod_file_struct.order_option >= 3) mod_file_struct.k_order_solver = true; + + // Fill list of instruments + if (auto it = options_list.symbol_list_options.find("instruments"); + it != options_list.symbol_list_options.end()) + mod_file_struct.instruments = it->second; } void diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc index 32867240c957dab24c66630138c39860ac50edba..3f88da46b1e0569d3569651142e9c0344ab3bcbf 100644 --- a/src/ModelEquationBlock.cc +++ b/src/ModelEquationBlock.cc @@ -120,12 +120,18 @@ SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat copy(symb_ids.begin(), symb_ids.end(), back_inserter(so_far_defined)); } - set<int> orig_endogs = symbol_table.getOrigEndogenous(); - for (int orig_endog : orig_endogs) + /* Check that all original endogous are defined (except the instruments of a + Ramsey model, since the steady_state_block should give the steady state + *conditional* to those instruments) */ + set<int> should_be_defined = symbol_table.getOrigEndogenous(); + if (mod_file_struct.ramsey_policy_present || mod_file_struct.ramsey_model_present) + for (const auto &s : mod_file_struct.instruments.getSymbols()) + should_be_defined.erase(symbol_table.getID(s)); + for (int v : should_be_defined) { - if (find(so_far_defined.begin(), so_far_defined.end(), orig_endog) + if (find(so_far_defined.begin(), so_far_defined.end(), v) == so_far_defined.end()) - warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(orig_endog) << "' is not assigned a value" << endl; + warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(v) << "' is not assigned a value" << endl; } } diff --git a/src/Statement.hh b/src/Statement.hh index 3ea991307a7005a9366c7526fffdc1ec2dcd3b66..b6d6eab380fcdc071a836c57d6df5b6aa35aca76 100644 --- a/src/Statement.hh +++ b/src/Statement.hh @@ -129,6 +129,8 @@ public: bool write_latex_steady_state_model_present{false}; //! Pac growth and discount set<int> pac_params; + //! Instruments if ramsey_model, ramsey_policy or discretionary_policy is present + SymbolList instruments; }; class Statement