diff --git a/doc/dynare.texi b/doc/dynare.texi index 33ac4d69f..a9926564a 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -2430,6 +2430,23 @@ Defines the number of steps when performing a homotopy. See @item nocheck Don't check the steady state values when they are provided explicitely either by a steady state file or a @code{steady_state_model} block. This is useful for models with unit roots as, in this case, the steady state is not unique or doesn't exist. + +@item stop_on_error = @var{INTEGER} +Normally, @code{steady} stops on error with a message. However, in +special circumstances, such as chaining homotopy steps, it may be useful +to let it continue to the next step even if the current one was not +successful. @code{stop_on_error} can take two values: +@table @code + +@item 0 +@code{steady} doesn't stop on error + +@item 1 +@code{steady} stops on error +@end table + +@noindent +Default is @code{1} @end table @examplehead diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 192abf40a..f1cb88fb7 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -80,6 +80,7 @@ else end options_.steadystate_partial = []; options_.steadystate.nocheck = 0; +options_.steady.stop_on_error = 1; % subset of the estimated deep parameters options_.ParamSubSet = 'None'; diff --git a/matlab/steady.m b/matlab/steady.m index 22ce5b582..8f3a72fa7 100644 --- a/matlab/steady.m +++ b/matlab/steady.m @@ -55,7 +55,7 @@ end [oo_.steady_state,M_.params,info] = steady_(M_,options_,oo_); -if info(1) +if info(1) && options_.steady.stop_on_error print_info(info,options_.noprint); end diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index f4efacc14..b21dca2f3 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -130,7 +130,7 @@ class ParsingDriver; %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE %token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES %token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL -%token XLS_SHEET XLS_RANGE +%token XLS_SHEET XLS_RANGE STOP_ON_ERROR %left COMMA %left EQUAL_EQUAL EXCLAMATION_EQUAL %left LESS GREATER LESS_EQUAL GREATER_EQUAL @@ -836,6 +836,7 @@ steady_options : o_solve_algo | o_markowitz | o_maxit | o_nocheck + | o_stop_on_error ; check : CHECK ';' @@ -2483,6 +2484,7 @@ o_median : MEDIAN { driver.option_num("ms.median","1"); } o_regimes : REGIMES { driver.option_num("ms.regimes","1"); }; o_regime : REGIME EQUAL INT_NUMBER { driver.option_num("ms.regime",$3); }; o_data_obs_nbr : DATA_OBS_NBR EQUAL INT_NUMBER { driver.option_num("ms.forecast_data_obs",$3); }; +o_stop_on_error: STOP_ON_ERROR EQUAL INT_NUMBER { driver.option_num("steady.stop_on_eror",$3); }; range : symbol ':' symbol { diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index c4bee0499..6a21053c2 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -451,6 +451,7 @@ string eofbuff; deflator {return token::DEFLATOR;} growth_factor {return token::GROWTH_FACTOR;} cova_compute {return token::COVA_COMPUTE;} +stop_on_error {return token::STOP_ON_ERROR;} [\$][^$]*[\$] { strtok(yytext+1, "$");