The simulated annealing is a metaheuristic, a random search algorithm inspired from physics sciences.
In this example, we will doing a simple thing : adjusting one coefficent for having a better results for the algorithm to found the global minimum of the function :
f(X)=0.11(0.5 X² + Cos[Pi X] - 2 Sin[2 Pi X] + Cos[3 Pi X]*Sin[Pi X] in [-5; 5].
// COEF is the Most important value to adjust.
// energy = COEF x myFunction(x)
// Change this value until having a quality results for Simulated Annealing.
COEF = 1; // <- Try with 1, 10, 100, 1000.....
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.