1 内容介绍
随着计算的进步和自然界中发现的最佳现象的启发,已经开发了几种能够解决复杂工程问题的算法。这项工作详细介绍了多目标 Lichtenberg 算法的开发,该版本能够处理受径向云内闪电和 Lichtenberg 图形传播启发的新创建的元启发式算法的多个目标。该算法在其优化例程中考虑了一个基于种群和轨迹的混合系统,展示了强大的探索和利用能力,因为它通过大小和不同旋转拍摄的 Lichtenberg 图在目标函数中分配要评估的点在每次迭代中。多目标 Lichtenberg 算法 (MOLA) 是第一个混合多目标元启发式算法,并使用著名和复杂的测试函数组针对传统和最近的元启发式算法进行了测试,并且还约束了复杂的工程问题。
2 部分代码
%% Harmony Search Parallel Machine Scheduling (HS-PMS
clc;
clear;
close all;
global NFE;
NFE=0;
%% Problem Definition
model=CreateModel(); % Create Model of the Problem
CostFunction=@(x) MyCost(x,model); % Cost Function
nVar=model.nVar; % Number of Decision Variables
VarSize=[1 nVar]; % Size of Decision Variables Matrix
VarMin = 0; % Lower Bound of Decision Variables
VarMax = 1; % Upper Bound of Decision Variables
%% Harmony Search Parameters
MaxIt = 100; % Maximum Number of Iterations
HMS = 20; % Harmony Memory Size
nNew = 20; % Number of New Harmonies
HMCR = 0.9; % Harmony Memory Consideration Rate
PAR = 0.1; % Pitch Adjustment Rate
FW = 0.02*(VarMax-VarMin); % Fret Width (Bandwidth)
FW_damp = 0.995; % Fret Width Damp Ratio
%% Start
% Empty Harmony Structure
empty_harmony.Position = [];
empty_harmony.Cost = [];
empty_harmony.Sol = [];
% Initialize Harmony Memory
HM = repmat(empty_harmony, HMS, 1);
% Create Initial Harmonies
for i = 1:HMS
HM(i).Position = unifrnd(VarMin, VarMax, VarSize);
[HM(i).Cost HM(i).Sol] = CostFunction(HM(i).Position);
end
% Sort Harmony Memory
[~, SortOrder] = sort([HM.Cost]);
HM = HM(SortOrder);
% Update Best Solution Ever Found
BestSol = HM(1);
% Array to Hold Best Cost Values
BestCost = zeros(MaxIt, 1);
%% Harmony Search Body
for it = 1:MaxIt
% Initialize Array for New Harmonies
NEW = repmat(empty_harmony, nNew, 1);
% Create New Harmonies
for k = 1:nNew
% Create New Harmony Position
NEW(k).Position = unifrnd(VarMin, VarMax, VarSize);
for j = 1:nVar
if rand <= HMCR
% Use Harmony Memory
i = randi([1 HMS]);
NEW(k).Position(j) = HM(i).Position(j);
end
% Pitch Adjustment
if rand <= PAR
%DELTA = FW*unifrnd(-1, +1); % Uniform
DELTA = FW*randn(); % Gaussian (Normal)
NEW(k).Position(j) = NEW(k).Position(j)+DELTA;
end
end
% Apply Variable Limits
NEW(k).Position = max(NEW(k).Position, VarMin);
NEW(k).Position = min(NEW(k).Position, VarMax);
% Evaluation
[NEW(k).Cost NEW(k).Sol] = CostFunction(NEW(k).Position);
end
% Merge Harmony Memory and New Harmonies
HM = [HM
NEW];
% Sort Harmony Memory
[~, SortOrder] = sort([HM.Cost]);
HM = HM(SortOrder);
% Truncate Extra Harmonies
HM = HM(1:HMS);
% Update Best Solution Ever Found
BestSol = HM(1);
% Store Best Cost Ever Found
BestCost(it) = BestSol.Cost;
% Store NFE
nfe(it)=NFE;
% Iteration
disp(['In Iteration ' num2str(it) ': NFE = ' num2str(nfe(it)) ', Cost is = ' num2str(BestCost(it))]);
% Plot Res
figure(1);
PlotSolution(BestSol.Sol,model);
end
%% Show Results
figure;
plot(nfe,BestCost,'-og','linewidth',1,'MarkerSize',7,'MarkerFaceColor',[0.9,0.1,0.1]);
title('Harmony Search','FontSize', 15,'FontWeight','bold');
xlabel(' NFE','FontSize', 15,'FontWeight','bold');
ylabel(' Cost Value','FontSize', 15,'FontWeight','bold');
xlim([0 inf])
xlim([0 inf])
ax = gca;
ax.FontSize = 15;
set(gca,'Color','b')
legend({'HS PMS'},'FontSize',12,'FontWeight','bold','TextColor','g');
3 运行结果
4 参考文献
[1] Pereira J , Oliver G A , Francisco M B , et al. Multi-objective lichtenberg algorithm: A hybrid physics-based meta-heuristic for solving engineering problems[J]. Expert Systems with Application, 2022(187-Jan.).
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机、雷达通信、无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。