Adaptive simulation annealing is an algorithm developed by Lester Ingber to find global minimization of a function. For more detailed information about the algorithm and it's usage, please refer to the author's
Author's websiteThe attached script here is a demo for minimizing this simple function with 3 parameters:
f(x)=(x1+1)^2 + (x2-2)^2 + (x3+3)^ + 552
Using ASA code to do this is like killing a fly with a shotgun, but nevertheless the purpose here is to make user familiar with usage of the function.
Following are steps to do minimize the function:
1.Create a project to use ASA as mentioned in
How do I get started with Adaptive Simulated annealing (ASA)? 2.Download file asa_usr_cst.c from the above link and replace the file in current project. This file has implementation of the new function.
3.Modify file asa_opt in current project.
Change this portion of code:
number_parameters=*parameter_dimension 4
Param#:Minimum:Maximum:InitialValue:Integer[1or2]orReal[-1or-2]
0 -10000 10000 999.0 -1
1 -10000 10000 -1007.0 -1
2 -10000 10000 1001.0 -1
3 -10000 10000 -903.0 -1
Replace it with this code:
number_parameters=*parameter_dimension 3
Param#:Minimum:Maximum:InitialValue:Integer[1or2]orReal[-1or-2]
0 -10000 10000 999.0 -1
1 -10000 10000 -1007.0 -1
2 -10000 10000 1001.0 -1
4.Run the program.
5.Read output result in asa_usr_out file
exit code = 1
final cost value = 552
parameter value
0 -0.9998934
1 1.999928
2 -3.000056
As can be seen, result is close correct values of (-1,2,-3)