From c22d5f6b2be6470c0d160bf233d2cf412e09be7b Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 8 Apr 2015 16:35:09 +0200 Subject: [PATCH] preprocessor: take care of extra exos in planner_objective --- ComputingTasks.cc | 16 ++++++++++++++++ ComputingTasks.hh | 1 + 2 files changed, 17 insertions(+) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 1d86564e..7700ebc2 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -1534,6 +1534,22 @@ PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct, WarningC mod_file_struct.planner_objective_present = true; } +Statement * +PlannerObjectiveStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table) +{ + try + { + model_tree->reindex(orig_symbol_table); + } + catch (...) + { + cerr << "ERROR: A variable in the planner_objective 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 PlannerObjectiveStatement(model_tree); +} + StaticModel * PlannerObjectiveStatement::getPlannerObjective() const { diff --git a/ComputingTasks.hh b/ComputingTasks.hh index 4eedddb4..fdb894ee 100644 --- a/ComputingTasks.hh +++ b/ComputingTasks.hh @@ -390,6 +390,7 @@ public: virtual void writeOutput(ostream &output, const string &basename) const; //! Return the Planner Objective StaticModel *getPlannerObjective() const; + virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table); }; class BVARDensityStatement : public Statement