www.pudn.com > PSOofFLC.zip > Init_swarm.m, change:2016-05-14,size:1103b


%initialization of the swarm 
load initial_parameters.mat 
    for index=1:swarm_size, 
        %initialize position of prticles 
        for d=1:4, 
            swarm(index, 1, d) = p_init(d)+(1*(rand-0.5)); % 50% around actual value 
        swarm(index, 1, d)=max(0,min(swarm(index, 1, d),1)); %max=1 min=0 
        end 
        for d=5:16, 
            swarm(index, 1, d) = p_init(d)+(1*(rand-0.5));% 50% around actual value 
        swarm(index, 1, d)=max(-1,min(swarm(index, 1, d),1)); %max=1 min=-1 
        end 
       for d=17:20, 
            swarm(index, 1, d) = p_init(d)+(-1*(rand-0.5));% 50% around actual value 
       swarm(index, 1, d)=max(-1,min(swarm(index, 1, d),0)); %max=0 min=-1 
       end 
       for d=21:24, 
            swarm(index, 1, d) = p_init(d)+(0.6*(rand-0.5));% 50% around actual value 
       swarm(index, 1, d)=max(0,min(swarm(index, 1, d),1));  
       end 
       %initialize position of prticles 
       swarm(index, 2, :) =  (0.1)'.*(rand(num_of_D,1)-0.5)*2; 
    end 
swarm(:, 4, 1) = 10e10;          % initial best value --> some value out of practical limits