Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Simulated Annealing in C#
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].
1
98
99
100
101
102
103
// {
// 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.....
Enter to Rename, Shift+Enter to Preview
Suggested playgrounds
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content