For commands like
HeteroAgentStationaryEqm_Case1_FHorz
you can control which algorithm is being used to solve for general eqm (to minimize the general eqm conditions)
For example
heteroagentoptions.fminalgo=1
is the default, and uses Matlab’s fminsearch()
heteroagentoptions.fminalgo=4
uses CMA-ES which is slow, but very powerful/robust
heteroagentoptions.fminalgo=5
is a shooting-algorithm that requires you to input updating rules, it is fast but requires more work from user
heteroagentoptions.fminalgo=8
uses Matlab’s lsqnonlin(), this is a least-squares residuals algorithm and requires Matlab’s Optimization Toolbox. It is fast, but tends to leave general eqm conditions with values around 1e-4.
There is now also the option of using multiple algorithms. For example maybe you want lsqnonlin() as it is fast, but you know it is not highly accurate so you would also then like to take the answer it gives as the starting point for fminsearch(). That is, you want to do fminalgo=8, and then use the solution as the initial guess for fminalgo=1. There is now a built-in way to do this, namely you set
heteroagentoptions.fminalgo=[8,1]
VFI Toolkit notices that heteroagentoptions.fminalgo is a vector and will do the first element, and then use the solution of this as the starting point while using the second element.
You can also set them to have different tolerances in the obvious way: When using heteroagentoptions.fminalgo with two values, you can also set heteroagentoptions.toleranceGEconds and heteroagentoptions.toleranceGEprices as having two values. Will make it easy to use a rough solution on the first, then accurate on the second.
PS. fminalgo=[8,1] or fminalgo=[8,4] are my personal two favourite combos at the moment. They seem to give a good mix of speed, accuracy, and robustness.