FMINCON的替代品 [英] Alternatives to FMINCON

查看:237
本文介绍了FMINCON的替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了fmincon之外,还有其他更快,更高效的求解器吗?我正在使用fmincon解决特定问题,并且内存不足,无法使用适度的矢量变量.我也没有任何超级计算机或云计算选项.我知道任何替代解决方案仍然会耗尽内存,但我只是想看看问题出在哪里.

Are there any faster and more efficient solvers other than fmincon? I'm using fmincon for a specific problem and I run out of memory for modest sized vector variable. I don't have any supercomputers or cloud computing options at my disposal, either. I know that any alternate solution will still run out of memory but I'm just trying to see where the problem is.

P.S.我不希望有一种解决方案能够改变我解决实际问题的方式.我知道凸优化是必经之路,而且我已经做了足够的工作直到这里.

P.S. I don't want a solution that would change the way I'm approaching the actual problem. I know convex optimization is the way to go and I have already done enough work to get up until here.

P.P.S我看到了有关开源替代方案的另一个问题.那不是我要找的东西.如果有人遇到同样的问题并转向了更好的解决方案,我正在寻找更高效的解决方案.

P.P.S I saw the other question regarding the open source alternatives. That's not what I'm looking for. I'm looking for more efficient ones, if someone faced the same problem adn shifted to a better solver.

推荐答案

嗯...

没有更多信息,我猜想fmincon用完了内存,因为它需要Hessian(假设您的决策变量为10 ^ 4,则10^4 x numel(f(x1,x2,x3,....))会很大).

Without further information, I'd guess that fmincon runs out of memory because it needs the Hessian (which, given that your decision variable is 10^4, will be 10^4 x numel(f(x1,x2,x3,....)) large).

确定Hessian的值还需要花费大量时间,因为如果您未明确指定导数,则fmincon通常为此使用有限差分.

It also takes a lot of time to determine the values of the Hessian, because fmincon normally uses finite differences for that if you don't specify derivatives explicitly.

您可以执行以下两项操作来加快操作速度.

There's a couple of things you can do to speed things up here.

  • 如果您事先知道黑森州中会有很多零,则可以通过HessPattern传递黑森州矩阵的稀疏模式.这样可以节省大量内存和计算时间.

  • If you know beforehand that there will be a lot of zeros in your Hessian, you can pass sparsity patterns of the Hessian matrix via HessPattern. This saves a lot of memory and computation time.

如果很容易为目标函数的Hessian提出明确的公式,请创建一个计算Hessian的函数,并通过optimset中的HessFcn选项将其传递给fmincon.

If it is fairly easy to come up with explicit formulae for the Hessian of your objective function, create a function that computes the Hessian and pass it on to fmincon via the HessFcn option in optimset.

渐变也一样. GradConstr(用于非线性约束函数)和/或GradObj(用于目标函数)在此处适用.

The same holds for the gradients. The GradConstr (for your non-linear constraint functions) and/or GradObj (for your objective function) apply here.

我在这里可能忘记了一些选择,它们也可以为您提供帮助.只需浏览优化工具箱中的所有选项即可 optimset 看看他们是否可以帮助您.

There's probably a few options I forgot here, that could also help you. Just go through all the options in the optimization toolbox' optimset and see if they could help you.

如果所有这些都无济于事,您实际上必须切换优化器.既然fmincon是MATLAB优化工具箱的骄傲和乐趣,那么确实没有比这更好的了,您必须在其他地方进行搜索.

If all this doesn't help, you'll really have to switch optimizers. Given that fmincon is the pride and joy of MATLAB's optimization toolbox, there really isn't anything much better readily available, and you'll have to search elsewhere.

TOMLAB 是MATLAB的非常好的商业解决方案.如果您不介意使用C或C ++,... SNOPT (这是TOMLAB/SNOPT的基础).在GSL中,您可以尝试很多方法(尽管我还没有看到像SNOPT一样先进的东西……).

TOMLAB is a very good commercial solution for MATLAB. If you don't mind going to C or C++...There's SNOPT (which is what TOMLAB/SNOPT is based on). And there's a bunch of things you could try in the GSL (although I haven't seen anything quite as advanced as SNOPT in there...).

我不知道您使用的是什么版本的MATLAB,但是我知道,在R2009b(可能还有以后)中,fmincon对于某些类型的问题有一些真正的弱点.我非常了解这个 ,因为我曾经输掉了一场非常负盛名的比赛(

I don't know on what version of MATLAB you have, but I know for a fact that in R2009b (and possibly also later), fmincon has a few real weaknesses for certain types of problems. I know this very well, because I once lost a very prestigious competition (the GTOC) because of it. Our approach turned out to be exactly the same as that of the winners, except that they had access to SNOPT which made their few-million variable optimization problem converge in a couple of iterations, whereas fmincon could not be brought to converge at all, whatever we tried (and trust me, WE TRIED). To this day I still don't know exactly why this happens, but I verified it myself when I had access to SNOPT. Once, when I have an infinite amount of time, I'll find this out and report this to the MathWorks. But until then...I lost a bit of trust in fmincon :)

这篇关于FMINCON的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