Commit Graph

108 Commits (865ab47fa9d4794ea52bf9596309b92c1b96d029)

Author SHA1 Message Date
Sébastien Villemot 865ab47fa9
Provide block_trust_region MEX under solve_algo 13 and 14
- 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
2020-09-18 18:01:56 +02:00
Sébastien Villemot 0b41d17374
dynare_solve: fix display of number of dmperm blocks 2020-09-18 17:55:58 +02:00
Stéphane Adjemian (Odysseus) 248ad18846 Merge remote-tracking branch 'Dynare/master' into enterprise
Fixed conflicts in:

 - .gitlab-ci.yml
 - matlab/dynare_config.m
 - matlab/dynare_solve.m
 - matlab/initvalf.m
 - matlab/perfect-foresight-models/make_ex_.m
 - matlab/perfect-foresight-models/perfect_foresight_setup.m
 - mex/build/matlab/Makefile.am
 - mex/build/matlab/configure.ac
 - mex/build/octave/Makefile.am
 - mex/build/octave/configure.ac
 - mex/sources/Makefile.am
 - preprocessor
 - tests/Makefile.am
2020-09-17 14:53:32 +02:00
Johannes Pfeifer 607a273bb0 Correctly distinguish tolerance between steady and perfect foresight
steady uses options_.solve_tolf as a termination criterion, so subsequent checks should do the same. Similarly, solve_tolx was never used.
2020-07-06 13:11:23 +02:00
Sébastien Villemot 43ed7b2b69
Merge remote-tracking branch 'community/master' into enterprise 2020-03-27 16:28:41 +01:00
Stéphane Adjemian (Charybdis) b4db697e0f
Cosmetic change. 2020-03-11 12:47:02 +01:00
Stéphane Adjemian (Charybdis) a4519f6b86
Bug fix (solve_algo={12,14}).
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.
2020-03-11 12:38:59 +01:00
Stéphane Adjemian (Charybdis) 67b18710e8
Bug fix and efficiency change.
- 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.
2020-02-27 22:08:21 +01:00
Stéphane Adjemian (Charybdis) fa95a6347d
Added new nonlinear solvers (solve_algo 12 and 14).
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.
2020-02-20 13:07:54 +01:00
Sébastien Villemot 49dc997073
Global reindentation of MATLAB code (excluding submodules)
Also convert to Unix end-of-lines, and remove trailing whitespaces.
2019-12-20 16:30:27 +01:00
Johannes Pfeifer 1b56a56e78 dynare_solve.m: return with valid solution even if Jacobian is ill-behaved
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
2019-12-12 19:08:43 +01:00
Stéphane Adjemian (Scylla) f3600b0de9
Added trap for complex residuals and jacobian in nonlinear solver. 2019-10-01 14:40:17 +02:00
Sébastien Villemot cbb59fe6f8
Merge remote-tracking branch 'community/master' into enterprise 2019-09-26 16:54:27 +02:00
Stéphane Adjemian (Charybdis) 99edfc52ed Removed unused routine. 2019-04-26 15:55:48 +02: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
Stéphane Adjemian (Scylla) 2d717dbd3e Fixed returned fvec and fjac with solve_algo=3. 2017-09-29 10:29:20 +02:00
Stéphane Adjemian (Scylla) 6a2736d498 Fixed returned fvec and fjac with solve_algo=3. 2017-09-29 10:23:58 +02:00
Stéphane Adjemian (Scylla) b429a23852 Added trap for complex residuals and jacobian in nonlinear solver. 2017-09-29 10:19:54 +02:00
Stéphane Adjemian (Charybdis) 57cab69530 Try random initial guess for dynare_solve...
... If for the default initial guess we obtain NaNs or Infs in the residuals
and/or the Jacobian matrix.

