preprocessor, auxiliary variables: fixes ordering issue introduced in
347ab4d0c0c79ae9a42898c1d5409d78708bb8a8 and corrects the earlier ordering problem.issue#70
parent
e5e58656ad
commit
16f550a986
|
@ -4018,8 +4018,14 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
for (int i = 0; i < (int) neweqs.size(); i++)
|
||||
addEquation(neweqs[i]);
|
||||
|
||||
// Add the new set of equations at the *beginning* of aux_equations
|
||||
copy(neweqs.rbegin(), neweqs.rend(), front_inserter(aux_equations));
|
||||
// Order of auxiliary variable definition equations:
|
||||
// - expectation (entered before this function is called)
|
||||
// - lead variables from lower lead to higher lead (need to be listed in reverse order)
|
||||
// - lag variables from lower lag to higher lag
|
||||
if ((type == avEndoLead) || (type == avExoLead))
|
||||
copy(neweqs.rbegin(), neweqs.rend(), back_inserter(aux_equations));
|
||||
else
|
||||
copy(neweqs.begin(), neweqs.end(), back_inserter(aux_equations));
|
||||
|
||||
if (neweqs.size() > 0)
|
||||
{
|
||||
|
|
|
@ -1702,7 +1702,7 @@ StaticModel::writeLatexFile(const string &basename) const
|
|||
void
|
||||
StaticModel::writeAuxVarInitval(ostream &output, ExprNodeOutputType output_type) const
|
||||
{
|
||||
for (int i = (int) aux_equations.size()-1; i >= 0; i--)
|
||||
for (int i = 0; i < (int) aux_equations.size(); i++)
|
||||
{
|
||||
dynamic_cast<ExprNode *>(aux_equations[i])->writeOutput(output, output_type);
|
||||
output << ";" << endl;
|
||||
|
@ -1730,7 +1730,7 @@ void StaticModel::writeAuxVarRecursiveDefinitions(const string &basename) const
|
|||
<< "% from model file (.mod)" << endl
|
||||
<< endl;
|
||||
|
||||
for (int i = (int) aux_equations.size()-1; i >= 0; i--)
|
||||
for (int i = 0; i < (int) aux_equations.size(); i++)
|
||||
{
|
||||
dynamic_cast<ExprNode *>(aux_equations[i])->writeOutput(output, oMatlabStaticModel);
|
||||
output << ";" << endl;
|
||||
|
|
Loading…
Reference in New Issue