Commit Graph

54 Commits (a87f536799814baef9ae172df689b7e1fb040ab9)

Author SHA1 Message Date
Sébastien Villemot a87f536799
ramsey_policy: implement fully at the preprocessor level
The implementation no longer relies on ramsey_policy.m at the MATLAB/Octave
level.

By the way, drop ModFileStructure::ramsey_model_present, which is now
redundant.
2023-03-29 16:14:59 +02:00
Sébastien Villemot 253fbbe7d6
Use std::filesystem::path in more places 2023-01-05 17:21:28 +01:00
MichelJuillard cf4e2194b7 Julia: remove module for derivatives w.r.t. parameters 2022-11-22 10:18:11 +00:00
Sébastien Villemot 6aca84bfbb
Julia: move all generated files to the <basename>/model/julia/ subdirectory 2022-11-02 15:49:57 +01:00
Sébastien Villemot 93054cf692
Various filesystem refactorings
– DataTree::packageDir() now takes a std::string_view, returns a
  std::filesystem::path, and no longer creates that directory
– DataTree::writeToFileIfModified() now takes a std::filesystem::path as
  argument
– Do not call DataTree::writeToFileIfModified() for generating MATLAB/Octave
  files, since it does not work (the directory inside which the file is written
  has been deleted by the preprocessor just before)
– Consistently use DataTree::packageDir() everywhere (for compatibility with
  planner_objective)
2022-10-11 16:28:17 +02:00
Sébastien Villemot 4c58451d83
Factorize computing pass for block decomposition
Also add “block_decomposed” data member for tracking whether the block
decomposition has been successful.
2022-10-04 16:00:30 +02:00
Sébastien Villemot 1088cc4242
Improve informative messages about derivatives and block decomposition
When computing the derivatives or block decomposition of the planner objective,
the epilogue or the original Ramsey model, the preprocessor would talk about
dynamic/static model, which was confusing. It now uses the right terminology.
2022-09-14 17:51:36 +02:00
Sébastien Villemot d67f569035
Always compute block decomposition, even if “block” option was not passed
If block decomposition fails, error out if “block” option was passed, but not
otherwise.

This commit does not modify the generated files.

This is a preliminary step for dynare#1859.
2022-09-13 16:16:00 +02:00
MichelJuillard 3e1f9dbb82 use @inbounds blocks instead of @inbounds for each line 2022-07-12 13:07:33 +02:00
MichelJuillard a4556896db Julia functions Float64 -> <: Real 2022-07-12 11:15:51 +02:00
Sébastien Villemot c8b046ec86
Simplification using non-default std::ofstream constructor 2022-07-11 22:17:36 +02:00
Sébastien Villemot 3b99ac5df0
Remove unused parameters to various methods 2022-06-24 17:11:38 +02:00
Sébastien Villemot c94dfb848c
C++20 modernization: use initialization within range-based for loop
In particular, use this feature in many loops which feature a special treatment
for the first iteration, using a boolean variable (replacing iterator
manipulation). By the way, also use std::exchange() to simultaneously test the
value of this variable and update it.
2022-06-07 14:35:59 +02:00
Sébastien Villemot 9ace2dc413
C++17 modernization: take advantage of class template argument deduction 2022-06-07 14:35:26 +02:00
Sébastien Villemot 0b5c88109f
Various simplifications 2022-06-07 14:34:30 +02:00
Sébastien Villemot d859f59a10
Epilogue: improve error message 2022-06-03 20:30:40 +02:00
Sébastien Villemot 46cc47266b
Refactor parsing of symbol lists
For symbol lists (such as those given to “var” or “stoch_simul”), return a
semantic value at the Bison level, rather than building the list through a
temporary object in ParsingDriver. This allows various simplifications, and
leads to a more functional code.

