Saving status and restart fminsearch

4 次查看(过去 30 天)
Hi,
so here's the situation. I use fminsearch to optimize a function. The computation of this function is long so each iteration takes a while. (The function itself is pretty simple.) The total optimization process usually takes about 1 month. The problem is that, once in a while, there is a power shortage, or some other stuff that shuts downs my computer !
I'm looking for a way to save the status of fminsearch in order to "restart it where it was". From what I understand, there is no automated way to do this (although it could be added in future releases!). I've looked at the code and, from what I understand, it might be possible to save a few matrices (x, v and fv, if I'm not mistaken) every once in a while. My problem is how to restart fminsearch with specifically those matrices...
any suggestions ?
thanks,
Vincent btw, I'm using Matlab R2013a

采纳的回答

Matt J
Matt J 2014-1-22
编辑:Matt J 2014-1-22
You can use fminsearch's OutputFcn option to save the results of the most recent iteration to disk.
However, I find it highly suspicious that your computation takes a full month. Fminsearch is designed for solving for a small number of variables. It won't give good results if you have more than 6 unknowns or so. Therefore, if it's taking a month to solve, I imagine that either you have huge amount of data or a highly sub-optimal implementation of your objective function. If your data size is huge, I question whether you need that much data to solve for such a small number of unknowns. Seems to me like you could throw some away in the interest of speeding things up.
  8 个评论
John D'Errico
John D'Errico 2017-3-10
Matt is completely correct here. fminsearch with restarts is not better. However, if you have a problem with many local minima then don't use fminsearch. Here a stochastic solver may be better, as they are explicitly designed to overcome that problem. In terms of convergence, fminsearch will be slow for large numbers of variables. If you are willing to wait a few months for a solution, then sure, use fminsearch on a 25 variable problem.
Walter Roberson
Walter Roberson 2017-3-10
I have created an experimental optimizer that uses fminsearch for part of its work. I find that it is often useful in finding the right major "catch basin", but not so good at resolving the last few bits to find the true local optimum; it tends to dance around it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by