I am working in Seeker Optimization Algorithm. But it can occur a error. Can anybody help me to solve this error.

2 views (last 30 days)
clear all; close all; rand('state',sum(100*clock)) % create a random seed % clc
%format long
fname = 'ObjFcn_exal'; % objective function D=3; Size=3*floor(10+2*sqrt(D)); Variablesmax=[1 30 108]; Variablesmin=[0.2 22 100]; initXmax=Variablesmax; initXmin=Variablesmin;
runs=30;
Max_Gens=300;%round(Max_FES/Size); Max_FES=Max_Gens*Size;
numregion=3; for region=1:1:numregion startreg(region)=floor((region-1)*Size/numregion+1); endreg(region)=floor(region*Size/numregion); Sizereg(region)=endreg(region)-startreg(region)+1; end
rmax=0.5*(Variablesmax-Variablesmin); rmin=-rmax;
% clear Xmax Xmin initXmax0 initXmin0;
E=zeros(Size,D); E_Temp = zeros(Size,D); x_offspring=zeros(1,D);
FuncValueCurve=inf*ones(runs,Max_FES);
gbest_curve_res = []; gbest_curve = zeros(Max_FES,D);
Time_curve_res = zeros(runs,Max_FES); Time_curve = zeros(1,Max_FES);
pBestFun=zeros(1,Size); pBestS=zeros(Size,D); % gBestS=zeros(1,D); lBestSreg=zeros(numregion,D); % lBestFunreg=inf*ones(1,numregion);
Sign_x=ones(1,D); %Sign_x0=Sign_x;
mu_max=0.99;mu_min=0.0111; % mu_max=0.95;mu_min=0.1; w_min=0.4;w_max=0.9; %
final_gBestFun = zeros(1,runs); % final_gMinPloss = zeros(1,runs);
final_gBestS = zeros(runs,D);
errorPrev = 0; FailFES = 0;
pop_temp = zeros(1,D);
for run=1:runs, time2=cputime; FES=0; GENs=0; gBestFun=inf; startTime = cputime;
% E=ones(Size,1)*initXmin+(ones(Size,1)*(initXmax-initXmin)).*rand(Size,D); iBest = 1; for s=1:1:Size % if s == 1 % E(s,:) = E0; % else E(s,:) = Variablesmin + rand(1,D).*(Variablesmax - Variablesmin); % end
FES=FES+1;
% calculate fitness
tempval = feval(fname,E(s,:));
F(s)=tempval;
if F(s)<=gBestFun
gBestFun=F(s);
gBestS = E(s,:);
end
FuncValueCurve(run,FES)=gBestFun;
gbest_curve_res(run).gbest_curve(FES,:) = gBestS;
Time_curve(FES)= cputime - startTime;
end
errorPrev = gBestFun;
E_t_1=E; %
E_t_2=E; %
F_t_1=F; %
F_t_2=F; %
pBestFun=F;
pBestS=E;
end

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!