1 简介 柔性作业车间调度是在实际制造生产中广泛存在的一类问题。对该问题的研究,可以有效提高车间的生产效率,缩短制造周期。此外,实际生产调度问题还具有多目标、动态性等特点
1 简介
柔性作业车间调度是在实际制造生产中广泛存在的一类问题。对该问题的研究,可以有效提高车间的生产效率,缩短制造周期。此外,实际生产调度问题还具有多目标、动态性等特点,同时需要对生产中各种突发事件进行及时的响应。 本文首先研究了经典的柔性作业车间静态调度问题。在该问题的研究中,提出了一种"预调度确定各工序的加工机器"的优化策略,并将其应用到差分进化算法的种群初始化中,提高初始种群的质量。
2 部分代码
function plot_gant(Mec_N,Com_Num,star_t,end_t,Best)% arti=repelem(1:Mec_N,Com_Num);
% x=[150.059399274192 196.260024970295 186.984283323539 212.747530687756 167.363571486705 163.902458562661 107.067493817499 165.250411038459 135.927777433570 165.931695634301 174.450985125151 183.808390673624 189.716304529167 154.962440055274 190.531092055579 132.252304329349 158.260502776165 172.839860476166 178.293493991184 121.502924285128 160.701217067862 144.545455498799 160.797337279283 208.410521459539 161.667493231441 160.941542777386 186.037820807237 142.248355778307 185.953155425369 181.018390705916 168.249162390406 158.793720812979 184.706038367871 194.081824712592 163.633220939848 149.797816925022];
% Order12=[x',arti'];
% Order12=sortrows(Order12,1);
% Order12=Order12';
% x1=Order12(2,:);
% re_t1=zeros(1,Mec_N);
% %% 解码
% Order=x1;
% Com_Order=ones(1,Mec_N);
% Time1=Time;
% for ii=2:2:2*Com_Num
% Time1(:,ii)=0;
% end
% a=zeros(Mec_N,1);
% b=zeros(size(Order,2),1);
% end_t=[a,Time1];%工件加工结束时间
% star_t=[a,Time1];%工件加工开始时间
% re_t=zeros(1,Mec_N);
% re_t=[0:Mec_N-1;re_t];%设备释放时间
% Orders=[Order',b,b,b,b,b];%Orders=[工件 设备 加工开始时间 加工结束时间 属于类别(3) 加工时间]
% Orders(:,2)=-1;
% for i=1:Mec_N*Com_Num
% times=100;
% [x,y]=find(re_t(1,:)==Time(Order(i),2*Com_Order(1,Order(i))-1));
% relese=re_t(2,y);%提释放时间
% mechine_loca=Orders(Orders(:,2)==re_t(1,y),:);
% if isempty(mechine_loca)%设备未调用
% end_t(Order(i),2*Com_Order(1,Order(i))+1)=max([relese,end_t(Order(i),2*Com_Order(1,Order(i))-1),re_t1(1,y)])+Time(Order(i),2*Com_Order(1,Order(i)));
% star_t(Order(i),2*Com_Order(1,Order(i))+1)=max([relese,end_t(Order(i),2*Com_Order(1,Order(i))-1),re_t1(1,y)]);
% Orders(i,2)=Time(Order(i),2*Com_Order(1,Order(i))-1);%所在设备
% Orders(i,3)=star_t(Order(i),2*Com_Order(1,Order(i))+1);%开始时间
% Orders(i,4)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%结束时间
% if relese<end_t(Order(i),2*Com_Order(1,Order(i))+1)
% re_t(2,y)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%释放时间
% end
% Orders(i,6)=Time(Order(i),2*Com_Order(1,Order(i)));%测试用
% Com_Order(1,Order(i))= Com_Order(1,Order(i))+1;%测试用
% Orders(i,5)=1;%测试用
% end
% if ~isempty(mechine_loca)%设备已调用且存在冗余时间
% mechine_loca=sortrows(mechine_loca,3);
% r_size=size(mechine_loca,1);
% mechine_loca=[0 0 0 0 0 0;mechine_loca];
% for ii=1:r_size
% if (max([mechine_loca(ii,4),end_t(Order(i),2*Com_Order(1,Order(i))-1),re_t1(1,y)])+Time(Order(i),2*Com_Order(1,Order(i))))<=mechine_loca(ii+1,3)
% end_t(Order(i),2*Com_Order(1,Order(i))+1)=max([mechine_loca(ii,4),end_t(Order(i),2*Com_Order(1,Order(i))-1),re_t1(1,y)])+Time(Order(i),2*Com_Order(1,Order(i)));
% star_t(Order(i),2*Com_Order(1,Order(i))+1)=max([mechine_loca(ii,4),end_t(Order(i),2*Com_Order(1,Order(i))-1),re_t1(1,y)]);
% Orders(i,2)=Time(Order(i),2*Com_Order(1,Order(i))-1);%所在设备
% Orders(i,3)=star_t(Order(i),2*Com_Order(1,Order(i))+1);%开始时间
% Orders(i,4)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%结束时间
% if relese<end_t(Order(i),2*Com_Order(1,Order(i))+1)
% re_t(2,y)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%释放时间
% end
% Orders(i,6)=Time(Order(i),2*Com_Order(1,Order(i)));%测试代码
% Com_Order(1,Order(i))= Com_Order(1,Order(i))+1;%测试代码
% times=1000;
% Orders(i,5)=2;%测试代码
% break
% end
% end
% end
% if ~isempty(mechine_loca)&×~=1000;%设备已调用且不存在冗余时间
% end_t(Order(i),2*Com_Order(1,Order(i))+1)=max(relese,end_t(Order(i),2*Com_Order(1,Order(i))-1))+Time(Order(i),2*Com_Order(1,Order(i)));
% star_t(Order(i),2*Com_Order(1,Order(i))+1)=max(relese,end_t(Order(i),2*Com_Order(1,Order(i))-1));
% Orders(i,2)=Time(Order(i),2*Com_Order(1,Order(i))-1);%所在设备
% Orders(i,3)=star_t(Order(i),2*Com_Order(1,Order(i))+1);%开始时间
% Orders(i,4)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%结束时间
% if relese<end_t(Order(i),2*Com_Order(1,Order(i))+1)
% re_t(2,y)=end_t(Order(i),2*Com_Order(1,Order(i))+1);%释放时间
% end
% Orders(i,6)=Time(Order(i),2*Com_Order(1,Order(i)));%测试代码
% Com_Order(1,Order(i))= Com_Order(1,Order(i))+1;%测试代码
% Orders(i,5)=3;%测试代码
% end
% end
% fx(1,:)=[Order(1,:),max(Orders(:,4))];
% q=sortrows(fx,Mec_N*Com_Num+1);
% Min_T=q(1,Mec_N*Com_Num+1);
% result=Min_T;
% min_order=q(1:Mec_N*Com_Num);
% mmmm=sum(Com_Order)-6;%测试代码
%% 画甘特图
w=0.8;%横条宽度
set(gcf,'color','w');
color=[1,0,0;
0,1,0;
0,0,1;
1,1,0;
1,0,1;
0,1,1;
0.67,0,1;
1,.5,0;
.9,.5,.2;
.5,.5,.5];%颜色RGB值
for ii=1:Mec_N
for j=3:2:2*(Com_Num+1)
if end_t(ii,j)-star_t(ii,j) ~=0
x=[star_t(ii,j) star_t(ii,j) end_t(ii,j) end_t(ii,j)];
y=star_t(ii,j-1)+[-w/2 w/2 w/2 -w/2];
p=patch('xdata',x,'ydata',y,'facecolor',[color(ii,1),color(ii,2),color(ii,3)],'edgecolor','k');
%p=patch('xdata',x,'ydata',y,'facecolor','w','edgecolor','k');
str = [num2str(end_t(ii,j)-star_t(ii,j)),'-',num2str(ii)];
text((end_t(ii,j)+star_t(ii,j))/2-1.5,star_t(ii,j-1),str);
%text((end_t(ii,j)+star_t(ii,j))/2-0.5,star_t(ii,j-1),num2str(end_t(ii,j)-star_t(ii,j)),'FontSize',11)
end
end
end
%xlabel('processing time(s)','FontSize',15);
%ylabel('machine','FontSize',15);
%(gca,'position',[0.05 0.05 1.05 1.05]);
set(gca,'Box','on');
Best=Best+10;
bbb=fix(Best/10);
set(gca,'XLim',[0 Best])
set(gca,'XTick',0:4:Best,'FontSize',18);
set(gca,'YTick',-1:Com_Num,'FontSize',18);
set(gca,'YTickLabel',[{''};num2str((0:Com_Num)','M%d');{''}],'FontSize',12);
3 仿真结果
4 参考文献
[1]王万良, 范丽霞, 徐新黎,等. 多目标差分进化算法求解柔性作业车间批量调度问题[J]. 计算机集成制造系统, 2013, 19(10):12.