Commit cb9d603e authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Add a warning if some endogenous is not present in steady_state_model block.

Closes #556
parent eaf02155
......@@ -93,6 +93,15 @@ SteadyStateModel::checkPass(bool ramsey_policy, WarningConsolidation &warnings)
copy(symb_ids.begin(), symb_ids.end(), back_inserter(so_far_defined));
}
set<int> orig_endogs = symbol_table.getOrigEndogenous();
for (set<int>::const_iterator it = orig_endogs.begin();
it != orig_endogs.end(); ++it)
{
if (find(so_far_defined.begin(), so_far_defined.end(), *it)
== so_far_defined.end())
warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(*it) << "' is not assigned a value" << endl;
}
}
void
......
/*
* Copyright (C) 2003-2013 Dynare Team
* Copyright (C) 2003-2014 Dynare Team
*
* This file is part of Dynare.
*
......@@ -591,3 +591,23 @@ SymbolTable::getEndogenous() const
endogs.insert(it->second);
return endogs;
}
bool
SymbolTable::isAuxiliaryVariable(int symb_id) const
{
for (int i = 0; i < aux_vars.size(); i++)
if (aux_vars[i].get_symb_id() == symb_id)
return true;
return false;
}
set<int>
SymbolTable::getOrigEndogenous() const
{
set <int> origendogs;
for (symbol_table_type::const_iterator it = symbol_table.begin();
it != symbol_table.end(); it++)
if (getType(it->second) == eEndogenous && !isAuxiliaryVariable(it->second))
origendogs.insert(it->second);
return origendogs;
}
/*
* Copyright (C) 2003-2013 Dynare Team
* Copyright (C) 2003-2014 Dynare Team
*
* This file is part of Dynare.
*
......@@ -297,6 +297,10 @@ public:
set <int> getExogenous() const;
//! Get list of endogenous variables
set <int> getEndogenous() const;
//! Is a given symbol an auxiliary variable
bool isAuxiliaryVariable(int symb_id) const;
//! Get list of endogenous variables without aux vars
set <int> getOrigEndogenous() const;
};
inline bool
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment