Potential bug in Dynare 6.2 (discretion)

Hello everyone,

I have been playing with a very simple NK model: two equations (NKPC and IS) plus a policy objective that includes interest rate volatility.
If I try to solve the model under discretion Dynare crashes and I get the error:

Unrecognized function or variable 'Selection'.

Error in discretionary_policy_1 (line 125)
dr.ghx=T(:,Selection);

Error in stoch_simul (line 101)
    [oo_.dr,info,M_.params] = discretionary_policy_1(M_,options_,oo_.dr, oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state);

Error in discretionary_policy (line 36)
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list);

Error in NK_omp_R_volatility_forum.driver (line 179)
[info, oo_, options_, M_] = discretionary_policy(M_, options_, oo_, var_list_);

Having looked at the file discretionary_policy_1.m I was able to overcome the problem by artificially adding a state variable (lagged inflation) and then the model solves properly.

NK_omp_R_volatility_forum.mod (866 Bytes)

That is indeed a bug. Thanks for reporting it. A fix is at 馃悰 evaluate_planner_objective.m and discretionary policy: account for purely forward models (!2334) 路 Merge requests 路 Dynare / dynare 路 GitLab

Thank you very much for looking into this.