Python Scipy Anneal 寻找超出范围的解决方案

标签 python scipy

我在 Python 中使用 Scipy 进行模拟退火。我使用以下命令为退火设置上限和下限:

optimize.anneal(f, input_vector0, lower = 0, upper = 2*np.pi)

退火算法完全忽略上下参数并搜索该空间之外的方式...有人知道为什么吗?这是它找到的“解决方案”:

31.6237632627 -42.2752494373 39.5493204901 -40.0042611884 43.6152270079 156.037896659 -94.2145500736 34.2889218355 1.38692105848 -55.5107545279 -173.884187212 95.7485871187 -126.122806244 -80.6862568532 -8.24522935611 31.0745563981 -26.1692693183 -15.4530723302 10.8388939531 -0.331091602947 -103.301042697 -47.7445000946 20.9176159149 46.2024960212 -73.3695426792 -120.496928699 -37.7412899302 -98.0482535989 78.034510108 51.6923809382 -142.940610675 84.9461667872 8.08078933482 -36.2926389711

最佳答案

当我几年前查看 scipy 的退火时,我对代码的阅读是 lowerupper 是随机抽取的限制,它限制了步长。

它们不是对参数本身的限制。这意味着退火不是约束求解器。

参见 https://github.com/scipy/scipy/issues/1653

到目前为止,还没有人自愿清理和增强退火(开源)。

关于Python Scipy Anneal 寻找超出范围的解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18795235/

相关文章:

python - MathJax SVG 未验证

python - 如何在 Pandas 中创建数据框 View ?

python - 如何从 "class"HTML 标签中查找文本匹配?

python - Pytorch Argrelmax 函数(或 C++)

python - 将 OptimizeWarning 作为异常捕获

使用具有特定数据的 OLS 代码的 Python 多元线性回归?

python - Scipy LeastSq 误差线

python - 使用 Selenium 抓取 id_str 对象

python - 如何设置带有评估集的学习xgboost?

python - 应用傅立叶变换后 scipy.io 波形文件处理的问题