Commit Graph

93 Commits (master)

Author SHA1 Message Date
Stéphane Adjemian (Ryûk) 4982ce06b4
Remove unnecessary square brackets. 2023-12-18 10:49:49 +01:00
Sébastien Villemot f6adb1d9ad
Bytecode: safer handling of block= option 2023-11-02 16:51:02 +01:00
Johannes Pfeifer 0561200f1c Implement even more naming consistency
Mostly removes M for M_
2023-10-25 17:29:55 +02:00
Sébastien Villemot 04ea0d0659
Fix comment 2023-10-24 17:36:53 +02:00
Sébastien Villemot e4a4d2d8e6
Bytecode MEX: get M_ and options_ through input arguments rather than as global variables 2023-10-11 18:50:32 -04:00
Johannes Pfeifer dafe3fbdb2 evaluate_steady_state.m: do not require second solver call if debug is requested
All output has already been computed before
2023-09-19 12:52:52 +02:00
Johannes Pfeifer 68ff5c4110 evaluate_steady_state.m: Filter out small complex residuals 2023-09-19 12:52:49 +02:00
Sébastien Villemot 6747f2130e
Perfect foresight: fix illegal memory read with bytecode + endval_steady
The exogenous steady state vector was passed as a row-vector to
evaluate_steady_state, thus leading to an incorrectly-sized matrix passed to
bytecode when checking the steady state on the dynamic model (when different
from the static model).
2023-09-01 14:52:57 +02:00
Sébastien Villemot d5a3a8e16a
Various improvements to perfect foresight homotopy
– new option “endval_steady” to pf_setup command to recompute terminal
  steady state in the homotopy loop

– new options “homotopy_linearization_fallback” and
  “homotopy_marginal_linearization_fallback” to pf_solver and pfwee_solver
  commands, to get an approximate solution when homotopy fails to go to 100%

– new options “homotopy_initial_step_size”, “homotopy_min_step_size”,
  “homotopy_step_size_increase_success_count” and “homotopy_max_completion_share”
  to pf_solver and pfwee_solver commands to fine tune the homotopy behaviour

– removed option “homotopy_alt_starting_point” to pf_solver command, not really
  useful

– new options “steady_solve_algo”, “steady_tolf”, “steady_tolx”,
  “steady_maxit”, “steady_markowitz” to pf_solver and pfwee_solver commands, to
  control the computation of the terminal steady state (and remove the
  equivalent options which previously had different names in pfwee_solver command)
2023-06-21 15:58:23 +02:00
Sébastien Villemot 30c17ad346
🐛 Steady state: wrong value of maxit was used for some block/bytecode cases
It was using the value of maxit for perfect foresight simulations.
2023-06-15 15:37:48 +02:00
Sébastien Villemot c7b4ea40f8
🐛 Steady state computation: fix crash if bytecode (without block) does not find a solution
ys was uninitialized and it would crash further down in the function.
2023-06-15 15:37:48 +02:00
Sébastien Villemot 73ae1ac8ce
evaluate_steady_state: minor simplification 2023-06-12 19:18:44 +02:00
Sébastien Villemot 37870e4a40
evaluate_steady_state: accept exogenous steady state as argument instead of whole oo_ structure
This is a move towards a more functional programming style.
2023-06-07 17:58:19 +02:00
Sébastien Villemot 7722e8e36b
Perfect foresight: inner functions no longer return a modified oo_
They now only return what’s really their output (simulated paths, maximum
residual error…). This is a move towards a more functional programming style.
2023-06-06 18:13:10 +02:00
Sébastien Villemot 0c17d656e1
🐛 Steady state computation could fail with block+bytecode+mfs>0
The Jacobian used for solving a block was not square if there were recursive
variables.
2023-04-20 13:39:26 +02:00
Sébastien Villemot ffe6eb4d40
Preprocessor: overhaul of M_ fields counting Ramsey/discretionary orig endos/eqs
– new fields: M_.ramsey_orig_{eq,endo}_nbr
– drop M_.ramsey_eq_nbr and M_.orig_eq_nbr
– new field: M_.discretionary_orig_eq_nbr
2023-03-29 14:33:01 +02:00
Sébastien Villemot 6bddbca01d
bytecode_steadystate: turn into a local function of evaluate_steady_state 2023-02-17 22:01:25 -05:00
Sébastien Villemot cfaf5a685d
Preprocessor: actually obey the “mfs” option for the static model
As a consequence, fix steady state computation when mfs > 0.
2023-01-17 19:08:32 +01:00
Sébastien Villemot 8aabdaee9c
Consolidate functions for solving steady state with block and/or bytecode 2023-01-17 15:25:47 +01:00
Sébastien Villemot 8f1a4cb363
Drop block-decomposed first-order perturbation solution and kalman filter 2023-01-13 16:57:49 +01:00
Sébastien Villemot 3c55aa57e1
Use sparse representation for evaluating the static model
We also take advantage of the fact that the non-block version is always
available next to the block one, so when we are only interested in the residual
as a whole, we simplify by using the non-block version.
2023-01-10 16:21:44 +01:00
Johannes Pfeifer 3fbab4cbe0 Provisions for solving steady state with MCP-tag 2022-09-12 17:18:16 +02:00
Johannes Pfeifer 77d6782cb4 evaluate_steady_state.m: check whether planner_discount is actually set for ramsey 2022-06-27 11:17:15 +02:00
Sébastien Villemot 0b32ad5b51
Merge branch 'ramsey_steady' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2022
2022-04-29 17:44:28 +02:00
Sébastien Villemot 418a8ebb5f
Drop steady_.m which is only a thin wrapper around evaluate_steady_state
As a consequence, move the sanity checks inside evaluate_steady_state, where
they make more sense.
2022-04-29 15:14:43 +02:00
Johannes Pfeifer 21004adf03 evaluate_steady_state.m: correctly account for presence of auxiliary variables potentially depending on Lagrange multipliers
Otherwise error message due to NaN may be thrown out due to them non having been set. Closes https://git.dynare.org/Dynare/preprocessor/-/issues/94
2022-04-28 21:49:05 +02:00
Stéphane Adjemian (Charybdis) f1aff2b370
Remove calls to dbstack in dynare_solve.
Adding three input parameters for maxit, tolf and tolx.

