我正在使用scipy.optimize.brute进行简单的优化,但是我得到的值超出了范围。我没有使用终结者。
文档在这里:http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brute.html#scipy.optimize.brute
我的代码:
ranges = ((a/100.0, 10*a), (b/100.0, 10*b), (3.0, 50.0), (k/1000, 1000*k), (c0/10.0, 10.0*c0))
print ranges
p1 = optimize.brute(errfunc_sum_sq, ranges, Ns=2, disp=True)
print p1
输出:
((0.001, 1.0), (0.07, 70), (3.0, 50.0), (5.0000000000000004e-08, 0.05), (0.1, 10.0))
Optimization terminated successfully.
Current function value: 33969.362280
Iterations: 426
Function evaluations: 724
[ 0.03307178 0.01554712 0.01630616 0.31982767 0.57099047]
有什么想法吗?