(cherry picked from commit d282226100)
2017-06-14 00:01:10 +02:00
Stéphane Adjemian (Charybdis) 7d373f0d7e Merge branch 'master' into ecb-master 2017-06-03 14:51:28 +02:00
Stéphane Adjemian (Charybdis) 99cb731112 Fixed indentation of matlab files. 2017-06-01 19:43:18 +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
Stéphane Adjemian (Charybdis) d282226100 Try random initial guess for dynare_solve...
... If for the default initial guess we obtain NaNs or Infs in the residuals
and/or the Jacobian matrix.
2017-05-10 23:45:07 +02:00
Johannes Pfeifer fdbb44fec6 Account for Octave's dbstack providing full path, not just filename 2016-11-10 17:58:47 +01:00
Johannes Pfeifer 29d1e80eda Decrease verbosity of solve_algo=0
Shuts off display unless debugging is requested. Otherwise, estimation will clutter the screen
2016-10-09 22:15:48 +02:00
Houtan Bastani 919647477e replace isstring with ischar as isstring is not supported in Octave. Bug introduced in 80049a6d09 2016-09-13 17:34:23 +02:00
Johannes Pfeifer 01f1abb19a Provide dedicated maxit option for Ramsey 2016-08-24 13:32:11 +02:00
Johannes Pfeifer b4d958d706 dynare_solve.m: account for second mcp-solver in solution check 2016-08-23 17:28:41 +02:00
Johannes Pfeifer 2751ab08bb Provide interface to original PATH files and document how to obtain them 2016-08-23 17:28:41 +02:00
Johannes Pfeifer 3fc011a1b2 Adjust unit test for stack_solve_algo=7 to actually trigger different algorithms 2016-08-23 17:28:41 +02:00
Johannes Pfeifer 077917b1f4 dynare_solve: use correct termination criterion with stack_solve_algo=7 2016-08-23 17:28:41 +02:00
Johannes Pfeifer e7b8222144 Updated header of dynare_solve.m 2016-08-21 11:47:52 +02:00
Johannes Pfeifer 335ce74acb Remove error-display from dynare_solve.m
Prevents estimation crashing when invalid starting values for steady state computation arise during e.g. mode-finding
2016-08-21 11:44:18 +02:00
Johannes Pfeifer 80049a6d09 dynare_solve.m: make sure str2func is only used on strings
Otherwise, code crashes
2016-08-12 11:59:57 +02:00
Michel Juillard 22f49971bc fixing bug in mcp model setup
makes perfect_foresight_problem more efficient
added test case for stack_solve_algo == 7
2016-07-03 10:56:44 +02:00
Michel Juillard 76f008e4e4 PATH: remove calls to lcppath that doesn't work with perfect foresight models 2016-05-31 12:10:12 +02:00
Michel Juillard ddb9c0657c fixing linear complementarity problem 2016-05-31 12:10:12 +02:00
Michel Juillard 450d7b099a fixing error status for PATH hook 2016-05-31 12:10:12 +02:00
Michel Juillard c159dff19c adding hook for PATH solver 2016-05-31 12:10:12 +02:00
Johannes Pfeifer 465f55bb0e Correct evaluation of residuals in dynare_solve.m when exitflag does not clearly indicate solution
Otherwise, it crashes with bytecode
2016-05-05 10:46:39 +02:00
Johannes Pfeifer 1457666221 Only accept steady state when fsolve retuns with normal return code 1
Otherwise, termination due to tolerance criteria will be accepted as correct steady state
2016-03-22 21:55:51 +01:00
Michel Juillard c3c72192ac small bug corrections 2015-07-27 16:52:36 +02:00
Michel Juillard 2207b51aaa correcting typo 2015-07-27 15:51:48 +02:00
Michel Juillard 9b8077fc28 Merge branch 'master' into new_ep 2015-07-21 09:30:58 +02:00
Stéphane Adjemian (Charybdis) 27922a349c Fixed typo.
The value of jacobian_flag was not passed to fsolve.
2015-07-07 17:55:41 +02:00
Stéphane Adjemian (Hermes) c97aaad62d Fixed bug.
Rename options as options4fsolve, otherwise original options structure is lost.
2015-05-29 15:19:20 +02:00
Michel Juillard d81dda5044 fixing bug in last commit 2015-05-25 18:52:46 +02:00
Michel Juillard 3ef5bc2989 Merge branch 'master' into new_ep 2015-05-25 17:20:23 +02:00