一、获取代码方式
获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
获取代码方式2: 通过紫极神光博客主页开通CSDN会员,凭支付凭证,私信博主,可获得此代码。
获取代码方式3: 完整代码已上传我的资源:【优化算法】多目标利希滕贝格算法(MOLA)【含Matlab源码 1434期】
备注:开通CSDN会员,仅只能免费获得1份代码(有效期为开通日起,三天内有效); 订阅紫极神光博客付费专栏,可免费获得2份代码(有效期为订阅日起,三天内有效);
二、部分源代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MULTI-OBJECTIVE LICHTENBERG ALGORITHM (MOLA)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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)
% Search Space
LB = zeros(1,10); %lower bounds
UB = ones(1,10); %upper bounds
% Optimizator Parameters
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 = []; %Avoid 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
% MOLA
[x,fval] = LA_optimization(@objectives,d,pop,LB,UB,ref,n_iter,Np,Rc,S_c,M,ngrid,Nr,IntCon,@constraint);
% Figure
figure
plot(fval(:,1),fval(:,2),'ZDataSource','',...
'MarkerFaceColor',[0 0 1],...
'MarkerEdgeColor',[0 0 0],...
'MarkerSize',8,...
'Marker','o',...
'LineWidth',1.1,...
'LineStyle','none',...
'Color',[0 0 0]);
hold on
box on
legend('PF');
title('Non-dominated Solutions','fontweight','bold');
xlabel('Y_1')
ylabel('Y_2')
三、运行结果
四、matlab版本及参考文献
1 matlab版本 2014a
2 参考文献 [1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016. [2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.