Revert "remove unnecessary code for calculation of max lag when equation have been undiffed"

This reverts commit d7c979a4e6.
issue#70
Houtan Bastani 2018-06-02 12:17:05 +02:00
parent d7c979a4e6
commit f338e87692
3 changed files with 19 additions and 0 deletions

View File

@ -3555,6 +3555,22 @@ DynamicModel::getUndiffLHSForPac(vector<int> &lhs, vector<expr_t> &lhs_expr_t, v
}
}
int
DynamicModel::getUndiffMaxLag(StaticModel &static_model, vector<expr_t> &lhs, vector<int> &eqnumber) const
{
set<expr_t> lhs_static;
for(vector<expr_t>::const_iterator it = lhs.begin();
it != lhs.end(); it++)
lhs_static.insert((*it)->toStatic(static_model));
int max_lag = 0;
for (vector<int>::const_iterator it = eqnumber.begin();
it != eqnumber.end(); it++)
equations[*it]->get_arg2()->VarMaxLag(static_model, lhs_static, max_lag);
return max_lag;
}
void
DynamicModel::walkPacParameters()
{

View File

@ -316,6 +316,8 @@ public:
int max_lag,
vector<bool> &nonstationary,
int growth_symb_id);
//! Get the max lag for the PAC VAR
int getUndiffMaxLag(StaticModel &static_model, vector<expr_t> &lhs, vector<int> &eqnumber) const;
//! Substitutes pac_expectation operator
void substitutePacExpectation();

View File

@ -427,6 +427,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
vector<int> orig_diff_var = var_model_info_pac_expectation[var_model_name].first.second.second;
vector<int> eqnumber = var_model_info_pac_expectation[var_model_name].second.second;
dynamic_model.getUndiffLHSForPac(lhs, lhs_expr_t, diff, orig_diff_var, eqnumber, undiff, diff_subst_table);
max_lag = original_model.getUndiffMaxLag(diff_static_model, lhs_expr_t, eqnumber);
}
pms->fillUndiffedLHS(lhs);
dynamic_model.walkPacParameters();