需要帮助理解 Apache Commons Math BracketFinder

发布于 2024-12-13 16:22:07 字数 605 浏览 2 评论 0原文

我首先要说的是,这感觉应该很容易……但对我来说并不完全明显。我正在尝试使用 BrentOptimizer 来查找函数的局部最小值和最大值。我知道这些的周期性,我觉得我应该能够使用 BracketFinder 将最优值括起来,然后将其发送到 BrentOptimizer。

她是文档: http: //commons.apache.org/math/api-2.2/org/apache/commons/math/optimization/univariate/BracketFinder.html

因此,对于一个简单的情况,请考虑:

f(x) = sin(x)

我们知道最大值位于 Pi/2 处,最小值位于 3Pi/2 处。如果我从零开始并沿着函数移动,我将如何寻找 Pi/2 处的根?它实际上取决于构造函数参数和初始点。是否有任何最佳实践(假设您对函数的形状有所了解)可以用来以合理的方式设置这些参数?

谢谢

I will start off by saying that this feels like it should be easy... but it's not entirely obvious to me. I am trying to use the BrentOptimizer to find local minima and maxima of a function. I have an idea of the periodicity of these, and I feel like I should be able to use the BracketFinder to bracket the optimums and then send that off to the BrentOptimizer.

Her is the documentation: http://commons.apache.org/math/api-2.2/org/apache/commons/math/optimization/univariate/BracketFinder.html

So for a simple case, consider:

f(x) = sin(x)

We know that there is a max at Pi/2 and a min at 3Pi/2. If I were starting at zero and moving along the function, how would I go looking for that root at Pi/2? It really comes down to the constructor arguments and the initial points. Are there any best practices (assuming you know a little bit about the shape of your function) that I can use to set these parameters in a reasonable way?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一抹微笑 2024-12-20 16:22:07

您现在可能已经解决了这个问题,但是括号方法根本不需要任何初始点,BracketFinder 的目的是找到一个开始猜测,您应该在调用 BrentOptimizer。在 BracketFinder 中应用默认构造函数应该没问题。

收到包围点后,使用三点 optimize 抽象基类中定义的方法 BaseAbstractUnivariateOptimizer,其中 minmaxstartValue 取自 BracketFinder:s getLo()getHi() 和 getMid()

BracketFinder 实现显然是基于 数值食谱,本书 C 版本中的第 10.1 章。这可以为您提供有关所使用的包围原则的更多背景知识。

You have probably sorted this out by now, but the bracketing method does not expect any initial points at all, the intention with BracketFinder is to find a starting guess that you should apply in your call to the BrentOptimizer. It should be OK to apply the default constructor in BracketFinder.

After having received bracketing points, use the three-point optimize method defined in the abstract base class BaseAbstractUnivariateOptimizer, where min, max, startValue are taken from the BracketFinder:s getLo(), getHi() and getMid(), respectively.

The BracketFinder implementation is obviously based on the one found in Numerical Recipes, chapter 10.1 in the C version of the book. This could give you some more background on the bracketing principles used.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文