Commit Graph

100 Commits (46709ada3f5d73ef1f38642da014057a9a54f9aa)

Author SHA1 Message Date
Houtan Bastani 46709ada3f output AR matrix in file for trend component models 2018-09-10 14:51:33 +02:00
Houtan Bastani f5e5dea1be support hard-coded parameters and parameter expressions in AR matrix 2018-09-07 10:14:18 +02:00
Houtan Bastani acc197f539 output AR matrix in file 2018-09-06 18:00:05 +02:00
Sébastien Villemot e19a14869e Convert ExprNodeOutputType into a class enum
Incidentally, replace the IS_* macros by inline functions.
2018-09-05 18:28:32 +02:00
Houtan Bastani 8584323563 provide information on order of ec.vars 2018-09-04 10:39:05 +02:00
Houtan Bastani 27c9a9a5e0 store LHS of trend equation in trend_vars 2018-09-03 17:25:42 +02:00
Houtan Bastani 7a438a3ce7 ensure that trend_variable found is actually a trend variable as declared in the trend_component_model statement 2018-09-03 15:05:30 +02:00
Houtan Bastani fde836d7fe trend_component_model: find trend_vars associated with equation 2018-08-31 14:24:44 +02:00
Houtan Bastani 948e8cb6e4 fix bug in creation of ec vars for pac equation 2018-08-28 16:00:25 +02:00
Houtan Bastani d5d6e8beb0 simplify updating of RHS variables for trend component and var models 2018-08-23 13:57:27 +02:00
Houtan Bastani 16f10d954f don’t rely on scope: clean up iterator names 2018-08-23 13:03:52 +02:00
Houtan Bastani 0af91c26f8 aesthetic fix 2018-08-22 15:12:17 +02:00
Houtan Bastani 539fddc9f6 introduce var model table 2018-08-22 12:15:02 +02:00
Houtan Bastani afe0e475b1 trend_component_model statement 2018-08-17 16:52:48 +02:00
Houtan Bastani d3bd6ace90 pac: print optimizing share parameter 2018-08-13 17:00:47 +02:00
Houtan Bastani edc242d471 preprocessor: find optimizing shares of agents in PAC equation 2018-08-13 14:34:57 +02:00
Houtan Bastani c5c61f99ba fix bug with max_lag reported for PAC equation 2018-08-13 12:12:20 +02:00
Houtan Bastani 0dffee4650 fix typo 2018-08-13 11:08:58 +02:00
Sébastien Villemot f3c2a1bf87 New var_expectation_model statement and re-design of var_expectation operator
Given a previously declared var_model, the var_expectation_model statement is
used to declare a way of forming expectations with this VAR (possibly using a
finite or infinite discounted sum). The var_expectation operator now takes a
single argument, the name of the var_expectation_model.

For the moment, this only works when the var_model is using equations
explicitly declared in the model block.
2018-08-02 08:39:09 +02:00
Sébastien Villemot 45cd8e6853 Fix regression in nested diffs introduced in 90d8b579
See McModelTeam/McModelProject/issues/97.
2018-07-30 12:53:23 +02:00
Sébastien Villemot b9ee0bb204 aux_equations may diverge from those in the main model
aux_equations only contain the definition of auxiliary variables, and
may diverge from those in the main model (equations), if other model
transformations applied subsequently. This is not a problem, since
aux_equations is only used for regenerating the values of auxiliaries
given the others.

For example, such a divergence appears when there is an expectation
operator in a ramsey model, see
tests/optimal_policy/nk_ramsey_expectation.mod */
2018-07-27 14:20:36 +02:00
Sébastien Villemot 762f25abe9 Remove useless separate list for diff auxiliary variables
This table serves no useful purpose. It is better to append auxiliary equations
at the time they are created, to avoid messing with the recursive ordering.
2018-07-26 17:41:58 +02:00
Sébastien Villemot 90d8b579cc Fix incorrect recursive ordering of aux vars with diff not used at current period
Ensure that all diff operators appear once with their argument at current
period (i.e. maxLag=0).
If it is not the case, generate the corresponding expressions.

This is necessary to avoid lags of more than one in the auxiliary
equation, which would then be modified by subsequent transformations
(removing lags > 1), which in turn would break the recursive ordering
of auxiliary equations.

See McModelTeam/McModelProject/issues/95 for an example.
2018-07-26 17:41:58 +02:00
Sébastien Villemot 4ad0e500d4 C++11: convert {Unary,Binary,Trinary}Opcode to class enums 2018-07-18 16:18:26 +02:00
Sébastien Villemot d6055c1407 C++11: convert SymbolType to a class enum 2018-07-17 18:55:26 +02:00
Sébastien Villemot c12088f314 C++11: convert AuxVarType to class enum 2018-07-17 17:38:26 +02:00
Sébastien Villemot 946d105c04 Remove C and C++ preprocessor output types
This code is broken since the temporary terms array changes. It is probably not
worth maintaining it.
2018-07-17 16:52:11 +02:00
Sébastien Villemot b8a5dfdc39 Replace several usages of C macroprocessor with C++ constructs 2018-07-17 16:36:58 +02:00
Houtan Bastani 15f5f4f1be use front inserter instead of back inserter for unary/diff auxiliary equations
(cherry picked from commit 6a95831147d942c23fbc3a0a0b1506650eb49b7d)
2018-07-10 12:06:42 +02:00
Sébastien Villemot 988a9f6e2d std::open and std::fstream constructor accept a std::string for filename in C++11 2018-06-27 15:30:45 +02:00
Sébastien Villemot b91ed6f78c Move the location of static and dynamic files on the filesystem
- M and MEX files are now under +${MODELNAME}/
- bytecode and C source now under ${MODELNAME}/model/
2018-06-27 15:30:25 +02:00
Houtan Bastani b8ae9f6935 Fix max lags for var 2018-06-11 15:18:06 +02:00
Houtan Bastani 84c2dc5f36 transform_unary_ops now introduces aux variables/equations for all unary ops specified by UnaryOpNode::createAuxVarForUnaryOpNode()
In the absence of this option, if a var_model statement(s) is present, then aux vars/eqs are created for the same types of unary operators but only for equations specified in the var_model statement

In the absence of both this option and var_model statements, no unary op auxiliary variables are created

diffs continue to be substituted everywhere; for the moment auxiliary variables are created for diffs of expressions. A forthcoming change will allow auxiliary variables created for diffs of expressions to be linked with their lagged expressions as is currently the case for diffs of variables
2018-06-07 17:16:12 +02:00
Houtan Bastani a30f8f365e Only create auxiliary variables for diffs that appear in VAR equations or equations that have pac_expectations in them
Otherwise, substitute the diff (i.e. `diff(x)` -> `x-x(-1)`)
2018-06-05 18:39:13 +02:00
Houtan Bastani 2cd3aa95cc When `transform_unary_ops` is passed, only substitute unary operators that appear in VAR equations 2018-06-05 17:41:15 +02:00
Sébastien Villemot 130004ef47 Simplify types for storing derivatives using std::tuple 2018-06-05 15:34:34 +02:00
Sébastien Villemot 7e16307382 Simplify DataTree maps using std::tuple 2018-06-04 17:35:02 +02:00
Sébastien Villemot 608c43450c Replace most calls to make_pair by braced-initializer lists or emplace()/emplace_back() 2018-06-04 16:36:46 +02:00
Sébastien Villemot 7d9cd718fc Replace more typedefs by using
Those were not automatically replaced by clang-tidy, I don’t know why…
2018-06-04 15:03:31 +02:00
Sébastien Villemot 182c53273e Remove useless spaces in type qualifiers
In C++11, it is no longer necessary to put a space between two consecutive ">".
2018-06-04 15:03:31 +02:00
Sébastien Villemot 1e56c73377 Port to C++11 nullptr keyword
Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot e73ebc7033 Port to C++11 noexcept keyword
Performed using modernize-use-noexcept from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot 33b1359905 Port to C++11 emplace_back() method on containers
Performed using modernize-use-emplace from clang-tidy.

Manual intervention was needed to transform a NULL into nullptr in SymbolTable.cc.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot c0ed97d247 Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2018-06-04 15:03:26 +02:00
Sébastien Villemot 6cf4e6dc0c Port to C++11 range-based for loops
Performed using modernize-loop-convert from clang-tidy.

Manual intervention was needed in MacroValue.cc because of a variable name
capture issue.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2018-06-04 12:26:16 +02:00
Sébastien Villemot 28582c4a4b Merge branch 'temporary_terms_array' 2018-06-04 11:40:49 +02:00
Houtan Bastani f338e87692 Revert "remove unnecessary code for calculation of max lag when equation have been undiffed"
This reverts commit d7c979a4e6.
2018-06-02 12:17:05 +02:00
Houtan Bastani d7c979a4e6 remove unnecessary code for calculation of max lag when equation have been undiffed 2018-06-01 15:52:40 +02:00
Houtan Bastani 1b952a12e6 fix bug in var max lag and simplify code 2018-05-31 15:36:03 +02:00
Sébastien Villemot 59e427cf66 Merge branch 'master' into temporary_terms_array 2018-05-30 17:20:48 +02:00