%%% Designed and Developed by Dr. Gaurav Dhiman (http://dhimangaurav.com/) %%%
function[Score,Position,Convergence]=SOA(Search_Agents,Max_iterations,Lower_bound,Upper_bound,dimension,objective)
Position=zeros(1,dimension);
Score=inf;
Positions=init(Search_Agents,dimension,Upper_bound,Lower_bound);
Convergence=zeros(1,Max_iterations);
l=0;
while l<Max_iterations
for i=1:size(Positions,1)
Flag4Upper_bound=Positions(i,:)>Upper_bound;
Flag4Lower_bound=Positions(i,:)<Lower_bound;
Positions(i,:)=(Positions(i,:).*(~(Flag4Upper_bound+Flag4Lower_bound)))+Upper_bound.*Flag4Upper_bound+Lower_bound.*Flag4Lower_bound;
fitness=objective(Positions(i,:));
if fitness<Score
Score=fitness;
Position=Positions(i,:);
end
end
Fc=2-l*((2)/Max_iterations);
for i=1:size(Positions,1)
for j=1:size(Positions,2)
r1=rand();
r2=rand();
A1=2*Fc*r1-Fc;
C1=2*r2;
b=1;
ll=(Fc-1)*rand()+1;
D_alphs=Fc*Positions(i,j)+A1*((Position(j)-Positions(i,j)));
X1=D_alphs*exp(b.*ll).*cos(ll.*2*pi)+Position(j);
Positions(i,j)=X1;
end
end
l=l+1;
Convergence(l)=Score;
end
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.