Name

optim_sa — A Simulated Annealing optimization method

Calling Sequence

[x_best,f_best,mean_list,var_list,f_history,temp_list,x_history] = optim_sa(x0,f,ItExt,ItInt,T0,Log,temp_law,param_temp_law,neigh_func,param_neigh_func)

Parameters

x0

the initial solution

f

the objective function to be optimized (the prototype if f(x))

ItExt

the number of temperature decrease

ItInt

the number of iterations during one temperature stage

T0

the initial temperature (see compute_initial_temp to compute easily this temperature)

Log

if %T, some information will be displayed during the run of the simulated annealing

temp_law

the temperature decrease law (see temp_law_default for an example of such a function)

param_temp_law

a structure (of any kind - it depends on the temperature law used) which is transmitted as a parameter to temp_law

neigh_func

a function which computes a neighbor of a given point (see neigh_func_default for an example of such a function)

param_neigh_func

a structure (of any kind like vector, list, it depends on the neighborhood function used) which is transmitted as a parameter to neigh_func

x_best

the best solution found so far

f_best

the objective function value corresponding to x_best

mean_list

the mean of the objective function value for each temperature stage. A vector of float (optional)

var_list

the variance of the objective function values for each temperature stage. A vector of float (optional)

f_history

the computed objective function values for each iteration. Each input of the list corresponds to a temperature stage. Each input of the list is a vector of float which gathers all the objective function values computed during the corresponding temperature stage - (optional)

temp_list

the list of temperature computed for each temperature stage. A vector of float (optional)

x_history

the parameter values computed for each iteration. Each input of the list corresponds to a temperature stage. Each input of the list is a vector of input variables which corresponds to all the variables computed during the corresponding temperature stage - (optional - can slow down a lot the execution of optim_sa)

Description

  • A Simulated Annealing optimization method.

Examples

 
function y = rastrigin(x)
  y = x(1)^2+x(2)^2-cos(12*x(1))-cos(18*x(2));
endfunction
    
x0          = [2 2];
Proba_start = 0.7;
It_Pre      = 100;
It_extern   = 100;
It_intern   = 1000;
x_test = neigh_func_default(x0);

comp_t_params = init_param();
comp_t_params = add_param(comp_t_params,'neigh_func', neigh_func_default);

T0 = compute_initial_temp(x0, rastrigin, Proba_start, It_Pre, comp_t_sa);

[x_opt, f_opt, sa_mean_list, sa_var_list] = optim_sa(x0, rastrigin, It_extern, It_intern, T0, Log = %T);

printf('optimal solution:\n'); disp(x_opt);
printf('value of the objective function = %f\n', f_opt);

t = 1:length(sa_mean_list);
plot(t,sa_mean_list,'r',t,sa_var_list,'g');
 

See Also

compute_initial_temp , neigh_func_default , temp_law_default

Authors

collette

Yann COLLETTE (ycollet@freesurf.fr)