简体   繁体   English

scipy.optimize.basinhopping interval并接受测试合成器

[英]scipy.optimize.basinhopping interval and accept test syntaces

I am trying to find the global minimum of an objective function using basinhopping , but for a majority of the time it is stuck at a local minimum. 我试图找到使用basinhopping的目标函数的全局最小值,但在大多数情况下它被卡在局部最小值。 I read through the document for basinhopping , and found the interval and accept_test might be helpful, but now the question is what values to give them, eg I want my objective function to go as close to 0 as possible (1e-5 close) without spending too much time at very large values like 4 or 5. As for interval how does one know how often a stepsize is being updated? basinhopping阅读了文件中的basinhopping ,并发现intervalaccept_test可能会有所帮助,但现在问题是给它们的值是什么,例如我希望我的目标函数尽可能接近0(1e-5 close)在4或5等非常大的值上花费太多时间。至于interval如何知道更新步长的频率?

Here is how i'm looking for a "global" minimum: 以下是我寻找“全球”最低要求的方式:

np.random.seed(555)   # Seeded to allow replication.
minimizer_kwargs = {"method": "L-BFGS-B", "bounds": bnds,, tol=1e-4}
ret = basinhopping(merit_function, abcdex, minimizer_kwargs=minimizer_kwargs, niter=10)
zoom = ret['x']

res = minimize(merit_function, zoom, method = 'L-BFGS-B', bounds=bnds, tol=1e-9)
print res

If you're stuck in a local minimum then that likely means you need a bigger stepsize. 如果您陷入局部最小值,则可能意味着您需要更大的步长。 You can set the stepsize with the keyword "stepsize". 您可以使用关键字“stepsize”设置stepsize。

An appropriate stepsize depends on the problem, but luckily basinhopping will adjust the stepsize automatically. 适当的步长取决于问题,但幸运的是,购物盆地将自动调整步长。 How often it does this depends on the "interval" keyword. 它的频率取决于“interval”关键字。 Every interval iterations the stepsize will be increased or decreased by a factor of 0.9. 每个间隔迭代步长将增加或减少0.9倍。 If the initial guess for the stepsize is way off this can still take some time. 如果步长的初始猜测是关闭的,这仍然需要一些时间。 If you decrease the interval to 10 (or so) this should be much faster. 如果将间隔减小到10(左右),这应该快得多。

I don't think accept_test will help you here. 我不认为accept_test会帮助你。 That can be used to, for example, enforce forbidden regions of configuration space. 例如,这可以用于强制配置空间的禁止区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 scipy.optimize.basinhopping 不调用 accept_test。 为什么? - scipy.optimize.basinhopping doesn't call accept_test. Why? 了解scipy.optimize.basinhopping的输出 - Understanding the output of scipy.optimize.basinhopping 为什么 scipy.optimize.basinhopping 给出不同的结果 - why scipy.optimize.basinhopping give different results 如何在scipy.optimize.basinhopping中禁用本地最小化过程? - How to disable the local minimization process in scipy.optimize.basinhopping? 使用scipy.optimize.basinhopping时'minimization_failures'的含义? - Meaning of 'minimization_failures' when using scipy.optimize.basinhopping? 使用python scipy.optimize.basinhopping在exp中溢出 - overflow in exp using python scipy.optimize.basinhopping 基于 scipy.optimize.basinhopping 中的 Levenberg-Marquardt 的自定义最小化器 - Custom minimizer based on Levenberg-Marquardt in scipy.optimize.basinhopping 如何访问从 scipy.optimize.basinhopping(不最小化)返回的 OptimizeResult 实例的 `success` 属性? - How to access `success` attribute of OptimizeResult instance returned from scipy.optimize.basinhopping (NOT minimize)? scipy.optimize.basinhopping。 带参数的对象函数 - scipy.optimize.basinhopping. Object function with argument(s) Scipy basinhopping不尊重步骤? - Scipy basinhopping not respecting stepsize?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM