www.pudn.com > DE(rand1).rar > compute_DE.asv, change:2011-11-19,size:657b


function [gbest,gbsolution]=compute_DE(Popsize,Dim,Pc,F,s,poprange,Max_iter,compute,gbest,gbsolution) 
% initial the population 
pop=initialpop(Popsize,Dim,poprange); 
obj=benchmark_function(New_pop,s); 
[sobj,spos]=sort(obj); 
gbest(1,compute)=sobj(1); 
pos=spos(1); 
gbsolution(compute,:)=New_pop(pos,:); 
 
 
% iterations 
for iter=2:Max_iter 
    M_pop=mutation(pop,F); 
    CR_pop=crossover(pop,M_pop,Pc); 
    New_pop=select(pop,CR_pop,s); 
    obj=benchmark_function(New_pop,s); 
    [sobj,spos]=sort(obj); 
    if 
    gbest(iter,compute)=sobj(1); 
    pos=spos(1); 
    gbsolution(compute,:)=New_pop(pos,:); 
    pop=New_pop; 
     
     
     
end