www.pudn.com > PSO-algorithm.rar > gant6c6.m, change:2011-08-04,size:1482b


function gant6c6(jobname,t_start,t_end,gbest_v) 
 
[m n]=size(t_start); 
axis_size=[0 gbest_v+2 0 m+0.5]; 
axis(axis_size); 
yla=[1:m]; 
set(gca,'ytick',yla); 
ylabel('Processing Machine','FontSize',12,'color','b'); 
xlabel('Processing Time','FontSize',12,'color','b'); 
title('the scheduling result','FontSize',16,'color','r'); 
set(gcf,'Color','g') 
hold on 
 
 
ZO=m+1; 
for i=1:m 
    for j=1:n 
        x=[t_start(i,j) t_start(i,j) t_end(i,j) t_end(i,j)]; 
        y=[ZO-i-0.3 ZO-i+0.3 ZO-i+0.3 ZO-i-0.3]; 
         
        %    [1 1 0 ]   y   yellow 
        %   [1 0 1]  m   magenta  
        %   [0 1 1]  c  cyan 
        % [1 0 0]  r   red 
        %[0 1 0]  g  green 
        %[0 0 1]  b   blue 
      switch(jobname(i,j)) 
           
              case 1   
                  fill(x,y,'y'); 
              case 2  
                  fill(x,y,'m'); 
              case 3   
                  fill(x,y,'c'); 
              case 4  
                  fill(x,y,'r'); 
              case 5   
                  fill(x,y,'g'); 
              case 6  
                  fill(x,y,'b'); 
            
      end 
         
          
      jobnamestr=strcat(int2str(jobname(i,j))); 
      t_startstr=strcat(int2str(t_start(i,j))); 
      t_endstr=strcat(int2str(t_end(i,j))); 
       
      text((t_start(i,j)+t_end(i,j))/2-0.2,ZO-i,jobnamestr); 
      text(t_start(i,j)-0.2,ZO-i-0.5,t_startstr); 
      text(t_end(i,j)-0.2,ZO-i-0.5,t_endstr); 
       
      hold on 
   end 
end