Hate_Speech_IMAYFLY_and_HOR.../init_pop_data.m

16 lines
468 B
Mathematica
Raw Normal View History

2022-07-14 07:27:48 +00:00
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