31?1?1?1?1?1?1?31?1?1?1?1?1?1?1];whileisequal(open,s)==0on=[];fori=1:4ifturn{i,j}=='off'%在turn矩阵中逐列搜索,若设备处于关机状态,则作记录(可用)on=[oni];endendl1=length(on);form=1:l1%在整个生产计划中(对设备逐个)寻找能够选作操作的步骤[x,y]=find(open==2);l2=length(x);a=[x(1)y(1)];fork=1:l2%对某个设备on(m),找出当前它能操作的步骤中耗时最小的一个ifmes{on(m)}(a(1),a(2))>mes{on(m)}(x(k),y(k))a=[x(k)y(k)];endendifturn{on(m),j}=='off'&mes{on(m)}(a(1),a(2))~=100%若时间为100则意味着这个步骤不属于我们希望使用的那件设备whiletim(a(1),a(2))>0turn{on(m),tim(a(1),a(2))+j-1}=a(1);tim(a(1),a(2))=tim(a(1),a(2))-1;endendendfori=1:4ifturn{i,j}~='off'dai(i)=turn{i,j};endendfori=1:4ifturn{i,j}~='off'&turn{i,j+1}=='off'gongxu(turn{i,j})=gongxu(turn{i,j})+1;open(turn{i,j},gongxu(turn{i,j}))=1;endifgongxu(dai(i))<8&open(dai(i),gongxu(dai(i))+1)~=3&turn{i,j+1}=='off'open(dai(i),gongxu(dai(i))+1)=2;endendj=j+1;end