Commit 21f8b832 authored by Houtan Bastani's avatar Houtan Bastani

do not substitute unary ops in equations that don’t need it (non var_model and...

do not substitute unary ops in equations that don’t need it (non var_model and non trend_component_model)
parent ac94ad90
Pipeline #208 passed with stage
in 1 minute and 25 seconds
......@@ -5874,13 +5874,13 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model, vector<int> &eqnumbe
for (auto & it : local_variables_table)
it.second = it.second->substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs);
// Substitute in equations
for (auto & equation : equations)
// Substitute only in equations requested
for (int eqnumber : eqnumbers)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
auto *substeq = dynamic_cast<BinaryOpNode *>(equations[eqnumber]->
substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs));
assert(substeq != nullptr);
equation = substeq;
equations[eqnumber] = substeq;
}
// Add new equations
......
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