From e137b2df62b33731e1cc0cbad052e43eaa5a8836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Tue, 28 Jan 2020 17:38:10 +0100 Subject: [PATCH] =?UTF-8?q?Drop=20unfinished=20interface=20for=20=E2=80=9C?= =?UTF-8?q?det=5Fcond=5Fforecast=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref. #39 --- src/ComputingTasks.cc | 50 ------------------------------------------- src/ComputingTasks.hh | 13 ----------- src/DynareBison.yy | 13 +---------- src/DynareFlex.ll | 1 - src/ParsingDriver.cc | 21 ------------------ src/ParsingDriver.hh | 3 --- 6 files changed, 1 insertion(+), 100 deletions(-) diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index 955d5bbb..c573127b 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -733,56 +733,6 @@ ForecastStatement::writeJsonOutput(ostream &output) const output << "}"; } -DetCondForecast::DetCondForecast(SymbolList symbol_list_arg, - OptionsList options_list_arg, - const bool linear_decomposition_arg) : - options_list{move(options_list_arg)}, - symbol_list{move(symbol_list_arg)}, - linear_decomposition{linear_decomposition_arg} -{ - -} - -void -DetCondForecast::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const -{ - options_list.writeOutput(output); - if (linear_decomposition) - { - output << "first_order_solution_to_compute = 1;" << endl - << "if isfield(oo_, 'dr')" << endl - << " if isfield(oo_.dr, 'ghx') && isfield(oo_.dr, 'ghu') && isfield(oo_.dr, 'state_var') && isfield(oo_.dr, 'order_var')" << endl - << " first_order_solution_to_compute = 0;" << endl - << " end" << endl - << "end" << endl - << "if first_order_solution_to_compute" << endl - << " fprintf('%s','Computing the first order solution ...');" << endl - << " options_.nograph = true;" << endl - << " options_.order = 1;" << endl - << " options_.noprint = true;" << endl - << " options_.nocorr = true;" << endl - << " options_.nomoments = true;" << endl - << " options_.nodecomposition = true;" << endl - << " options_.nofunctions = true;" << endl - << " options_.irf = 0;" << endl - << " tmp_periods = options_.periods;" << endl - << " options_.periods = 0;" << endl - << " var_list_ = char();" << endl - << " info = stoch_simul(var_list_);" << endl - << R"( fprintf('%s\n','done');)" << endl - << " options_.periods = tmp_periods;" << endl - << "end" << endl; - } - vector<string> symbols = symbol_list.get_symbols(); - if (symbols.size() > 0) - output << symbols[1] << " = det_cond_forecast("; - for (unsigned int i = 0; i < symbols.size() - 1; i++) - output << symbols[i] << ", "; - if (symbols.size() > 0) - output << symbols[symbols.size() - 1]; - output << ");" << endl; -} - RamseyModelStatement::RamseyModelStatement(OptionsList options_list_arg) : options_list{move(options_list_arg)} { diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh index 09d2fef8..03d7da29 100644 --- a/src/ComputingTasks.hh +++ b/src/ComputingTasks.hh @@ -95,19 +95,6 @@ public: void writeJsonOutput(ostream &output) const override; }; -class DetCondForecast : public Statement -{ -private: - const OptionsList options_list; - const SymbolList symbol_list; - const bool linear_decomposition; -public: - DetCondForecast(SymbolList symbol_list_arg, - OptionsList options_list_arg, - const bool linear_decompositiontion_arg); - void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override; -}; - class ModelInfoStatement : public Statement { private: diff --git a/src/DynareBison.yy b/src/DynareBison.yy index dc16976c..47106020 100644 --- a/src/DynareBison.yy +++ b/src/DynareBison.yy @@ -80,7 +80,7 @@ class ParsingDriver; %token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION REALTIME VINTAGE %token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR CUTOFF CYCLE_REDUCTION LOGARITHMIC_REDUCTION %token COMMA CONSIDER_ALL_ENDOGENOUS CONSIDER_ONLY_OBSERVED INITIAL_CONDITION_DECOMPOSITION -%token DATAFILE FILE SERIES DET_COND_FORECAST DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION DIFFERENTIATE_FORWARD_VARS +%token DATAFILE FILE SERIES DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION DIFFERENTIATE_FORWARD_VARS %token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH ENDOGENOUS_PRIOR EXPRESSION %token FILENAME DIRNAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME OSR_PARAMS_BOUNDS KEEP_KALMAN_ALGO_IF_SINGULARITY_IS_DETECTED %token <string> FLOAT_NUMBER DATES @@ -310,7 +310,6 @@ statement : parameters | smm_estimation | shock_groups | init2shocks - | det_cond_forecast | var_expectation_model | compilation_setup ; @@ -1436,16 +1435,6 @@ prior_posterior_function_options : o_function | o_sampling_draws ; -det_cond_forecast : DET_COND_FORECAST '(' symbol ')' ';' - { driver.det_cond_forecast_linear_decomposition($3); } - | DET_COND_FORECAST '(' symbol COMMA symbol ')' ';' - { driver.det_cond_forecast_linear_decomposition($3,$5); } - | DET_COND_FORECAST '(' symbol COMMA simul_options_list ')' ';' - { driver.det_cond_forecast_linear_decomposition($3); } - | DET_COND_FORECAST '(' symbol COMMA symbol COMMA simul_options_list ')' ';' - { driver.det_cond_forecast_linear_decomposition($3,$5); } - ; - simul : SIMUL ';' { driver.simul(); } | SIMUL '(' simul_options_list ')' ';' diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll index 7cc2b6cd..7b0d27c7 100644 --- a/src/DynareFlex.ll +++ b/src/DynareFlex.ll @@ -187,7 +187,6 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4]|w([1-9]{1}|[1-4][0-9]|5[0-2])) <INITIAL>smoother2histval {BEGIN DYNARE_STATEMENT; return token::SMOOTHER2HISTVAL;} <INITIAL>perfect_foresight_setup {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_SETUP;} <INITIAL>perfect_foresight_solver {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_SOLVER;} -<INITIAL>det_cond_forecast {BEGIN DYNARE_STATEMENT; return token::DET_COND_FORECAST;} <INITIAL>compilation_setup {BEGIN DYNARE_STATEMENT; return token::COMPILATION_SETUP;} <DYNARE_STATEMENT>; { diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index 98a8192f..c2d17d76 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -2446,27 +2446,6 @@ ParsingDriver::conditional_forecast_paths() det_shocks.clear(); } -void -ParsingDriver::det_cond_forecast_linear_decomposition(const string &plan) -{ - symbol_list.clear(); - symbol_list.addSymbol(plan); - mod_file->addStatement(make_unique<DetCondForecast>(symbol_list, options_list, mod_file->linear_decomposition)); - symbol_list.clear(); - options_list.clear(); -} - -void -ParsingDriver::det_cond_forecast_linear_decomposition(const string &plan, const string &dset) -{ - symbol_list.clear(); - symbol_list.addSymbol(plan); - symbol_list.addSymbol(dset); - mod_file->addStatement(make_unique<DetCondForecast>(symbol_list, options_list, mod_file->linear_decomposition)); - symbol_list.clear(); - options_list.clear(); -} - void ParsingDriver::calib_smoother() { diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh index 32eee6ff..95f5334f 100644 --- a/src/ParsingDriver.hh +++ b/src/ParsingDriver.hh @@ -716,9 +716,6 @@ public: void conditional_forecast_paths(); //! Plot conditional forecast statement void plot_conditional_forecast(const string &periods = ""); - //! Deterministic conditional forecast statement - void det_cond_forecast_linear_decomposition(const string &plan); - void det_cond_forecast_linear_decomposition(const string &plan, const string &dset); //! Smoother on calibrated models void calib_smoother(); //! Extended path -- GitLab