diff --git a/src/ExprNode.hh b/src/ExprNode.hh index 83f32744..17bf0405 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -632,7 +632,9 @@ public: parameter in a term, param_id == -1. Can throw a MatchFailureException. if `variable_obligatory_in_each_term` is true, then every part of the linear combination must contain a variable; - otherwise, if `variable_obligatory_in_each_term`, then any linear combination of constant/variable/param is matched + otherwise, if `variable_obligatory_in_each_term` is false, then any linear + combination of constant/variable/param is matched (and variable_id == -1 + for terms without a variable). */ vector> matchLinearCombinationOfVariables(bool variable_obligatory_in_each_term = true) const; diff --git a/src/SubModel.cc b/src/SubModel.cc index dbfaf0e1..28b09016 100644 --- a/src/SubModel.cc +++ b/src/SubModel.cc @@ -830,14 +830,8 @@ PacModelTable::transformPass(ExprNode::subst_table_t &diff_subst_table, } catch (ExprNode::MatchFailureException &e) { - auto gv = dynamic_cast(growth[name]); - if (gv) - growth_info[name].emplace_back(gv->symb_id, gv->lag, -1, 1); - else - { - cerr << "Pac growth must be a linear combination of variables" << endl; - exit(EXIT_FAILURE); - } + cerr << "ERROR: PAC growth must be a linear combination of variables" << endl; + exit(EXIT_FAILURE); } // Collect some information about PAC models diff --git a/src/SubModel.hh b/src/SubModel.hh index f3a7921e..d45f29c7 100644 --- a/src/SubModel.hh +++ b/src/SubModel.hh @@ -199,6 +199,9 @@ private: map discount; // The growth expressions belong to the main dynamic_model from the ModFile instance map growth, original_growth; + /* Information about the structure of growth expressions (which must be a + linear combination of variables). + Each tuple represents a term: (endo_id, lag, param_id, constant) */ map>> growth_info; /* Stores the name of the PAC equation associated to the model.