Fix, clean and speed up discretionary_policy routines
As is discretionary_policy_1.m
has various issues
- At its end, we have
function ys=NondistortionarySteadyState(M_)
if exist([M_.fname,'_steadystate.m'],'file')
eval(['ys=',M_.fname,'_steadystate.m;'])
else
ys=zeros(M_.endo_nbr,1);
end
which seems to miss the case of a steady_state_model
-block. It's also not clear why we have this in any case. At the end of the function, we write ys
based on this input. But throughout the function, like in
[U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params);
we assume the steady state to be 0.
-
The handling of error codes should be nested into the
print_info
-framework as opposed to always issuing errors. -
The function is very verbatim in terms of providing diagnostics. That is useful in standalone code, but a bottleneck when run in a loop like
estimation
where we only want to discard infeasible draws without providing diagnostics. -
The order of some checks is strange. We do computations on the model before checking e.g. whether the number of instruments is valid. We should be able to do this without computing the Jacobian. Also a check like this should only be done once in the context of estimation and does not belong into the core engine. This suggests a different factorization.
Related to #1173 (closed)