If the guess value passed to dynare_solve was such that the residuals were all
below tolerance, except some that were NaN, then this guess value would be
incorrectly accepted as a solution.
Use the new time-recursive block decomposition computed by the preprocessor
for:
- the simulation of backward models with “simul_backward”
- the perfect foresight simulation of purely backward/forward/static models
Also note that in this case, the preprocessor now defaults to “mfs=3” (i.e. it
minimizes the set of feedback variables and tries to renormalize equations).
This replaces the previous algorithm based on Dulmage-Mendelsohn (dmperm), plus
an ad hoc identification of some equations that can be evaluated (those with a
LHS equal to a variable, the log of a variable, or the diff-log of a variable).
By the way, the block_trust_region MEX has been modified so that it accepts a
boolean argument to decide whether it performs a Dulmage-Mendelsohn
decomposition (if not, then it performs a simple trust region on the whole
nonlinear system).
This provides a significant performance improvement (of almost an order of
magnitude for solve_algo=14 on a 700 equations model).
The feval(f, x, args{:}) call would fail under Octave because the contents of
args{:} would be appended twice (hence too many input arguments error).
The same bug would materialize under MATLAB for errorcode>1.
- block trust region solver now available under solve_algo=13
It is essentially the same as solve_algo=4, except that Jacobian by finite
difference is not handled. A test file is added for that case
- block trust region solver with shortcut for equations that can be evaluated
is now available under solve_algo=14 (in replacement of the pure-MATLAB solver)
Closes: Enterprise/dynare#3
Removed threshold for detecting the non zero elements in the rows of
the Jacobian matrix. Using tolf as a threshold parameter for identifying
the non zero elements leaded (not systematically) the algorithm to not
reevaluate the residuals of the dynamic model while necessary.
- Even in models where there is only one endogenous variable in the
LHS and where all the LHS are unique, it may be that because of the
preprocessor transformations an auxiliary variable appears in more
than one LHS. If diff(X) is on the LHS of an equation in the original
model, the preprocessor will create an auxiliary variable AUX_DIFF
which will appear in the the original equation, replacing diff(X),
and in a new equation defining the auxiliary variable. In this case
the, the Dulmage-Mendelsohn decomposition will associate AUX_DIFF
with the original equation and X with the equation. This was
problematic in the previous version of the algorithm, since it was
assumed that each equation determines the LHS variable (here AUX_DIFF
= X - X(-1) determines a RHS variable (X).
- Changed the expression for evaluating an LHS variable under a log.
- Improved efficiency by not evaluating the residuals of the model if
not required for solving the current univariate block.
These algorithms are alternative versions of 2 and 4 specialized for
models where each equation has only one endogenous variable on the
left hand side (only allowed expression on LHS is the log of an
endogenous variable). Univariate recursive blocks are then not solved
with a non linear but by evaluating the RHS expression.
In pathological cases, the Jacobian at the initial but true steady state value is ill-behaved. In this case we should return with the valid steady state instead of trying random starting values