Topic: Simulated annealing (scipy.optimize.anneal)
Am I correct to say that it wouldn't be too difficult to connect scipy's anneal to OO? What is the best way to get involved in doing this?
You are not logged in. Please login or register.
Am I correct to say that it wouldn't be too difficult to connect scipy's anneal to OO? What is the best way to get involved in doing this?
Hi Danie,
I had informed scipy developers for twice if not for thrice, that their anneal() implementation has serious drawbacks.
See for example this post.
Today I had check it once again and I have obtained the same results:
from numpy import asfarray
from scipy.optimize import anneal
x_opt, retval = anneal(lambda x: (x**2).sum(), asfarray([1,-1]))
print x_opt
# and typical output is Tooo far from exact solution (0, 0):
array([ 4.63939483, -12.77243753])
(it is not constant since random numbers are used).
So taking all above into account, I have no willing to have it connected into OO, at least until scipy dev team will have it fixed.
OpenOpt already has several excellent global solvers.
Regards, D.
Hi Dmitrey
Unfortunately the link appears to be broken. I am not all too familiar with the inner workings of the anneal implementation. But I believe the default parameters (dwell, T0) are not adequate. At least, I think that these parameters must be chosen wisely depending on the problem at hand. I get this solution (or equivalent) consistently with T0=0.4 and dwell=5000:
[ -2.63230025e-08 1.37166546e-08]
They are certainly not [0 0], but acceptable. My parameter choice was a quick guess and I'm sure that better/faster parameters exist.
I would therefore guess that the drawbacks of the scipy anneal() is in a way intrinsic to the algorithm and not necessarily to the implementation. I have been able to use the scipy implementation with success, but I must admit that guessing the parameters is somewhat of a process.
I could be seriously in error.
Regards, D
It's not a broken link, it's server scipy.org that is down already for several hours, and this is one of the reasons why OpenOpt had migrated to another host - the scipy.org server crashes too often.
I don't want to discuss scipy programmers approach, but as for me I DO try to care for quality - both OO kernel and solvers connected.
Of course hand-turning parameters can somehow improve solver results, but a good enough solver should yield a good results for all-default settings.
As for the parameters T0=0.4 and dwell=5000, for the puny problem sum(x^2) with 2 variables it takes 5 sec for x_opt = array([ 0.19294977, -0.21508007]) and ~25 sec for x_opt = array([ 1.34310712e-08, -1.06388572e-08]) (I have AMD 3800+ X2). The times are some thousands times greater in comparison with other global solvers connected to OO, and with essential nVars >> 1 it will differ even more.
So connecting anneal is inappropriate for now, it will be just a waste of time both for me and for OO users.
Makes sense.
Thanks
D
Hi,
Does anyone know where I can find the source code for a simulated annealing algorithm? The basic procedures (generate and search) for temperature and cooling ratio would be nice, but of course the code for a labour scheduling/personel rostering problem in a manufacturing environment would be great because this is the problem I'm trying to solve.
I am doing everything in C++ by the way
Thanks!
Does anyone know where I can find the source code for a simulated annealing algorithm
I am doing everything in C++ by the way
google "simulated annealing c++" yields 36000+ entries, I guess you'll get it there.
Currently installed 8 official extensions. Copyright © 2003–2009 PunBB.