Commit 7d9072a2 authored by Houtan Bastani's avatar Houtan Bastani

var_expectation: rename var_model_name to aux_model_name

parent a406c185
......@@ -4851,10 +4851,14 @@ GenerateIRFsStatement::writeJsonOutput(ostream &output) const
output << "}";
}
VarExpectationModelStatement::VarExpectationModelStatement(string model_name_arg, string variable_arg, string var_model_name_arg,
string horizon_arg, expr_t discount_arg, const SymbolTable &symbol_table_arg) :
VarExpectationModelStatement::VarExpectationModelStatement(string model_name_arg,
string variable_arg,
string aux_model_name_arg,
string horizon_arg,
expr_t discount_arg,
const SymbolTable &symbol_table_arg) :
model_name{move(model_name_arg)}, variable{move(variable_arg)},
var_model_name{move(var_model_name_arg)}, horizon{move(horizon_arg)},
aux_model_name{move(aux_model_name_arg)}, horizon{move(horizon_arg)},
discount{discount_arg}, symbol_table{symbol_table_arg}
{
}
......@@ -4863,7 +4867,7 @@ void
VarExpectationModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
string mstruct = "M_.var_expectation." + model_name;
output << mstruct << ".auxiliary_model_name = '" << var_model_name << "';" << endl
output << mstruct << ".auxiliary_model_name = '" << aux_model_name << "';" << endl
<< mstruct << ".horizon = " << horizon << ';' << endl
<< mstruct << ".variable = '" << variable << "';" << endl
<< mstruct << ".variable_id = " << symbol_table.getTypeSpecificID(variable)+1 << ";" << endl;
......@@ -4888,7 +4892,7 @@ VarExpectationModelStatement::writeJsonOutput(ostream &output) const
output << "{\"statementName\": \"var_expectation_model\","
<< "\"model_name\": \"" << model_name << "\", "
<< "\"variable\": \"" << variable << "\", "
<< "\"var_model_name\": \"" << var_model_name << "\", "
<< "\"aux_model_name\": \"" << aux_model_name << "\", "
<< "\"horizon\": \"" << horizon << "\", "
<< "\"discount\": \"";
discount->writeOutput(output);
......
......@@ -1182,14 +1182,14 @@ public:
class VarExpectationModelStatement : public Statement
{
public:
const string model_name, variable, var_model_name, horizon;
const string model_name, variable, aux_model_name, horizon;
const expr_t discount;
const SymbolTable &symbol_table;
// List of generated auxiliary param ids, in variable-major order
vector<int> aux_params_ids; // TODO: move this to some new VarModelTable object
public:
VarExpectationModelStatement(string model_name_arg, string variable_arg, string var_model_name_arg,
VarExpectationModelStatement(string model_name_arg, string variable_arg, string aux_model_name_arg,
string horizon_arg, expr_t discount_arg, const SymbolTable &symbol_table_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
......
......@@ -517,20 +517,20 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
int max_lag;
vector<int> lhs;
auto &model_name = vems->model_name;
if (var_model_table.isExistingVarModelName(vems->var_model_name))
if (var_model_table.isExistingVarModelName(vems->aux_model_name))
{
max_lag = var_model_table.getMaxLag(vems->var_model_name);
lhs = var_model_table.getLhs(vems->var_model_name);
max_lag = var_model_table.getMaxLag(vems->aux_model_name);
lhs = var_model_table.getLhs(vems->aux_model_name);
}
else if (trend_component_model_table.isExistingTrendComponentModelName(vems->var_model_name))
else if (trend_component_model_table.isExistingTrendComponentModelName(vems->aux_model_name))
{
max_lag = trend_component_model_table.getMaxLag(vems->var_model_name);
lhs = trend_component_model_table.getLhs(vems->var_model_name);
max_lag = trend_component_model_table.getMaxLag(vems->aux_model_name);
lhs = trend_component_model_table.getLhs(vems->aux_model_name);
}
else
{
cerr << "ERROR: var_expectation_model " << model_name
<< " refers to nonexistent auxiliary model " << vems->var_model_name << endl;
<< " refers to nonexistent auxiliary model " << vems->aux_model_name << endl;
exit(EXIT_FAILURE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment