% sequential run of differential evolution optimizer % for thorough exploration of a test problem % % Here for Rosenbrock's function % Change relevant entries to adapt to your personal applications % % The file ofunc.m must also be changed, % to return the objective function % % VTR "Value To Reach" (stop when ofunc < VTR) VTR = -Inf; % D number of parameters of the objective function D = 2; xbest= [-1.2 1]; % starting point % zeros will remain fixed fixed!!!! fac=1; % initial relative change in the population % fac=1 for more global search % fac=0.001 more for local div=4; % divisor of fac in case of success % div=4 for more local search % div=1 for more global search while 1+fac~=1, format long; xbest fbest=ofunc(xbest) % objective function disp('******************************') fac rad=abs(xbest); % this forces zero variables to be fixed % recovers very slowly from bad scaling % in the box for the initial population % relative to the needed changes, XVmin = xbest-fac*rad; XVmax = xbest+fac*rad; [x,f,nf] = devec2(VTR,D,XVmin,XVmax) if f