From 613e7461e0302b7efe359e6c755bd553e561f2aa 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 --- preprocessor/ComputingTasks.cc | 16 ++++++++++++++++ preprocessor/ComputingTasks.hh | 1 + 2 files changed, 17 insertions(+) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 1d86564e0..7700ebc20 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/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/preprocessor/ComputingTasks.hh b/preprocessor/ComputingTasks.hh index 4eedddb4b..fdb894ee3 100644 --- a/preprocessor/ComputingTasks.hh +++ b/preprocessor/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