Hate_Speech_IMAYFLY_and_HOR.../init_pop_data.m
2022-07-14 12:57:48 +05:30

16 lines
468 B
Matlab

function Positions=init_pop_data(SearchAgents_no,dim,upper_lmt,lower_lmt)
Boundary_no= size(upper_lmt,2);
if Boundary_no==1
Positions=rand(SearchAgents_no,dim).*(upper_lmt-lower_lmt)+lower_lmt;
end
if Boundary_no>1
for i=1:dim
ub_i=upper_lmt(i);
lb_i=lower_lmt(i);
v1 = rand(SearchAgents_no,1);
v2 =(ub_i-lb_i)+lb_i;
Values = round(rand(SearchAgents_no,1)*(ub_i-lb_i)+lb_i);
Positions(:,i)= Values;
end
end