💥1 概述
该文提出一种基于卷积神经网络的有效两阶段算法,以求解具有机器故障的柔性作业车间调度问题(FJSP)。建立了以最大完成时间和鲁棒性为目标的双目标动态柔性作业车间调度问题(DFJSP)模型。提出了CNN构建的预测模型,并开发了一个名为RMn的替代指标来评估鲁棒性。实验结果表明,所提两阶段算法对求解DFJSP有效,RMn能够更快、更高效、更准确地评估调度的鲁棒性。
📚2 运行结果
部分代码:
function [makespan1,RMn]=caltimen(S,pop) Jm=pop.Jm; T=pop.T; PNumber=pop.PNumber; MPNumber=pop.MPNumber; JmNumber=pop.JmNumber; WNumber=pop.WNumber; Number=pop.Number; Number_s = cumsum(Number); NINDA=1; NINDB=0; %% S1=S(1,1:WNumber); MU=zeros(PNumber,MPNumber); PJT=zeros(PNumber,MPNumber); s=1; for i=1:PNumber val=Number(i); for j=1:val M=S1(1,s); s=s+1; Temp1=Jm{i,j}; m=Temp1(M); MU(i,j)=m; Temp2=T{i,j}; t=Temp2(M); PJT(i,j)=t; end end %% S2=S(1,(1+WNumber):2*WNumber); temp=zeros(1,PNumber); P=zeros(1,WNumber); for i=1:WNumber temp(S2(i))=temp(S2(i))+1; P(i)=S2(i)*100+temp(S2(i)); end %% TM=zeros(1,JmNumber); TP=zeros(1,PNumber); PVal=zeros(2,WNumber); t1=zeros(JmNumber,WNumber); t2=zeros(JmNumber,WNumber); TSE=zeros(5*JmNumber,WNumber); MPN=zeros(1,JmNumber); %% for ii=1:WNumber if ii==1 PNval=P(1,ii); a=(mod(PNval,100)); b=((PNval-a)/100); m=MU(b,a); t=PJT(b,a); TMval=TM(1,m); TPval=TP(1,b); if TMval>TPval val=TMval; else val=TPval; end PVal(1,ii)=val; PVal(2,ii)=val+t; TM(1,m)=PVal(2,ii); TP(1,b)=PVal(2,ii); MPN(1,m)=MPN(1,m)+1; t1(m,ii)=TM(1,m)-t; t2(m,ii)=TM(1,m); TSE(5*m-4,1)=PNval; TSE(5*m-3,1)=PVal(1,1); TSE(5*m-2,1)=PVal(2,1); TSE(5*m-1,1)=0; TSE(5*m-0,1)=PVal(1,1); else PNval=P(1,ii); a=(mod(PNval,100)); b=((PNval-a)/100); m=MU(b,a); t=PJT(b,a); TMval=TM(1,m); TPval=TP(1,b); TSEok=0; %% for w=1:MPN(1,m) TSval=TSE(5*m-1,w); TEval=TSE(5*m,w); SJM=max(TSval,TPval); if (SJM+t<=TEval) TSEok=1; if TSval<=TPval PVal(1,ii)=TPval; PVal(2,ii)=TPval+t; t1(m,ii)=PVal(2,ii)-t; t2(m,ii)=PVal(2,ii); TP(1,b)=PVal(2,ii); MPN(1,m)=MPN(1,m)+1; TSE(5*m-4:5*m,w+1:WNumber)=TSE(5*m-4:5*m,w:WNumber-1); TSE(5*m-4,w)=PNval; TSE(5*m-3,w)=PVal(1,ii); TSE(5*m-2,w)=PVal(2,ii); if w-1==0 TSE(5*m-1,w)=0; else TSE(5*m-1,w)=TSE(5*m-2,w-1); end TSE(5*m,w)=PVal(1,ii); TSE(5*m-1,w+1)=PVal(2,ii); else PVal(1,ii)=TSval; PVal(2,ii)=TSval+t; t1(m,ii)=PVal(2,ii)-t; t2(m,ii)=PVal(2,ii); TP(1,b)=PVal(2,ii); MPN(1,m)=MPN(1,m)+1; TSE(5*m-4:5*m,w+1:WNumber)=TSE(5*m-4:5*m,w:WNumber-1); TSE(5*m-4,w)=PNval; TSE(5*m-3,w)=PVal(1,ii); TSE(5*m-2,w)=PVal(2,ii); if w-1==0 TSE(5*m-1,w)=0; else TSE(5*m-1,w)=TSE(5*m-2,w-1); end TSE(5*m,w)=PVal(1,ii); TSE(5*m-1,w+1)=PVal(2,ii); end end if TSEok==1 break end end if TSEok~=1 if TMval<=TPval PVal(1,ii)=TPval; PVal(2,ii)=TPval+t; TM(1,m)=PVal(2,ii); TP(1,b)=PVal(2,ii); MPN(1,m)=MPN(1,m)+1; t1(m,ii)=TM(1,m)-t; t2(m,ii)=TM(1,m); TSE(5*m-4,MPN(1,m))=PNval; TSE(5*m-3,MPN(1,m))=PVal(1,ii); TSE(5*m-2,MPN(1,m))=PVal(2,ii); if MPN(1,m)==1 TSE(5*m-1,MPN(1,m))=0; else TSE(5*m-1,MPN(1,m))=TSE(5*m-2,MPN(1,m)-1); end TSE(5*m,MPN(1,m))=PVal(1,ii); else PVal(1,ii)=TMval; PVal(2,ii)=TMval+t; TM(1,m)=PVal(2,ii); TP(1,b)=PVal(2,ii); MPN(1,m)=MPN(1,m)+1; t1(m,ii)=TM(1,m)-t; t2(m,ii)=TM(1,m); TSE(5*m-4,MPN(1,m))=PNval; TSE(5*m-3,MPN(1,m))=PVal(1,ii); TSE(5*m-2,MPN(1,m))=PVal(2,ii); if MPN(1,m)==1 TSE(5*m-1,MPN(1,m))=0; else TSE(5*m-1,MPN(1,m))=TSE(5*m-2,MPN(1,m)-1); end TSE(5*m,MPN(1,m))=PVal(1,ii); end end end end makespan1=max(max(PVal)); %% float time ftc TSE_1 = zeros(3*JmNumber,WNumber); TSE_2 = zeros(4,WNumber); kongxitime1=zeros(2,WNumber); Tlates = zeros(2,WNumber); ftc = zeros(2,WNumber); Avecft = zeros(2,WNumber); T = PVal(2,:)-PVal(1,:); earlytime = [P;PVal(1,:);T]; earlytime = sortrows(earlytime')'; b1 = zeros(1,JmNumber); for i = 1:JmNumber TSE1 = TSE(5*i-4,:); a1 = find(TSE1==0); b1(i) = a1(1)-1; end for k = 1:JmNumber for w = 1:b1(k)-1 TSE_1(3*k-2,w)=TSE(5*k-4,w); TSE_1(3*k-1,w)=TSE(5*k-1,w+1); TSE_1(3*k,w)=TSE(5*k,w+1); TSE_1(3*k-2,b1(k))=TSE(5*k-4,b1(k)); TSE_1(3*k-1,b1(k))=TSE(5*k-2,b1(k)); TSE_1(3*k,b1(k))=makespan1; end end b1_S = cumsum(b1); b1_S = [0,b1_S]; for j = 1:JmNumber TSE_2(1,b1_S(j)+1:b1_S(j+1)) = TSE_1(3*j-2,1:b1(j)); TSE_2(2,b1_S(j)+1:b1_S(j+1)) = TSE_1(3*j-1,1:b1(j)); TSE_2(3,b1_S(j)+1:b1_S(j+1)) = TSE_1(3*j,1:b1(j)); end TSE_2 = sortrows(TSE_2')'; TSE_2(4,:) = TSE_2(3,:)-TSE_2(2,:); Tlates(1,:) = TSE_2(1,:); for n=1:WNumber if TSE_2(4,n)==0 Tlates(2,n) = earlytime(2,n); else if ismember(n,Number_s)==1 kongxitime1(1,n) = TSE_2(1,n); kongxitime1(2,n) = TSE_2(4,n); else if TSE_2(3,n)<= earlytime(2,n+1) Tlates(2,n) = TSE_2(3,n)-earlytime(3,n); else Tlates(2,n) = earlytime(2,n+1)-earlytime(3,n); end end end end ftc(1,:) = Tlates(1,:); ftc(2,:) = Tlates(2,:)-earlytime(2,:); col=find(kongxitime1(1,:)~=0); for m=1:length(col) ftc(1,col(m)) = kongxitime1(1,col(m)); ftc(2,col(m)) = kongxitime1(2,col(m)); end Avecft(1,:) = ftc(1,:); xulie=find(ftc(2,:)~=0); for r=1:length(xulie) Avecft(2,xulie(r)) = TSE_2(2,xulie(r))+ftc(2,xulie(r))/2; end %% Wc = reshape(PJT',1,pop.PNumber*pop.MPNumber); Wc(find(Wc==0))=[]; Wtot = sum(Wc); ejc1 = Wc./Wtot.*ftc(2,:); %% Simulate machine breakdown Tbusy = sum(PJT'); Pbk=Tbusy/Wtot; jiqi_0=find(Pbk==max(Pbk(:))); jiqi=jiqi_0(1); a1=0.5; %a1=0; a2=1; %a2=0.5; b1=0.35; %b1=0.1; b2=0.4; %b2=0.15; ts=unifrnd(a1*makespan1,a2*makespan1,1,1); ts=roundn(ts,0); te=unifrnd(b1*Tbusy(jiqi),b2*Tbusy(jiqi),1,1); te=roundn(te,0); %% Calculate the objective function value Avekcmb=te/2+ts; ejc2=(1./exp(abs(Avecft(2,:)-Avekcmb))).*ftc(2,:); ej=[ejc1,ejc2]; %% Enter a predictive model load ('net1-10-10.mat') pt=ej'; t1=sim(net,pt); RMn=t1'; end
🌈3 Matlab代码实现
🎉4 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Guohui Zhang, Xixi Lu, Xing Liu, Litao Zhang, Shiwen Wei, Wenqiang Zhang (2022) An two-stage algorithm based on convolutional neural network for flexible job shop scheduling problem