✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
车间设备布局问题,是一个NP难问题.许多学者利用启发式算法来 求解并取得了一定的成果,但在模型中存在距离定义不合理的情况,均采用绝对距离的方式,存在不符合实际和计算不准确的情况;本文对距离的定义进行了改进, 并利用遗传算法对改进后的模型进行求解,效果良好,达到了预期目标.
⛄ 部分代码
function [ globalMin, opt_layout] = mld_ga_basic(popSize, numIter, len, wid, loads )
% FUNCTION: mld_ga_basic Calculates the min load distance cost for a layout
% using a tournament approach mutation type genetic algorithm. The layout
% is based on length (len) x width (wid) of the area of the building to
% assign departments.
% GA steps:
% Initialize:
% (1) Calculate the number of departments given the layout dimensions
% based on length * width = departments ( 2 * 3 = 6 departments)
% (2) Load matrix indicates the number of loads per/week from dep matrix of 4 rows of best layout
tmpPop(k,:) = bestOf4Layout;
switch k
% flip segment between two of the departments
case 2 % Flip
tmpPop(k,I:J) = tmpPop(k,J:-1:I);
case 3 % Swap departments
tmpPop(k,[I J]) = tmpPop(k,[J I]);
case 4 % Slide departments down
tmpPop(k,I:J) = tmpPop(k,[I+1:J I]);
otherwise % Do Nothing
end
end
% using the original population, create a new population
newPop(p-3:p,:) = tmpPop;
end
pop = newPop;
end
function call_plot( xy, ~)
subplot(1,2,1)
plot(xy(:,1), xy(:,2),'rs','MarkerSize',50,...
'MarkerEdgeColor','red',...
'MarkerFaceColor',[1 .6 .6]);
xlim([0 len+1]); ylim([0 wid+1]);
hold off;
title('布局规划');
xlabel('建筑长度'); ylabel('建筑宽度');
labels = cellstr( num2str(layout') );
text(xy(:,1), xy(:,2), labels, 'HorizontalAlignment','center')
drawnow;
if iter>0
subplot(1,2,2)
dH=costHistory(costHistory>0);
dI=costIteration(costIteration>0);
plot(dI, dH,'b-');
title(sprintf('Min LxD Cost = %1.4f',minCost));
xlabel('迭代次数'); ylabel('费用');
end
end
opt_layout=optLayout;
end
⛄ 运行结果
⛄ 参考文献
[1] 廖源泉. 基于遗传算法的车间设施布局优化及仿真研究[D]. 南华大学.
[2] 魏军凯, 吴芳, 戚峰. 基于遗传算法求解车间设备布局优化问题[J]. 兰州交通大学学报, 2011, 30(3):5.
[3] 魏军凯. 基于遗传算法求解车间设备布局优化问题[J]. 兰州交通大学学报, 2011(003):030.