Remove unused steady_state_growth option to pac_model

pac-components
Sébastien Villemot 2021-09-22 16:26:42 +02:00
parent d1acee0631
commit eb006ecaeb
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
6 changed files with 2 additions and 77 deletions

View File

@ -337,16 +337,12 @@ PacModelStatement::PacModelStatement(string name_arg,
string aux_model_name_arg,
string discount_arg,
expr_t growth_arg,
double steady_state_growth_rate_number_arg,
int steady_state_growth_rate_symb_id_arg,
const SymbolTable &symbol_table_arg) :
name{move(name_arg)},
aux_model_name{move(aux_model_name_arg)},
discount{move(discount_arg)},
growth{growth_arg},
original_growth{growth_arg},
steady_state_growth_rate_number{steady_state_growth_rate_number_arg},
steady_state_growth_rate_symb_id{steady_state_growth_rate_symb_id_arg},
symbol_table{symbol_table_arg}
{
}
@ -388,12 +384,6 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
{
output << "M_.pac." << name << ".auxiliary_model_name = '" << aux_model_name << "';" << endl
<< "M_.pac." << name << ".discount_index = " << symbol_table.getTypeSpecificID(discount) + 1 << ";" << endl;
if (steady_state_growth_rate_symb_id < 0 && steady_state_growth_rate_number > 0)
output << "M_.pac." << name << ".steady_state_growth_rate = "
<< steady_state_growth_rate_number << ";" << endl;
else if (steady_state_growth_rate_symb_id >= 0)
output << "M_.pac." << name << ".steady_state_growth_rate = "
<< symbol_table.getTypeSpecificID(steady_state_growth_rate_symb_id) + 1 << ";" << endl;
if (growth)
{

View File

@ -146,8 +146,6 @@ public:
const string name, aux_model_name, discount;
expr_t growth, original_growth;
private:
const double steady_state_growth_rate_number;
const int steady_state_growth_rate_symb_id;
const SymbolTable &symbol_table;
vector<tuple<int, int, int, double>> growth_info;
public:
@ -155,8 +153,6 @@ public:
string aux_model_name_arg,
string discount_arg,
expr_t growth_arg,
double steady_state_growth_rate_number_arg,
int steady_state_growth_rate_symb_id_arg,
const SymbolTable &symbol_table_arg);
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override;
void overwriteGrowth(expr_t new_growth);

View File

@ -178,7 +178,7 @@ class ParsingDriver;
%token METHOD_OF_MOMENTS MOM_METHOD
%token BARTLETT_KERNEL_LAG WEIGHTING_MATRIX WEIGHTING_MATRIX_SCALING_FACTOR ANALYTIC_STANDARD_ERRORS ANALYTIC_JACOBIAN PENALIZED_ESTIMATOR VERBOSE
%token SIMULATION_MULTIPLE MOM_SEED SEED BOUNDED_SHOCK_SUPPORT ADDITIONAL_OPTIMIZER_STEPS MOM_SE_TOLX SE_TOLX MOM_BURNIN BURNIN
%token EQTAGS STEADY_STATE_GROWTH
%token EQTAGS
%token ANALYTICAL_GIRF IRF_IN_PERCENT EMAS_GIRF EMAS_DROP EMAS_TOLF EMAS_MAX_ITER
%token NO_IDENTIFICATION_STRENGTH NO_IDENTIFICATION_REDUCEDFORM NO_IDENTIFICATION_MOMENTS
%token NO_IDENTIFICATION_MINIMAL NO_IDENTIFICATION_SPECTRUM NORMALIZE_JACOBIANS GRID_NBR
@ -429,7 +429,6 @@ pac_model_options : o_pac_name
| o_pac_aux_model_name
| o_pac_discount
| o_pac_growth
| o_pac_steady_state_growth
;
var_expectation_model : VAR_EXPECTATION_MODEL '(' var_expectation_model_options_list ')' ';'
@ -3411,9 +3410,6 @@ o_pac_name : MODEL_NAME EQUAL symbol { driver.option_str("pac.model_name", $3);
o_pac_aux_model_name : AUXILIARY_MODEL_NAME EQUAL symbol { driver.option_str("pac.aux_model_name", $3); };
o_pac_discount : DISCOUNT EQUAL symbol { driver.option_str("pac.discount", $3); };
o_pac_growth : GROWTH { driver.begin_pac_growth(); } EQUAL hand_side { driver.set_pac_growth($4); };
o_pac_steady_state_growth : STEADY_STATE_GROWTH EQUAL signed_number { driver.set_pac_steady_state_growth($3); }
| STEADY_STATE_GROWTH EQUAL symbol { driver.set_pac_steady_state_growth($3); }
;
o_var_name : MODEL_NAME EQUAL symbol { driver.option_str("var.model_name", $3); };
o_series : SERIES EQUAL symbol { driver.option_str("series", $3); };
o_datafile : DATAFILE EQUAL filename { driver.option_str("datafile", $3); };

View File

@ -934,7 +934,6 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
<DYNARE_BLOCK>var_expectation {return token::VAR_EXPECTATION;}
<DYNARE_BLOCK>pac_expectation {return token::PAC_EXPECTATION;}
<DYNARE_STATEMENT>discount {return token::DISCOUNT;}
<DYNARE_STATEMENT>steady_state_growth {return token::STEADY_STATE_GROWTH;}
<DYNARE_STATEMENT,DYNARE_BLOCK>varobs {return token::VAROBS;}
<DYNARE_STATEMENT,DYNARE_BLOCK>varexobs {return token::VAREXOBS;}
<DYNARE_STATEMENT,DYNARE_BLOCK>nan {return token::NAN_CONSTANT;}

View File

@ -2599,8 +2599,6 @@ ParsingDriver::begin_pac_model()
{
parsing_pac_model = true;
pac_growth = nullptr;
pac_steady_state_growth_rate_number = -1;
pac_steady_state_growth_rate_symb_id = -1;
options_list.clear();
}
@ -2612,43 +2610,10 @@ ParsingDriver::pac_model()
error("You must pass the model_name option to the pac_model statement.");
auto name = it->second;
bool pac_growth_is_param = false;
if (pac_growth && dynamic_cast<VariableNode *>(pac_growth))
{
set<int> params;
pac_growth->collectVariables(SymbolType::parameter, params);
if (params.size() == 1)
pac_growth_is_param = true;
pac_growth->collectVariables(SymbolType::endogenous, params);
pac_growth->collectVariables(SymbolType::exogenous, params);
if (params.size() != 1)
pac_growth_is_param = false;
}
string aux_model_name;
it = options_list.string_options.find("pac.aux_model_name");
if (it != options_list.string_options.end())
{
aux_model_name = it->second;
if (pac_steady_state_growth_rate_number >= 0 || pac_steady_state_growth_rate_symb_id >= 0)
{
pac_steady_state_growth_rate_number = -1;
pac_steady_state_growth_rate_symb_id = -1;
warning("when aux_model_name is used in the pac_model statement, steady_state_growth is ignored");
}
}
else
if (pac_growth_is_param
&& (pac_steady_state_growth_rate_number >= 0 || pac_steady_state_growth_rate_symb_id >= 0))
warning("If growth option is constant, steady_state_growth is ignored");
else if (pac_growth && !pac_growth_is_param
&& pac_steady_state_growth_rate_number < 0
&& pac_steady_state_growth_rate_symb_id < 0)
error("The steady state growth rate of the target must be provided (steady_state_growth option) if option growth is not constant");
if (pac_steady_state_growth_rate_symb_id >= 0
&& mod_file->symbol_table.getType(pac_steady_state_growth_rate_symb_id) != SymbolType::parameter)
error("pac_model: steady_state_growth accepts either a number or a parameter");
aux_model_name = it->second;
it = options_list.string_options.find("pac.discount");
if (it == options_list.string_options.end())
@ -2658,8 +2623,6 @@ ParsingDriver::pac_model()
mod_file->addStatement(make_unique<PacModelStatement>(name, aux_model_name, discount,
pac_growth,
pac_steady_state_growth_rate_number,
pac_steady_state_growth_rate_symb_id,
mod_file->symbol_table));
parsing_pac_model = false;
}
@ -2671,21 +2634,6 @@ ParsingDriver::set_pac_growth(expr_t pac_growth_arg)
reset_data_tree();
}
void
ParsingDriver::set_pac_steady_state_growth(const string &name_or_number)
{
try
{
pac_steady_state_growth_rate_number = stod(name_or_number);
}
catch (...)
{
if (!mod_file->symbol_table.exists(name_or_number))
error("Unknown symbol used in pac_steady_state_growth option: " + name_or_number + "\n");
pac_steady_state_growth_rate_symb_id = mod_file->symbol_table.getID(name_or_number);
}
}
expr_t
ParsingDriver::add_exp(expr_t arg1)
{

View File

@ -257,8 +257,6 @@ private:
//! Temporary storage for growth declared in pac_model
expr_t pac_growth;
double pac_steady_state_growth_rate_number = -1;
int pac_steady_state_growth_rate_symb_id = -1;
bool nostrict;
@ -747,8 +745,6 @@ public:
void pac_model();
//! Adds growth for pac
void set_pac_growth(expr_t pac_growth_arg);
//! Adds steady state growth for pac
void set_pac_steady_state_growth(const string &name_or_number);
//! Writes token "diff(arg1)" to model tree
expr_t add_diff(expr_t arg1);
//! Writes token "adl(arg1, lag)" to model tree