www.pudn.com > DE(rand1).rar > main_rand1.m, change:2012-01-05,size:1009b


clear all 
close all 
clc 
format long 
 
for s=1:1 
tt=cputime; 
 
Popsize=50;     % the size of the population 
Dim=100;         % the numbers of the variables 
F=0.2;          %  
Pc=0.03; 
Max_iter=8000;  % the maximum times of iteration 
Max_compute=10; % the compute times 
poprange=[repmat(-100,1,Dim);repmat(100,1,Dim)]; 
poprange=poprange';    
% s=1; 
gbest=zeros(Max_iter,Max_compute); 
gbsolution=zeros(Max_compute,Dim); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'); 
for compute=1:Max_compute 
     
    % Iteration 
    [gbest,gbsolution]=compute_rand1(Popsize,Dim,Pc,F,s,poprange,Max_iter,compute,gbest,gbsolution); 
     
    disp(gbest(Max_iter,compute)); 
 
end 
[sobj,spos]=sort(gbest(Max_iter,:)); 
min=sobj(1) 
max=sobj(Max_compute) 
aver=sum(gbest(Max_iter,:))/Max_compute 
gbsolution; 
%  for i=1:Max_compute 
%     figure(i); 
%     plot(1:Max_iter,gbest(:,i)); 
%    hold on 
%  end 
time=(cputime-tt)/Max_compute 
end