PAC: minor simplification in the matching of the growth expression
Simple variable nodes are already correctly matched by ExprNode::matchLinearCombinationOfVariables(). Also improve the related documentation.pac-components
parent
7dde09169e
commit
6a31ba4b62
|
@ -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<tuple<int, int, int, double>> matchLinearCombinationOfVariables(bool variable_obligatory_in_each_term = true) const;
|
||||
|
||||
|
|
|
@ -830,14 +830,8 @@ PacModelTable::transformPass(ExprNode::subst_table_t &diff_subst_table,
|
|||
}
|
||||
catch (ExprNode::MatchFailureException &e)
|
||||
{
|
||||
auto gv = dynamic_cast<const VariableNode *>(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
|
||||
|
|
|
@ -199,6 +199,9 @@ private:
|
|||
map<string, string> discount;
|
||||
// The growth expressions belong to the main dynamic_model from the ModFile instance
|
||||
map<string, expr_t> 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<string, vector<tuple<int, int, int, double>>> growth_info;
|
||||
|
||||
/* Stores the name of the PAC equation associated to the model.
|
||||
|
|
Loading…
Reference in New Issue