2

我在 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

4

1 回答 1

1

When I looked at scipy's anneal a few years ago, my reading of the code was that lower and upper are limits on the random draws which limit the step size.

They are not limits on the parameters itself. This means anneal is not a constraint solver.

See https://github.com/scipy/scipy/issues/1653

Nobody has volunteered so far to clean up and enhance anneal (open source).

于 2013-09-14T01:44:19.657 回答