1 内容介绍
闪电连接过程算法( Lightning Attachment Procedure Optimization,LAPO)是受自然界中闪电上迎先导与下行先导连接过程的启发,于2017年提出的一种新型智能算法。该算法具有收敛速度快,精度高等特点。
2 仿真代码
close all
clear all
clc
format long
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 14)
set(0,'DefaultTextFontname', 'Times New Roman')
set(0,'DefaultTextFontSize', 26)
opengl('save', 'software')
% Optimizator Parameters
LB = zeros(1,10); %lower bounds
UB = ones(1,10); %upper bounds
pop = 100; %Population
n_iter = 100; %Max number os iterations/gerations
ref = 0.4; %if more than zero, a second LF is created with refinement % the size of the other
IntCon = [0]; %zero if there are no variables that must be integers. Ex.: IntCon = [1,2];
Np = 100000; %Number of Particles (If 3D, better more than 10000)
S_c = 1; %Stick Probability: Percentage of particles that can don´t stuck in the
%cluster. Between 0 and 1. Near 0 there are more aggregate, the density of
%cluster is bigger and difusity is low. Near 1 is the opposite.
Rc = 150; %Creation Radius (if 3D, better be less than 80, untill 150)
M = 0; %If M = 0, no lichtenberg figure is created (it is loaded a optimized figure); if 1, a single is created and used in all iterations; If 2, one is created for each iteration.(creating an LF figure takes about 2 min)
d = length(UB); %problem dimension
ngrid = 30; %Number of grids in each dimension
Nr = 100; %Maximum number of solutions in PF
[x,fval] = LA_optimization(@objectives,d,pop,LB,UB,ref,n_iter,Np,Rc,S_c,M,ngrid,Nr,IntCon,@constraint);
figure
plot(fval(:,1),fval(:,2),'ZDataSource','',...
'MarkerFaceColor',[1 0 0],...
'MarkerEdgeColor',[0 0 0],...
'MarkerSize',8,...
'Marker','o',...
'LineWidth',0.3,...
'LineStyle','none',...
'Color',[0 0 0]);
hold on
box on
set(0,'DefaultAxesFontSize', 10)
set(0,'DefaultTextFontSize', 10)
set(findall(gcf,'-property','FontName'),'FontName','Italic')
set(findall(gcf,'-property','FontAngle'),'FontAngle','italic')
set(gcf,'position',[200,200,600,320])
%title('Non-dominated solutions','fontweight','bold');
%axis([0 3000 0 30000 0 -1])
xlabel('f_1')
ylabel('f_2')
function y = objectives(x)
y(1)= x(1);
n = length(x);
g =1+(9/29)*sum(x(2:n));
h=1-sqrt(y(1)/g)-(y(1)/g)*sin(10*pi*y(1));
y(2)= g*h;
return
close all
clear all
clc
format long
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 14)
set(0,'DefaultTextFontname', 'Times New Roman')
set(0,'DefaultTextFontSize', 26)
opengl('save', 'software')
% Optimizator Parameters
LB = zeros(1,10); %lower bounds
UB = ones(1,10); %upper bounds
pop = 100; %Population
n_iter = 100; %Max number os iterations/gerations
ref = 0.4; %if more than zero, a second LF is created with refinement % the size of the other
IntCon = [0]; %zero if there are no variables that must be integers. Ex.: IntCon = [1,2];
Np = 100000; %Number of Particles (If 3D, better more than 10000)
S_c = 1; %Stick Probability: Percentage of particles that can don´t stuck in the
%cluster. Between 0 and 1. Near 0 there are more aggregate, the density of
%cluster is bigger and difusity is low. Near 1 is the opposite.
Rc = 150; %Creation Radius (if 3D, better be less than 80, untill 150)
M = 0; %If M = 0, no lichtenberg figure is created (it is loaded a optimized figure); if 1, a single is created and used in all iterations; If 2, one is created for each iteration.(creating an LF figure takes about 2 min)
d = length(UB); %problem dimension
ngrid = 30; %Number of grids in each dimension
Nr = 100; %Maximum number of solutions in PF
[x,fval] = LA_optimization(@objectives,d,pop,LB,UB,ref,n_iter,Np,Rc,S_c,M,ngrid,Nr,IntCon,@constraint);
figure
plot(fval(:,1),fval(:,2),'ZDataSource','',...
'MarkerFaceColor',[1 0 0],...
'MarkerEdgeColor',[0 0 0],...
'MarkerSize',8,...
'Marker','o',...
'LineWidth',0.3,...
'LineStyle','none',...
'Color',[0 0 0]);
hold on
box on
set(0,'DefaultAxesFontSize', 10)
set(0,'DefaultTextFontSize', 10)
set(findall(gcf,'-property','FontName'),'FontName','Italic')
set(findall(gcf,'-property','FontAngle'),'FontAngle','italic')
set(gcf,'position',[200,200,600,320])
%title('Non-dominated solutions','fontweight','bold');
%axis([0 3000 0 30000 0 -1])
xlabel('f_1')
ylabel('f_2')
function y = objectives(x)
y(1)= x(1);
n = length(x);
g =1+(9/29)*sum(x(2:n));
h=1-sqrt(y(1)/g)-(y(1)/g)*sin(10*pi*y(1));
y(2)= g*h;
return
3 运行结果
4 参考文献
[1]王春枝, 邢绍文, 严灵毓,等. 改进闪电连接过程优化算法的网络流量预测方法及系统:.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。