# Nonlinear solvers in Dynare

The aim of this project is 1. to separate nonlinear solvers from the problems that they are supposed to solve 1. to provide Matlab and Mex versions of these solvers 1. write Matlab, Mex and C++ version of the problems solved by nonlinear solvers

## Existing nonlinear solvers

`solve_algo =`

- Matlab or Octave native version of fsolve(). Note that Matlab and Octave versions of fsolve() are different. (Can't be easily ported to C++)
- Newton method with linear search on the entire problem. (As trust region algorithm is superior, not a priority to have a C++ version)
- Newton method with linear search on recursive blocks. (As trust region algorithm is superior, not a priority to have a C++ version)
- Chris Sims csolve() on entire problem. There exist a C version on Chris's web site.
- trust region algorithm on recursive blocks
- Newton algorithm with sparse Gaussian elimination (SPE) (Currently only for bytecode)
- Newton algorithm with sparge LU solver (Currently only for bytecode)
- Newton algorithm with GMRES (Currently only for bytecode)
- Newton algorithm with BICGSTAB (Currently only for bytecode)
- trust region algorithm on entire problem
- mixed complementarity solver

## Missing solvers

- Simple Newton with dampening factor in order to replace sim1()

## Standard problems

steady state (directly solve <fname>_static)

- perfect foresight (perfect_foresight_problem.m)
- stochastic extended path problem

## Provide problems in standard manner

We need Matlab, C and Mex access to <fname>_static and <fname>_dynamic. The format of these functions (Matlab, bytecode or Mex/C) needs to be hidden in a single calling function.

- We need Matlab, C and Mex access to perfect foresight problem and stochastic extended path problem (only Matlab exists currently)
- The C version is needed to interact with C/C++ version of the solvers. Mex is just a wrapper around the C version.

## Provide linear solvers in standard manner

- Several of the algorithms above differ only by the linear solver
- We should instead introduce yet another option to choose the linear solver for all nonlinear solvers, even if such an option is maybe only interesting for the perfect foresight and stochastic extended path problems.

## Exceptions

- At least one algorithm can't be handled that way. It is the perfect foresight Newton solver where the number of periods is tested for in each iteration. We should keep its current separate Matlab implementation.