【车间调度】基于帝国企鹅算法求解考虑AVG分区多行车间调度问题附matlab代码
1 简介
基于帝国企鹅算法求解结合AGV分区车间多行布局问题。
2 部分代码
function [fit,result,x0]=aimFcn_1(x,option,data)x0=x;%% 解码获得厂区布局x1=x(1:data.numUnit+data.maxS-1);x(1:data.numUnit+data.maxS-1)=[];X=x;map=zeros(data.mapSize./data.accuracy);[~,S]=sort(x1);recording{1}=[];len2=data.mapSize(2)+data.d(2);len1=data.mapSize(1);recording0.noUnit=S;recording1=[];jishu=0;for i=1:length(S) no=S(i); if S(i)<=data.numUnit sizeUnit=data.Unit(no,1:2); type=1; jishu=jishu+1; else if jishu0 recording{end}=[recording{end};no,len1,len2,sizeUnit,type]; recording1=[recording1;no,len1,len2,sizeUnit,type]; len1=len1-(sizeUnit(1)+data.d(1)); else len1=data.mapSize(1); len2=len2-max(recording{end}(:,5))-data.d(2); recording=[recording;{[]}]; recording1=[recording1;no,len1,len2,sizeUnit,type]; recording{end}=[recording{end};no,len1,len2,sizeUnit,type]; len1=len1-(sizeUnit(1)+data.d(1)); endend%% 将各单元中心对齐recording0.unit=[];jishu1=1;for i=1:length(recording) if rem(i,2)==0 index=length(recording{i}(:,1)):-1:1; recording{i}=recording{i}(index,:); end maxY=max(recording{i}(:,5)); meanY=mean(recording{i}(:,5)); for j=1:length(recording{i}(:,1))% if recording{i}(j,1)<=data.numUnit% no=recording{i}(j,1);% unitType=recording{i}(j,6);% else% no=recording{i}(j,1)-data.numUnit;% unitType=0;% end no=recording{i}(j,1); unitType=recording{i}(j,6); x=data.mapSize(1)-recording{i}(j,2); y=recording{i}(j,3)-data.d(2); unitX=recording{i}(j,4); unitY=recording{i}(j,5); recording{i}(j,7)=x; recording{i}(j,8)=y-maxY/2+unitY/2; y=recording{i}(j,8); if no>data.numUnit recording{i}(j,1)=jishu1; recording{i}(j,6)=2; jishu1=jishu1+1; end end recording0.unit=[recording0.unit;[recording{i},ones(length(recording{i}(:,1)),1)*i]];endZone=[];index=1;jishu=1; %单元指针jishu1=1; %区域编号for i=1:length(recording0.unit(:,1)) if recording0.unit(i,6)==2 temp={recording0.unit((index:i-1),1)}; if ~isempty(temp{1}) Zone=[Zone;jishu,jishu+length(temp{1})-1]; index1=temp{1}; Zone1(index1)=jishu1; Zone2{jishu1}=index1; jishu1=jishu1+1; jishu=jishu+length(temp{1}); end index=i+1; endendtemp={recording0.unit(index:end,1)};if ~isempty(temp{1}) Zone=[Zone;jishu,jishu+length(temp{1})-1]; index1=temp{1}; Zone1(index1)=jishu1; Zone2{jishu1}=index1;endposition1=find(recording0.unit(:,6)==2);if length(position1)>length(Zone(:,1))-1 recording0.unit(position1(length(Zone(:,1)):end),:)=[];endposition1=find(recording0.unit(:,6)==2);position2=find(recording0.unit(:,6)==1);recording0.unit=[recording0.unit(position2,:);recording0.unit(position1,:)];recording0.noUnit=recording0.unit(:,1);recording0.Zone=Zone;recording0.Zone1=Zone1; %每个节点的区域recording0.Zone2=Zone2; %每个区域的节点endif max(DQ)>data.maxDQ punishiment=max(DQ)-data.maxDQ;else punishiment=0;endposition=find(recording0.unit(:,8)-recording0.unit(:,5)<0);punishiment=punishiment+1000*length(position);if max(recording0.Zone1)==1 punishiment=punishiment+1000000;endfor i=1:max(recording0.Zone1) position=find(recording0.Zone1==i); if length( position)1 result.fit=fit; result.recording0=recording0; result.DQ=DQ;endend
3 仿真结果
4 参考文献
[1]马艳楠. 平均最优信息粒子群算法在车辆调度问题中的应用[D]. 桂林电子科技大学, 2013.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~