【智能优化算法-闪电算法】基于闪电算法求解多目标优化问题附matlab代码

 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代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值