大规模装箱问题:蜣螂优化算法DBO求解二维装箱问题(MATLAB代码)

作品简介

一、问题描述

装载率:所有选择的箱子的总面积与夹板面积之比

假设一共有300个箱子,如何设计算法,使得选择部分箱子放入80*80的甲板上,让甲板的装载率越大,要求箱子间不得重叠。

二、蜣螂优化算法求解二维装箱问题

蜣螂优化算法的目标函数是甲板的装载率

2.1部分代码

% -----------------------------------------------------------------------------------------------------------
% Dung Beetle Optimizer:                                            
%  Jiankai Xue & Bo Shen (2022) Dung beetle optimizer: a new meta-heuristic
% algorithm for global optimization. The Journal of Supercomputing, DOI:
% 10.1007/s11227-022-04959-6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
clear 
clc
SearchAgents_no=30; % Number of search agents
Function_name='F1'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper)
Max_iteration=30; % Maximum numbef of iterations
% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);
[fMin,bestX,curve]=DBO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
save bestX bestX
save curve curve
ResultList=PlotFigure(bestX);%货物的序号和长宽
save('result.txt','ResultList','-ascii');
figure
plot(curve,'g-','linewidth',3)
xlabel('迭代次数');
ylabel('装载率');
xlim([1 Max_iteration])
ylim([min(curve) max(curve)])
legend('DBO')

2.1部分结果

下图中甲板中,金黄色区域表示已经放置箱子,粉色区域表示闲置区域。

甲板平面的装载率:95.5469%

箱子的使用率:80%

三、完整MATLAB代码


创作时间: