preprocessor: take care of extra exos in planner_objective

issue#70
Houtan Bastani 2015-04-08 16:35:09 +02:00
parent 5fb6667f86
commit c22d5f6b2b
2 changed files with 17 additions and 0 deletions

View File

@ -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
{

View File

@ -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