— output Julia files as soon as “language=julia” is passed, independently of
the value of the “output” option
— drop the “dynamic” and “first” values of the “output” option, since they
actually do nothing
— obey the “output” option even in the deterministic case
Ref. dynare#1600
This brings those models in line with stochastic models.
However note that transformation is still not exactly the same on stochastic
and deterministic models, because there is no need to take into account the
Jensen inequality on the latter. In deterministic models, there is a one-to-one
mapping between exogenous with lead/lags and auxiliaries, while in stochastic
models, an auxiliary endo may correspond to a more complex nonlinear expression.
– Fix order of items in this structure. Previously, items were ordered
according to the declaration order of parameters. Now, items are order
according to lag order (first lag appears first)
– Gracefully handle the case where there is no autoregressive part
(Closes: #52)
This is necessary to correctly compute those original model leads/lags. In
particular, this is needed for correct interaction with “histval”.
Closes: #47
Since commit 9c9e8f816f, it’s the information
from the original model which was in this field, which is not what is expected.
By the way, do not output this field (and the related M_.hessian_eq_zero) when
the Hessian is not computed by the preprocessor (i.e. in practice for perfect
foresight), since they would otherwise contain incorrect information.
Ref. dynare#1681
Because MATLAB under Windows maintains a lock on the “+<basename>” subdirectory,
we use a workaround consisting in first renaming the directory, then deleting
it.
But this is not enough when the “ramsey_policy” command is used, because the
latter creates a “+objective” subfolder inside “+<basename>”, on which MATLAB
also maintains a lock.
The fix consists in recursively using the same workaround as for the top-level
directory: renaming before deleting.
Auxiliary equations appearing in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m need to appear in recursive ordering, since
those files are used for sequential evaluation.
Previously, the recursive ordering was guaranteed by a set of ad hoc rules and
workarounds, but that would not cover certain edge cases.
With this commit, the recursive ordering is systematically computed, using a
topological sort on the directed acyclic graph whose vertices are auxiliary
equations and whose edges are dependency relationships.
Closes: #22
Allows for the inclusion/exclusion of a set of equations, specified either on the command line or in a text file.
If the equation has a single endogenous variable on the LHS, then the equation is moved. If not, if the equation has an `endogenous` tag then that variable is removed along with this equation. If not, then an error is thrown.
As a command line argument, `exclude_eqs` can take the form (same syntax for `include_eqs`):
* `exclude_eqs=eq1 to remove all equations declared as `[name=eq1]`
* `exclude_eqs=[eq 1, eq 2]` to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`
* `exclude_eqs=[tagname=X]` to remove all equations declared as `[tagname=X]`
* `exclude_eqs=[tagname=(X, Y)]` to remove all equations declared as `[tagname=X]` or `[tagname=Y]`
When declared in a file, the file should be of the form:
```
eq 1
eq 2
```
to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`.
It should be of the form:
```
tagname=
X
Y
```
to remove all equations declared as `[tagname=X]` or `[tagname=Y]`.
This is made possible by the getLagEquivalenceClass() method introduced in the
previous commit.
Previously, the static version of the LHS expressions was used.
As a consequence, drop ModFile::diff_static_model, now useless.
Previously, for testing whether two diff() expressions or two unary ops were
the lead/lag of each other, the preprocessor would test whether they have the
same static representation. This is ok for simple expressions (e.g.
diff(x(-1))), but not for more complex ones (e.g. diff(x-y) and diff(x(-1)-y)
should not be given the same auxiliary variable).
This commit fixes this by properly constructing the equivalence relationship
and choosing a representative within each equivalence class. See the comments
above lag_equivalence_table_t in ExprNode.hh for more details.
Closes#27
Since commit 64f55e4a5e, in the presence of PAC
model-consistent expectations, some endogenous variables are added to the
symbol table at the beginning of ModFile::transformPass(), while their defining
equations are added at a later point.
But commit 7c3f981eac has introduced a check that
verifies that all endogenous are used in equations. That check happens after
the above mentioned endogenous are created, but after their defining equations
are added. Hence it fails.
The fix consists in creating those endogenous after the check. Incidently, they
are no longer part of the saved original model, but this is a good thing.