From ce3b7deba86309f1b9a2b3d4a72050df6facaba3 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Fri, 18 Dec 2020 12:59:29 +0000 Subject: [PATCH] Provide better warnings when using ramsey_constraints (cherry picked from commit 7bdf07631a03cfb7865d084bde443cc5c881221a) --- .../perfect_foresight_solver_core.m | 8 ++++++-- matlab/test_for_deep_parameters_calibration.m | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m index d5d414b94e..a95850dc9e 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m +++ b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m @@ -107,8 +107,12 @@ else sim1_lbj(oo_.endo_simul, oo_.exo_simul, oo_.steady_state, M_, options_); case 7 if options_.linear_approximation - if isequal(options_.solve_algo, 10) - warning('It would be more efficient to set option solve_algo equal to 0!') + if isequal(options_.solve_algo, 10) + if options_.ramsey_policy && isfield(M_,'ramsey_model_constraints') && ~isempty(M_.ramsey_model_constraints) + warning('Due to ramsey_constraints you should not specify your model as model(linear)!') + else + warning('It would be more efficient to set option solve_algo equal to 0!') + end end [oo_.endo_simul, oo_.deterministic_simulation] = ... solve_stacked_linear_problem(oo_.endo_simul, oo_.exo_simul, oo_.steady_state, oo_.exo_steady_state, M_, options_); diff --git a/matlab/test_for_deep_parameters_calibration.m b/matlab/test_for_deep_parameters_calibration.m index 722ad65fcd..224db60efe 100644 --- a/matlab/test_for_deep_parameters_calibration.m +++ b/matlab/test_for_deep_parameters_calibration.m @@ -42,7 +42,7 @@ if ~isempty(plist) end tmp = dbstack; message = [message, ' when using ' tmp(2).name '. ']; - message = [message, 'If these parameters are not initialized in a steadystate file or a steady_state_model-block, Dynare may not be able to solve the model...']; + message = [message, 'If these parameters are not initialized in a steadystate file or a steady_state_model-block, Dynare may not be able to solve the model. Note that simul, perfect_foresight_setup, and perfect_foresight_solver do not automatically call the steady state file.']; message_id = 'Dynare:ParameterCalibration:NaNValues'; warning('off','backtrace') warning(message_id,message); -- GitLab