Simulated Annealing vs. Basin-hopping algorithm

I was planning to use Simulated Annealing algorithm (scipy.optimize implementation) to optimise my black-box objective function, but the documentation mentions that the method is

Deprecated in scipy 0.14.0, use basinhopping instead

and proposes to use Basin-hopping algorithm instead. Does it mean that this algorithm outperforms Simulated Annealing in all cases? Why is it claimed to be more performant than SA?

• Did you read the discussion here ? Nov 14, 2019 at 15:05
• Thanks @RobertLong. I did not read it but it does not seem to answer the question why the latter algorithm has better performance. Interestingly, as menionted in the discussion, there exists another, more performant version of SA: Dual Annealing Nov 14, 2019 at 16:41
• According to the No Free Lunch theorem, there is no such thing as an algorithm that outperforms any other algorithm "in all cases". It might be better for a a very practical subset of problems, but over the entire universe of problems, Simulated Annealing, Basin Hopping, and even random selection perform equally well. Mar 27, 2020 at 15:42
• def simulated_annealing(...): scipy.optimize.dual_annealing(..., no_local_search=True,...) Sep 28, 2020 at 16:40
• @JamesBowery You should do more than just turn off the local search, at least if you want to recover the Boltzman visiting distribution. That's the point of my answer Oct 31, 2020 at 5:20

The reason for Simulated Annealing to be Deprecated is not because Basin-hopping outperform it theoretically. Is because the specific implementation done for Simulated Annealing in the library is a special case of the second.

If you want to use a Simulated Annealing algorithm I recomend you to use scipy.optimize.dual_annealing instead, but with $$'visit'=q_v=1, \, 'acept'=q_a=1$$ (this recover Classical Simulated Annealing, i.e. the temperature decreases logarithmically). Other parameter election leads to more sophisticated Annealing processes, like $$'visit'=q_v=2, \, 'acept'=q_a=1$$ (which recover the Fast Simulated Annealing, i.e. the temperature decrease up to inverse).

Observation: As @JamesBowery points out in his comment you should turn of the local optimizer.

• The 'visit' parameter for dual_annealing can be (1, 3] via the docs. I tried 1.0 and got a divide-by-zero error. Make sure you're slightly greater than 1, and the default is 2.62 Feb 20, 2023 at 3:39
• @mightypile Yes, you are right. I customary use a modification by github.com/Yarapy/Copula_Cosimulation/blob/main/… where they fix this problem; however I see that modifications of the original library have been made last year. I hope they fixed this problem there too Feb 22, 2023 at 12:54