By the way, homogeneize the naming of the various flavours of symbol lists in
the Bison file (with TeX names, partitioning, or with a wildcard).
2022-03-29 14:59:34 +02:00
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot 4354d8a578
Julia: do not overwrite steady state / auxiliary variables/series files if contents has not changed
Ref. DynareJulia/Dynare.jl#1
2021-04-23 17:56:54 +02:00
Sébastien Villemot 2781e3e6f6
A few modernizations using clang-tidy 2021-02-10 16:48:46 +01:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +01:00
Sébastien Villemot 82c2682bb2
New “with_epilogue” option of “shock_decomposition”, “realtime_shock_decomposition” and “initial_condition_decomposition”
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Sébastien Villemot ebafd8f3b6
Epilogue: always initialize M_.epilogue_names and M_.epilogue_var_list_
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Houtan Bastani a4ef5a01d3
Epilogue: handle case where `dseries.firstobservedperiod` ends in an error
issue #36
2019-12-18 15:54:50 +01:00
Houtan Bastani 4f20b1146e
Epilogue static file: handle case where RHS is not a dseries
issue #36
2019-12-18 15:50:37 +01:00
Houtan Bastani 87870eaae8
Epilogue: remove +1
issue #36
2019-12-18 15:43:48 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Houtan Bastani c1b8cdf811
epilogue: simplify _static file
issue #36
2019-12-12 16:32:12 +01:00
Sébastien Villemot b58bbb8e84
Ramsey: do not warn if instruments are not defined in steady_state_model block
Closes: dynare#1677
2019-12-12 16:19:15 +01:00
Houtan Bastani 44adcbb488
epilogue: replace `dseries__` with `ds` making the file easier to read 2019-12-12 14:46:45 +01:00
Houtan Bastani dfcd381d20
epilogue: fix bug with external functions in `epilogue` block
issue #36
2019-12-12 14:45:49 +01:00
Houtan Bastani 4111bc8cfc
epilogue: create _dynamic and _static files
#36
2019-12-11 16:17:54 +01:00
Houtan Bastani 34a41b557d
epilogue: output endogs used in epilogue equations
#36
2019-12-11 15:51:26 +01:00
Houtan Bastani 41d38551e5
write names of epilogue variables 2019-12-11 15:51:26 +01:00
Houtan Bastani 3694fc40b3
detrend epilogue equations 2019-12-11 14:45:47 +01:00
Houtan Bastani 12bf59ea28
remove unused line. #29 2019-09-30 14:21:37 +02:00
Sébastien Villemot 0c755460b1
Use std::filesystem instead of boost::filesystem
Note that there is no equivalent of boost::filesystem::unique_path(), so I
implemented ModFile::unique_path() which does something similar.
2019-09-11 14:47:48 +02:00
Sébastien Villemot 0988a1f755
Generated LaTeX files are now under <basename>/latex/ 2019-07-11 17:33:53 +02:00
Sébastien Villemot b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding) 2019-04-16 11:35:31 +02:00
Sébastien Villemot 7d16fff786
Further simplifications 2019-02-21 12:16:22 +01:00
Houtan Bastani 469a328cfc
replace make_pair and make_tuple 2019-02-21 10:42:10 +01:00
Houtan Bastani ea76bc8636
epilogue: use different syntax for firstobservedperiod call 2018-12-19 16:20:30 +01:00
Houtan Bastani bb624ec6a7
epilogue: allow for simulations in epilogue block 2018-12-19 16:09:30 +01:00
Houtan Bastani aad8414f94
allow the use of previously assigned variables in epilogue block in later equations in epilogue block 2018-12-10 16:30:19 +01:00
Houtan Bastani 9d3f104b8c
fix epilogue block 2018-12-10 12:27:27 +01:00
Houtan Bastani 3eff2b91c2
rename ds variable in epilogue to a longer name 2018-11-15 15:04:02 +01:00
Houtan Bastani a8c7fb694b
fix typo 2018-11-15 14:48:31 +01:00
Sébastien Villemot 63a5ffb761 Rename ExprNode::cloneDynamic into ExprNode::clone, for clarity 2018-10-10 13:08:11 +02:00
Sébastien Villemot 24f1276b42 Make all DataTree::*_map private
Introducing a new DataTree::getVariable() const method was necessary in the process.
2018-10-10 13:03:52 +02:00
Sébastien Villemot f2cf86b734 Add copy constructors / assignment operators for the DataTree class hierarchy
In particular, it is necessary to turn back DataTree::AddVariable() into a
non-virtual method, because it is called from DataTree's constructor. Enforcing
the absence of leads/lags is now done using a new boolean DataTree::is_static.

Take advantage of the new copy constructor for handling
PlannerObjectiveStatement more elegantly.

Unfortunately it is not possible to implement *move* constructor / assigment
operators, because the reference ExprNode::datatree is not mutable.
2018-10-10 12:53:55 +02:00