The function is :
function X=space_bound(X,up,low)[N,dim]=size(X);for i=1:N % %%Agents that go out of the search space, are reinitialized randomly .
Tp=X(i,:)>up; Tm=X(i,:)<low; X(i,:)=(X(i,:).*(~(Tp+Tm)))+((rand(1,dim).*(up-low)+low).*(Tp+Tm));% %%Agents that go out of the search space, are returned to the boundaries.
% Tp=X(i,:)>up;Tm=X(i,:)<low;X(i,:)=(X(i,:).*(~(Tp+Tm)))+up.*Tp+low.*Tm;
end
——————— The question is: what does it mean the lines code:
Tp=X(i,:)>up; Tm=X(i,:)<low; X(i,:)=(X(i,:).*(~(Tp+Tm)))+((rand(1,dim).*(up-low)+low).*(Tp+Tm));
Thank's
Best Answer