From 5a60f2d9d7f1baf3807e95e63ecf9095c30fa07d Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Thu, 2 Apr 2015 17:57:12 +0200 Subject: [PATCH] take care of extra exos in estimated_params_init --- ComputingTasks.cc | 26 ++++++++++++++++++++++++++ ComputingTasks.hh | 1 + 2 files changed, 27 insertions(+) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index b060df70..c617fbf4 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -975,6 +975,32 @@ EstimatedParamsInitStatement::checkPass(ModFileStructure &mod_file_struct, Warni mod_file_struct.estim_params_use_calib = true; } +Statement * +EstimatedParamsInitStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table) +{ + vector new_estim_params_list; + SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable(); + try + { + for (vector::const_iterator it = estim_params_list.begin(); + it != estim_params_list.end(); it++) + if (!it->name2.empty()) + { + new_symbol_table->getID(it->name); + new_symbol_table->getID(it->name2); + } + else + new_symbol_table->getID(it->name); + } + catch (SymbolTable::UnknownSymbolNameException &e) + { + cerr << "ERROR: A variable in the estimated_params_init statement was not found in the symbol table" << endl + << " This likely means that you have declared a varexo that is not used in the model" << endl; + exit(EXIT_FAILURE); + } + return new EstimatedParamsInitStatement(estim_params_list, *new_symbol_table, use_calibration); +} + void EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basename) const { diff --git a/ComputingTasks.hh b/ComputingTasks.hh index 690315c7..d1b08beb 100644 --- a/ComputingTasks.hh +++ b/ComputingTasks.hh @@ -333,6 +333,7 @@ public: const bool use_calibration_arg); virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings); virtual void writeOutput(ostream &output, const string &basename) const; + virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table); }; class EstimatedParamsBoundsStatement : public Statement