Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
See the recommended documentation of this function

Scilab manual >> Simulated Annealing > neigh_func_default


A SA function which computes a neighbor of a given point

Calling Sequence

x_neigh = neigh_func_default(x_current,T)
x_neigh = neigh_func_default(x_current,T,param)



the point for which we want to compute a neighbor


the current temperature. This parameter is ignored but is there to make all the neighbour function consistent.


a two columns vector. The first column correspond to the negative amplitude of variation and the second column corresponds to the positive amplitude of variation of the neighborhood. By default, the first column is a column of -0.1 and the second column is a column of 0.1.


the computed neighbor


This function computes a neighbor of a given point. For example, for a continuous vector, a neighbor will be produced by adding some noise to each component of the vector. For a binary string, a neighbor will be produced by changing one bit from 0 to 1 or from 1 to 0.


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

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

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

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


Yann Collette - 2008 -

Michael Baudin - Digiteo - 2010

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:23:43 CET 2011