www.pudn.com > DE(rand1).rar > select.m, change:2011-11-19,size:524b


function [New_pop,obj]=select(pop,obj,CR_pop,s) 
% New_pop is the new population after the oprations of mutation,crossover 
% and select; 
% f1 is the pop's objectfunction values; 
% f2 is the CR_pop's objectfunction values; 
[Popsize,Dim]=size(pop); 
New_pop=zeros(Popsize,Dim); 
f1=obj; 
f2=benchmark_function(CR_pop,s); 
 
for i=1:Popsize 
    if (f2(i)<f1(i)) 
        New_pop(i,:)=CR_pop(i,:); 
        obj(i)=f2(i); 
    end 
    if (f1(i)<=f2(i)) 
        New_pop(i,:)=pop(i,:); 
        obj(i)=f1(i); 
    end 
end