%%% Designed and Developed by Pavel Trojovský and Mohammad Dehghani %%% function[Best_score,Best_pos,EBOA_curve]=EBOA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness) lowerbound=ones(1,dimension).*(lowerbound); % Lower limit for variables upperbound=ones(1,dimension).*(upperbound); % Upper limit for variables %% INITIALIZATION for i=1:dimension X(:,i) = lowerbound(i)+rand(SearchAgents,1).*(upperbound(i) - lowerbound(i)); % Initial population end for i =1:SearchAgents L=X(i,:); fit(i)=fitness(L); end %% for t=1:Max_iterations %% update the best condidate solution [Fbest , Blocation]=min(fit); if t==1 Xbest=X(Blocation,:); % Optimal location fbest=Fbest; % The optimization objective function elseif Fbest 0.5*(1+rand) total_V(1)=total_V(1)+1; else k=randperm(N_C-1,1); total_V(k+1)=total_V(k+1)+1; end end % Counting the votes and appointing the elected leader [a,b]=max(total_V); row_no_LEADER=b; LEADER= X(b,:); F_LEADER=fit(b); for i=1:SearchAgents % create new location for X_i using EQ(6) I=round(1+rand(1,1)); if rand>0.5 RAND=rand(1,dimension); else RAND=rand; end if fit(i)> F_LEADER X_new_P1(i,:)=X(i,:)+RAND .* (LEADER-I.*X(i,:)); % Eq. (6) else X_new_P1(i,:)=X(i,:)+RAND .* (X(i,:)-LEADER); % Eq. (6) end X_new_P1(i,:) = max(X_new_P1(i,:),lowerbound);X_new_P1(i,:) = min(X_new_P1(i,:),upperbound); % update position based on Eq (7) L=X_new_P1(i,:); fit_new_P1(i)=fitness(L); if(fit_new_P1(i)0.5 RAND=rand(1,dimension); else RAND=rand; end R=0.02*(1-t/Max_iterations); X_new_P2(i,:)= X(i,:)+(-1+2*RAND).*R.*X(i,:);J=randperm(dimension,1);X_new_P2(i,J)=X(i,J)+(lowerbound(J)+rand*(upperbound(J)-lowerbound(J)))./t; X_new_P2(i,:) = max(X_new_P2(i,:),lowerbound);X_new_P2(i,:) = min(X_new_P2(i,:),upperbound); % update position based on Eq (9) L=X_new_P2(i,:); fit_new_P2(i)=fitness(L); if(fit_new_P2(i)