parent
4798a5e2bc
commit
825b9ee8ef
|
@ -1636,9 +1636,9 @@ VariableNode::decreaseLeadsLags(int n) const
|
||||||
expr_t
|
expr_t
|
||||||
VariableNode::decreaseLeadsLagsPredeterminedVariables() const
|
VariableNode::decreaseLeadsLagsPredeterminedVariables() const
|
||||||
{
|
{
|
||||||
if (get_type() == SymbolType::modelLocalVariable)
|
/* Do not recurse into model-local variables definitions, since MLVs are
|
||||||
return datatree.getLocalVariable(symb_id)->decreaseLeadsLagsPredeterminedVariables();
|
already handled by DynamicModel::transformPredeterminedVariables().
|
||||||
|
This is also necessary because of #65. */
|
||||||
if (datatree.symbol_table.isPredetermined(symb_id))
|
if (datatree.symbol_table.isPredetermined(symb_id))
|
||||||
return decreaseLeadsLags(1);
|
return decreaseLeadsLags(1);
|
||||||
else
|
else
|
||||||
|
@ -1987,8 +1987,9 @@ VariableNode::getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const
|
||||||
expr_t
|
expr_t
|
||||||
VariableNode::replaceVarsInEquation(map<VariableNode *, NumConstNode *> &table) const
|
VariableNode::replaceVarsInEquation(map<VariableNode *, NumConstNode *> &table) const
|
||||||
{
|
{
|
||||||
/* Do not recurse into model-local variables definition, because otherwise
|
/* Do not recurse into model-local variables definitions, since MLVs are
|
||||||
this would substitute MLV in the original model (see #65). */
|
already handled by ModelTree::simplifyEquations().
|
||||||
|
This is also necessary because of #65. */
|
||||||
for (auto &it : table)
|
for (auto &it : table)
|
||||||
if (it.first->symb_id == symb_id)
|
if (it.first->symb_id == symb_id)
|
||||||
return it.second;
|
return it.second;
|
||||||
|
|
|
@ -1639,6 +1639,8 @@ ModelTree::simplifyEquations()
|
||||||
while (subst_table.size() != last_subst_table_size)
|
while (subst_table.size() != last_subst_table_size)
|
||||||
{
|
{
|
||||||
last_subst_table_size = subst_table.size();
|
last_subst_table_size = subst_table.size();
|
||||||
|
for (auto &[id, definition] : local_variables_table)
|
||||||
|
definition = definition->replaceVarsInEquation(subst_table);
|
||||||
for (auto &equation : equations)
|
for (auto &equation : equations)
|
||||||
equation = dynamic_cast<BinaryOpNode *>(equation->replaceVarsInEquation(subst_table));
|
equation = dynamic_cast<BinaryOpNode *>(equation->replaceVarsInEquation(subst_table));
|
||||||
subst_table.clear();
|
subst_table.clear();
|
||||||
|
|
Loading…
Reference in New Issue