2018-08-14 14:23:21 +02:00
|
|
|
|
/*
|
2022-01-18 12:40:15 +01:00
|
|
|
|
* Copyright © 2018-2022 Dynare Team
|
2018-08-14 14:23:21 +02:00
|
|
|
|
*
|
|
|
|
|
* This file is part of Dynare.
|
|
|
|
|
*
|
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-09-13 12:21:23 +02:00
|
|
|
|
* GNU General Public License for more details.SS
|
2018-08-14 14:23:21 +02:00
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-06-09 16:52:20 +02:00
|
|
|
|
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2018-08-14 14:23:21 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _SUBMODEL_HH
|
|
|
|
|
#define _SUBMODEL_HH
|
|
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <iostream>
|
2022-05-05 18:39:04 +02:00
|
|
|
|
#include <optional>
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
#include "ExprNode.hh"
|
|
|
|
|
#include "SymbolTable.hh"
|
2019-12-19 16:38:46 +01:00
|
|
|
|
#include "SymbolList.hh"
|
2021-10-27 16:26:52 +02:00
|
|
|
|
#include "Statement.hh"
|
|
|
|
|
|
|
|
|
|
// DynamicModel.hh can’t be included here, otherwise it would be a circular dependency
|
|
|
|
|
class DynamicModel;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
//! A table with all Trend Component Models in the .mod file
|
|
|
|
|
/*!
|
|
|
|
|
The unique name of the trend component model is the identifier
|
|
|
|
|
*/
|
|
|
|
|
class TrendComponentModelTable
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
SymbolTable &symbol_table;
|
|
|
|
|
set<string> names;
|
2018-09-13 12:21:23 +02:00
|
|
|
|
map<string, vector<string>> eqtags, target_eqtags;
|
2022-05-16 15:56:54 +02:00
|
|
|
|
map<string, vector<int>> eqnums, target_eqnums, nontarget_eqnums, max_lags, lhs, target_lhs, nontarget_lhs;
|
|
|
|
|
map<string, vector<optional<int>>> orig_diff_var;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
map<string, vector<set<pair<int, int>>>> rhs;
|
2018-10-24 15:57:07 +02:00
|
|
|
|
map<string, vector<bool>> diff;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
map<string, vector<expr_t>> lhs_expr_t;
|
2022-05-05 18:39:04 +02:00
|
|
|
|
map<string, vector<optional<int>>> target_vars;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
map<string, map<tuple<int, int, int>, expr_t>> AR; // name -> (eqn, lag, lhs_symb_id) -> expr_t
|
2021-07-07 10:54:04 +02:00
|
|
|
|
/* Note that A0 in the trend-component model context is not the same thing as
|
|
|
|
|
in the structural VAR context. */
|
2022-01-28 16:38:50 +01:00
|
|
|
|
map<string, map<tuple<int, int>, expr_t>> A0, A0star; // name -> (eqn, col) -> expr_t
|
2018-08-14 14:23:21 +02:00
|
|
|
|
public:
|
2018-10-04 15:17:13 +02:00
|
|
|
|
explicit TrendComponentModelTable(SymbolTable &symbol_table_arg);
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
//! Add a trend component model
|
2018-08-22 09:15:00 +02:00
|
|
|
|
void addTrendComponentModel(string name_arg, vector<string> eqtags_arg,
|
2018-09-13 12:21:23 +02:00
|
|
|
|
vector<string> target_eqtags_arg);
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
inline bool isExistingTrendComponentModelName(const string &name_arg) const;
|
2018-08-22 09:15:00 +02:00
|
|
|
|
inline bool empty() const;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
2021-07-01 16:16:04 +02:00
|
|
|
|
const map<string, vector<string>> &getEqTags() const;
|
|
|
|
|
const vector<string> &getEqTags(const string &name_arg) const;
|
|
|
|
|
const map<string, vector<string>> &getTargetEqTags() const;
|
|
|
|
|
const map<string, vector<int>> &getEqNums() const;
|
|
|
|
|
const map<string, vector<int>> &getTargetEqNums() const;
|
|
|
|
|
const vector<int> &getTargetEqNums(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getEqNums(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getMaxLags(const string &name_arg) const;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
int getMaxLag(const string &name_arg) const;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
const vector<int> &getLhs(const string &name_arg) const;
|
|
|
|
|
const vector<expr_t> &getLhsExprT(const string &name_arg) const;
|
|
|
|
|
const vector<bool> &getDiff(const string &name_arg) const;
|
|
|
|
|
const map<string, vector<int>> &getNonTargetEqNums() const;
|
|
|
|
|
const vector<int> &getNonTargetEqNums(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getNonTargetLhs(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getTargetLhs(const string &name_arg) const;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
2018-09-13 12:21:23 +02:00
|
|
|
|
void setVals(map<string, vector<int>> eqnums_arg, map<string, vector<int>> target_eqnums_arg,
|
2018-09-12 11:56:04 +02:00
|
|
|
|
map<string, vector<int>> lhs_arg,
|
2018-10-24 15:57:07 +02:00
|
|
|
|
map<string, vector<expr_t>> lhs_expr_t_arg);
|
2018-08-14 14:23:21 +02:00
|
|
|
|
void setRhs(map<string, vector<set<pair<int, int>>>> rhs_arg);
|
|
|
|
|
void setMaxLags(map<string, vector<int>> max_lags_arg);
|
|
|
|
|
void setDiff(map<string, vector<bool>> diff_arg);
|
2022-05-16 15:56:54 +02:00
|
|
|
|
void setOrigDiffVar(map<string, vector<optional<int>>> orig_diff_var_arg);
|
2022-05-05 18:39:04 +02:00
|
|
|
|
void setTargetVar(map<string, vector<optional<int>>> target_vars_arg);
|
2018-09-07 10:56:40 +02:00
|
|
|
|
void setAR(map<string, map<tuple<int, int, int>, expr_t>> AR_arg);
|
2022-01-28 16:38:50 +01:00
|
|
|
|
void setA0(map<string, map<tuple<int, int>, expr_t>> A0_arg,
|
|
|
|
|
map<string, map<tuple<int, int>, expr_t>> A0star_arg);
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
//! Write output of this class
|
2018-09-07 10:56:40 +02:00
|
|
|
|
void writeOutput(const string &basename, ostream &output) const;
|
2018-08-14 14:23:21 +02:00
|
|
|
|
|
|
|
|
|
//! Write JSON Output
|
|
|
|
|
void writeJsonOutput(ostream &output) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void checkModelName(const string &name_arg) const;
|
2018-09-13 12:21:23 +02:00
|
|
|
|
void setNonTargetEqnums();
|
2018-08-14 14:23:21 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
|
TrendComponentModelTable::isExistingTrendComponentModelName(const string &name_arg) const
|
|
|
|
|
{
|
2022-05-04 16:01:34 +02:00
|
|
|
|
return names.contains(name_arg);
|
2018-08-14 14:23:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-08-22 09:15:00 +02:00
|
|
|
|
inline bool
|
|
|
|
|
TrendComponentModelTable::empty() const
|
|
|
|
|
{
|
|
|
|
|
return names.empty();
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-21 11:46:59 +02:00
|
|
|
|
class VarModelTable
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
SymbolTable &symbol_table;
|
|
|
|
|
set<string> names;
|
2021-07-07 10:54:04 +02:00
|
|
|
|
map<string, bool> structural; // Whether VARs are structural or reduced-form
|
2018-08-21 11:46:59 +02:00
|
|
|
|
map<string, vector<string>> eqtags;
|
2022-05-16 15:56:54 +02:00
|
|
|
|
map<string, vector<int>> eqnums, max_lags, lhs, lhs_orig_symb_ids;
|
|
|
|
|
map<string, vector<optional<int>>> orig_diff_var;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
map<string, vector<set<pair<int, int>>>> rhs; // name -> for each equation: set of pairs (var, lag)
|
2018-10-24 15:57:07 +02:00
|
|
|
|
map<string, vector<bool>> diff;
|
2018-08-21 11:46:59 +02:00
|
|
|
|
map<string, vector<expr_t>> lhs_expr_t;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
map<string, map<tuple<int, int, int>, expr_t>> AR; // name -> (eqn, lag, lhs_symb_id) -> param_expr_t
|
2021-07-07 10:54:04 +02:00
|
|
|
|
/* The A0 matrix is mainly for structural VARs. For reduced-form VARs, it
|
|
|
|
|
will be equal to the identity matrix. Also note that A0 in the structural
|
|
|
|
|
VAR context is not the same thing as in the trend-component model
|
|
|
|
|
context. */
|
|
|
|
|
map<string, map<tuple<int, int>, expr_t>> A0; // name -> (eqn, lhs_symb_id) -> param_expr_t
|
2021-07-16 15:12:37 +02:00
|
|
|
|
map<string, map<int, expr_t>> constants; // name -> eqn -> constant
|
2018-08-21 11:46:59 +02:00
|
|
|
|
public:
|
2018-10-04 15:17:13 +02:00
|
|
|
|
explicit VarModelTable(SymbolTable &symbol_table_arg);
|
2018-08-21 11:46:59 +02:00
|
|
|
|
|
2018-09-07 10:56:40 +02:00
|
|
|
|
//! Add a VAR model
|
2021-07-07 10:54:04 +02:00
|
|
|
|
void addVarModel(string name, bool structural_arg, vector<string> eqtags);
|
2018-08-21 11:46:59 +02:00
|
|
|
|
|
|
|
|
|
inline bool isExistingVarModelName(const string &name_arg) const;
|
|
|
|
|
inline bool empty() const;
|
|
|
|
|
|
2021-07-07 10:54:04 +02:00
|
|
|
|
const map<string, bool> &getStructural() const;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
const map<string, vector<string>> &getEqTags() const;
|
|
|
|
|
const vector<string> &getEqTags(const string &name_arg) const;
|
|
|
|
|
const map<string, vector<int>> &getEqNums() const;
|
|
|
|
|
const vector<bool> &getDiff(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getEqNums(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getMaxLags(const string &name_arg) const;
|
2018-08-21 11:46:59 +02:00
|
|
|
|
int getMaxLag(const string &name_arg) const;
|
2021-07-01 16:16:04 +02:00
|
|
|
|
const vector<int> &getLhs(const string &name_arg) const;
|
|
|
|
|
const vector<int> &getLhsOrigIds(const string &name_arg) const;
|
|
|
|
|
const vector<set<pair<int, int>>> &getRhs(const string &name_arg) const;
|
|
|
|
|
const vector<expr_t> &getLhsExprT(const string &name_arg) const;
|
2018-08-21 11:46:59 +02:00
|
|
|
|
|
|
|
|
|
void setEqNums(map<string, vector<int>> eqnums_arg);
|
|
|
|
|
void setLhs(map<string, vector<int>> lhs_arg);
|
|
|
|
|
void setRhs(map<string, vector<set<pair<int, int>>>> rhs_arg);
|
|
|
|
|
void setLhsExprT(map<string, vector<expr_t>> lhs_expr_t_arg);
|
|
|
|
|
void setDiff(map<string, vector<bool>> diff_arg);
|
|
|
|
|
void setMaxLags(map<string, vector<int>> max_lags_arg);
|
2022-05-16 15:56:54 +02:00
|
|
|
|
void setOrigDiffVar(map<string, vector<optional<int>>> orig_diff_var_arg);
|
2018-09-07 10:14:18 +02:00
|
|
|
|
void setAR(map<string, map<tuple<int, int, int>, expr_t>> AR_arg);
|
2021-07-07 10:54:04 +02:00
|
|
|
|
void setA0(map<string, map<tuple<int, int>, expr_t>> A0_arg);
|
2021-07-16 15:12:37 +02:00
|
|
|
|
void setConstants(map<string, map<int, expr_t>> constants_arg);
|
2018-08-21 11:46:59 +02:00
|
|
|
|
|
|
|
|
|
//! Write output of this class
|
2018-09-06 17:53:07 +02:00
|
|
|
|
void writeOutput(const string &basename, ostream &output) const;
|
2018-08-21 11:46:59 +02:00
|
|
|
|
|
|
|
|
|
//! Write JSON Output
|
|
|
|
|
void writeJsonOutput(ostream &output) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void checkModelName(const string &name_arg) const;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
|
VarModelTable::isExistingVarModelName(const string &name_arg) const
|
|
|
|
|
{
|
2022-05-04 16:01:34 +02:00
|
|
|
|
return names.contains(name_arg);
|
2018-08-21 11:46:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
|
VarModelTable::empty() const
|
|
|
|
|
{
|
|
|
|
|
return names.empty();
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 16:15:43 +01:00
|
|
|
|
class VarExpectationModelTable
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
SymbolTable &symbol_table;
|
|
|
|
|
set<string> names;
|
|
|
|
|
map<string, expr_t> expression;
|
|
|
|
|
map<string, string> aux_model_name;
|
|
|
|
|
map<string, string> horizon;
|
|
|
|
|
map<string, expr_t> discount;
|
|
|
|
|
map<string, int> time_shift;
|
|
|
|
|
// For each model, list of generated auxiliary param ids, in variable-major order
|
|
|
|
|
map<string, vector<int>> aux_param_symb_ids;
|
|
|
|
|
// Decomposition of the expression
|
2022-05-16 17:42:24 +02:00
|
|
|
|
map<string, vector<tuple<int, optional<int>, double>>> vars_params_constants;
|
2022-01-20 16:15:43 +01:00
|
|
|
|
public:
|
|
|
|
|
explicit VarExpectationModelTable(SymbolTable &symbol_table_arg);
|
|
|
|
|
void addVarExpectationModel(string name_arg, expr_t expression_arg, string aux_model_name_arg,
|
|
|
|
|
string horizon_arg, expr_t discount_arg, int time_shift_arg);
|
|
|
|
|
bool isExistingVarExpectationModelName(const string &name_arg) const;
|
|
|
|
|
bool empty() const;
|
|
|
|
|
void substituteUnaryOpsInExpression(const lag_equivalence_table_t &nodes, ExprNode::subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs);
|
|
|
|
|
// Called by DynamicModel::substituteDiff()
|
|
|
|
|
void substituteDiffNodesInExpression(const lag_equivalence_table_t &diff_nodes, ExprNode::subst_table_t &diff_subst_table, vector<BinaryOpNode *> &neweqs);
|
|
|
|
|
void transformPass(ExprNode::subst_table_t &diff_subst_table,
|
|
|
|
|
DynamicModel &dynamic_model, const VarModelTable &var_model_table,
|
|
|
|
|
const TrendComponentModelTable &trend_component_model_table);
|
|
|
|
|
void writeOutput(const string &basename, ostream &output) const;
|
|
|
|
|
void writeJsonOutput(ostream &output) const;
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-27 16:26:52 +02:00
|
|
|
|
class PacModelTable
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
SymbolTable &symbol_table;
|
|
|
|
|
set<string> names;
|
|
|
|
|
map<string, string> aux_model_name;
|
|
|
|
|
map<string, string> discount;
|
2021-10-26 18:06:26 +02:00
|
|
|
|
/* The growth expressions belong to the main dynamic_model from the ModFile
|
|
|
|
|
instance. The growth expression is necessarily nullptr for a model with a
|
|
|
|
|
pac_target_info block. */
|
2021-10-27 16:26:52 +02:00
|
|
|
|
map<string, expr_t> growth, original_growth;
|
2021-12-03 15:48:22 +01:00
|
|
|
|
/* Information about the structure of growth expressions (which must be a
|
2022-05-16 17:42:24 +02:00
|
|
|
|
linear combination of variables, possibly with additional constants).
|
2021-12-03 15:48:22 +01:00
|
|
|
|
Each tuple represents a term: (endo_id, lag, param_id, constant) */
|
2022-05-16 17:42:24 +02:00
|
|
|
|
using growth_info_t = vector<tuple<optional<int>, int, optional<int>, double>>;
|
2021-10-26 18:06:26 +02:00
|
|
|
|
map<string, growth_info_t> growth_info;
|
2021-11-18 17:08:08 +01:00
|
|
|
|
// The “auxname” option of pac_model (empty if not passed)
|
|
|
|
|
map<string, string> auxname;
|
|
|
|
|
// The “kind” option of pac_model (“undefined” if not passed)
|
|
|
|
|
map<string, PacTargetKind> kind;
|
2021-10-27 18:17:14 +02:00
|
|
|
|
|
2021-10-28 14:42:56 +02:00
|
|
|
|
/* Stores the name of the PAC equation associated to the model.
|
|
|
|
|
pac_model_name → eq_name */
|
|
|
|
|
map<string, string> eq_name;
|
|
|
|
|
|
2021-11-16 17:58:20 +01:00
|
|
|
|
/* Stores symb_ids for auxiliary endogenous created for the expression
|
|
|
|
|
substituted to the pac_expectation operator:
|
|
|
|
|
- in the backward case, this auxiliary contains exactly the
|
|
|
|
|
pac_expectation value
|
|
|
|
|
- in the MCE case, this auxiliary represents Z₁ (i.e. without the growth
|
|
|
|
|
correction term)
|
2021-10-26 18:06:26 +02:00
|
|
|
|
Note that this structure is not used in the presence of the
|
|
|
|
|
pac_target_info block.
|
2021-11-16 17:58:20 +01:00
|
|
|
|
pac_model_name → symb_id */
|
|
|
|
|
map<string, int> aux_var_symb_ids;
|
2021-11-17 18:12:29 +01:00
|
|
|
|
/* Stores symb_ids for auxiliary parameters created for the expression
|
|
|
|
|
substituted to the pac_expectation operator (excluding the growth
|
|
|
|
|
neutrality correction):
|
|
|
|
|
- in the backward case, contains the “h” parameters
|
|
|
|
|
- in the MCE case, contains the “α” parameters
|
2021-10-26 18:06:26 +02:00
|
|
|
|
Note that this structure is not used in the presence of the
|
|
|
|
|
pac_target_info block.
|
2021-11-17 18:12:29 +01:00
|
|
|
|
pac_model_name → symb_ids */
|
|
|
|
|
map<string, vector<int>> aux_param_symb_ids;
|
2021-10-27 18:17:14 +02:00
|
|
|
|
/* Stores indices for growth neutrality parameters
|
2021-10-26 18:06:26 +02:00
|
|
|
|
pac_model_name → growth_neutrality_param_index.
|
|
|
|
|
This map is not used for PAC models with a pac_target_info block. */
|
2021-10-27 18:17:14 +02:00
|
|
|
|
map<string, int> growth_neutrality_params;
|
|
|
|
|
|
|
|
|
|
// Stores LHS vars (only for backward PAC models)
|
|
|
|
|
map<string, vector<int>> lhs;
|
|
|
|
|
|
|
|
|
|
// Stores auxiliary model type (only for backward PAC models)
|
|
|
|
|
map<string, string> aux_model_type;
|
|
|
|
|
|
|
|
|
|
public:
|
2021-10-28 14:42:56 +02:00
|
|
|
|
/* Stores info about PAC equations
|
|
|
|
|
pac_model_name →
|
2021-10-27 18:17:14 +02:00
|
|
|
|
(lhs, optim_share_index, ar_params_and_vars, ec_params_and_vars, non_optim_vars_params_and_constants, additive_vars_params_and_constants, optim_additive_vars_params_and_constants)
|
|
|
|
|
*/
|
2021-10-28 14:42:56 +02:00
|
|
|
|
using equation_info_t = map<string,
|
2022-05-16 17:42:24 +02:00
|
|
|
|
tuple<pair<int, int>, int, vector<tuple<optional<int>, optional<int>, int>>, pair<int, vector<tuple<int, bool, int>>>, vector<tuple<int, int, optional<int>, double>>, vector<tuple<int, int, optional<int>, double>>, vector<tuple<int, int, optional<int>, double>>>>;
|
2021-10-27 18:17:14 +02:00
|
|
|
|
private:
|
|
|
|
|
equation_info_t equation_info;
|
|
|
|
|
|
2021-10-26 18:06:26 +02:00
|
|
|
|
public:
|
|
|
|
|
/* (component variable/expr, growth, auxname, kind, coeff. in the linear
|
2022-05-16 15:38:29 +02:00
|
|
|
|
combination, growth_param ID (unused if growth is nullptr), vector of h parameters,
|
2021-10-26 18:06:26 +02:00
|
|
|
|
original_growth, growth_info) */
|
|
|
|
|
using target_component_t = tuple<expr_t, expr_t, string, PacTargetKind, expr_t, int, vector<int>, expr_t, growth_info_t>;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// pac_model_name → (target variable/expr, auxname_target_nonstationary, target components)
|
|
|
|
|
map<string, tuple<expr_t, string, vector<target_component_t>>> target_info;
|
|
|
|
|
|
2021-10-28 14:42:56 +02:00
|
|
|
|
int pacEquationMaxLag(const string &name_arg) const;
|
|
|
|
|
|
2021-10-26 18:06:26 +02:00
|
|
|
|
// Return a text representation of a kind (but fails on “unspecified” kind value)
|
|
|
|
|
static string kindToString(PacTargetKind kind);
|
|
|
|
|
|
2021-10-27 16:26:52 +02:00
|
|
|
|
public:
|
|
|
|
|
explicit PacModelTable(SymbolTable &symbol_table_arg);
|
2021-11-18 17:08:08 +01:00
|
|
|
|
void addPacModel(string name_arg, string aux_model_name_arg, string discount_arg, expr_t growth_arg, string auxname_arg, PacTargetKind kind_arg);
|
2021-10-27 16:26:52 +02:00
|
|
|
|
bool isExistingPacModelName(const string &name_arg) const;
|
|
|
|
|
bool empty() const;
|
|
|
|
|
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
2022-01-18 12:40:15 +01:00
|
|
|
|
// Called by DynamicModel::substituteUnaryOps()
|
|
|
|
|
void substituteUnaryOpsInGrowth(const lag_equivalence_table_t &nodes, ExprNode::subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs);
|
2021-10-27 16:26:52 +02:00
|
|
|
|
void findDiffNodesInGrowth(lag_equivalence_table_t &diff_nodes) const;
|
|
|
|
|
// Called by DynamicModel::substituteDiff()
|
|
|
|
|
void substituteDiffNodesInGrowth(const lag_equivalence_table_t &diff_nodes, ExprNode::subst_table_t &diff_subst_table, vector<BinaryOpNode *> &neweqs);
|
2022-01-18 12:40:15 +01:00
|
|
|
|
// Must be called after substituteDiffNodesInGrowth() and substituteUnaryOpsInGrowth()
|
2021-10-26 18:06:26 +02:00
|
|
|
|
void transformPass(const lag_equivalence_table_t &unary_ops_nodes,
|
|
|
|
|
ExprNode::subst_table_t &unary_ops_subst_table,
|
|
|
|
|
const lag_equivalence_table_t &diff_nodes,
|
|
|
|
|
ExprNode::subst_table_t &diff_subst_table,
|
2021-10-27 16:26:52 +02:00
|
|
|
|
DynamicModel &dynamic_model, const VarModelTable &var_model_table,
|
|
|
|
|
const TrendComponentModelTable &trend_component_model_table);
|
|
|
|
|
void writeOutput(const string &basename, ostream &output) const;
|
|
|
|
|
void writeJsonOutput(ostream &output) const;
|
2021-10-26 18:06:26 +02:00
|
|
|
|
void setTargetExpr(const string &name_arg, expr_t target);
|
|
|
|
|
void setTargetAuxnameNonstationary(const string &name_arg, string auxname);
|
|
|
|
|
/* Only the first four elements of the tuple are expected to be set by the
|
|
|
|
|
caller. The other ones will be filled by this class. */
|
|
|
|
|
void addTargetComponent(const string &name_arg, target_component_t component);
|
|
|
|
|
void writeTargetCoefficientsFile(const string &basename) const;
|
2021-10-27 16:26:52 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-08-14 14:23:21 +02:00
|
|
|
|
#endif
|