Closes #1841.
2022-04-10 20:29:57 +02:00
Stéphane Adjemian (Ryûk) ef2bb4e669
Return and use errorcode from dynare_solve.
Note that the interpretation of the error code depends on the nonlinear solver.
2022-04-09 16:06:24 +02:00
Johannes Pfeifer b966e5eb7a evaluate_steady_state.m: do not check auxiliary initial values if they haven't been set 2021-12-19 11:39:24 +01:00
Johannes Pfeifer 741772d514 evaluate_steady_state.m: correctly condition debugging info on existence of objects from steady state file 2021-12-10 09:05:55 +01:00
Sébastien Villemot 91aa1f940f
Forbid the “block” option with “ramsey_model”/“ramsey_policy”
The current implementation needs the Jacobian of the full model, which is not
provided by the block-decomposed routines.

Closes: #1823
2021-11-23 17:40:02 +01:00
Johannes Pfeifer 9a32720ac0 evaluate_steady_state.m: allow debugging of Ramsey equations 2021-11-05 12:22:43 +01:00
Johannes Pfeifer 8e063f0c33 evaluate_steady_state.m: fix missed transition to cell array 2021-10-25 16:44:12 +02:00
Sébastien Villemot 766fff88f6
Use secure URL for link to GNU licenses 2021-06-09 17:35:05 +02:00
Sébastien Villemot 7e9a87c313
evaluate_steady_state.m: small simplification 2020-12-07 16:25:01 +01:00
Sébastien Villemot 1c0d1409ea
Fix the use of [static]/[dynamic] equations with the “block” option 2020-12-07 16:24:13 +01:00
Sébastien Villemot 7e770f69e7
Remove workaround for errors in MEX files
Because at some point throwing exceptions from MEX files (with mexErrMsgTxt())
was not working under Windows 64-bit, we had designed a workaround to avoid
using exceptions.

Most MEX files were returning an error code as their first (or sometimes last)
argument, and that code would have to be checked from the MATLAB code.

Since this workaround is no longer needed, this commit removes it. As a
consequence, the interface of many MEX files is modified.

For some background, see https://www.dynare.org/pipermail/dev/2010-September/000895.html
2020-01-10 18:33:11 +01:00
Sébastien Villemot 89a3e94cbf
Use true/false instead of 1/0 for boolean options
This is more elegant, and makes it easier to distinguish them from integer
options.

Also simplify test expressions for these boolean options.
2019-03-19 15:21:16 +01:00
Johannes Pfeifer c16c2fb894 evaluate_steady_state.m: consistently use params
Prevents erroneously relying on stale parameters from M.params (thanks to Tom Holden); closes #1627
2018-11-14 16:01:55 +01:00
Sébastien Villemot 7a75872f72
Modernization: use tilde (~) syntax for ignored output arguments 2018-11-13 18:02:09 +01:00
Sébastien Villemot 8cb51e26e6
options_.instruments is now a cell array
This fixes crashes under Octave (while MATLAB seems to accept array-indexing
with cell arrays).
2018-10-25 15:01:53 +02:00
Sébastien Villemot 7685a0ccda Octave compatibility fix
Now that the set_auxiliary_variables file is in a "+" directory, Octave fails
at str2func if the file does not exist.
2018-07-13 17:22:27 +02:00
Sébastien Villemot a1b8bd39b2 Move the location of various generated files on the filesystem
- M and MEX files are now under +${MODELNAME}/
- bytecode, C source and JSON now under ${MODELNAME}/model/
2018-06-27 17:03:39 +02:00
Stéphane Adjemian (Scylla) 7be8f10e0e Use cells of strings instead of char arrays. 2018-01-09 22:30:01 +01:00
Houtan Bastani 718ff3d61c preprocessor: only create *set_auxiliary_variables.m file if there will be something in it. Closes #1384 2017-08-29 14:44:52 +02:00
Houtan Bastani bd81ebc55d evaluate_steady_state: simplify check: the only time this variable is used both of these conditions hold 2017-08-29 11:51:45 +02:00
Johannes Pfeifer c063fe1843 Fix two line breaks 2017-06-11 10:58:19 +02:00
Stéphane Adjemian (Charybdis) 5417b27ac7 Fixed indentation of matlab files. 2017-05-16 15:10:20 +02:00
Stéphane Adjemian (Charybdis) a53636e24e Fixed copyright notices. 2017-05-16 14:11:15 +02:00
Stéphane Adjemian (Charybdis) 88e1701289 Removed useless commas and semicolons. 2017-05-16 13:24:46 +02:00