​【优化求解】基于改进正弦余弦算法求解高维优化问题matlab源码

1 简介

正弦余弦算法( sine cosine algorithm,SCA) 是由澳大利亚学者 Mirjalili于 2016 年提出的一种新型群体智能优化算法。本文提出一种改进的正弦余弦算法(简记为ISCA).受粒子群优化(PSO)算法的启发,引入惯性权重以提高正弦余弦算法的收敛精度和加快收敛速度.此外,采取反向学习策略产生初始个体以提高种群的多样性和解的质量.采用八个高维基准测试函数进行仿真实验:在相同的最大适应度函数评价次数下,ISCA总体性能上均优于基本SCA和HGWO算法;当维数较高(D=1 000)时,ISCA所用计算量远小于HDEOO算法.实验结果表明ISCA在收敛精度和收敛速度指标上均优于对比算法.

2 部分代码

%% 清除环境变量
clear 
clc

%% 参数设置
N = 50;             % 种群规模
Function_name = 'F1';       % 从F1到F23的测试函数的名称(本文中的表1、2、3)
Max_iteration = 1000;       % 最大迭代次数
% 加载所选基准函数的详细信息
[lb, ub, fobj] = Get_Functions_details(Function_name);

cnt_max = 30;

Curve_ISCA_100 = zeros(1, Max_iteration);
Curve_ISCA_500 = zeros(1, Max_iteration);
Curve_ISCA_1000 = zeros(1, Max_iteration);

for cnt = 1:cnt_max
   % 初始化种群位置
   % 100维
   dim = 100;
   X1 = initialization(N, dim, ub, lb);
  [ISCA_Best_score_100(cnt), ISCA_Best_pos_100(cnt, :), ISCA_Curve_100] = ISCA(X1, N, Max_iteration, lb, ub, dim, fobj);
   % 500维
   dim = 500;
   X2 = initialization(N, dim, ub, lb);
  [ISCA_Best_score_500(cnt), ISCA_Best_pos_500(cnt, :), ISCA_Curve_500] = ISCA(X2, N, Max_iteration, lb, ub, dim, fobj);
   % 1000维
   dim = 1000;
   X3 = initialization(N, dim, ub, lb);
  [ISCA_Best_score_1000(cnt), ISCA_Best_pos_1000(cnt, :), ISCA_Curve_1000] = ISCA(X3, N, Max_iteration, lb, ub, dim, fobj);
   
   Curve_ISCA_100 = Curve_ISCA_100+ISCA_Curve_100;
   Curve_ISCA_500 = Curve_ISCA_500+ISCA_Curve_500;
   Curve_ISCA_1000 = Curve_ISCA_1000+ISCA_Curve_1000;
  
end

Curve_ISCA_100 = Curve_ISCA_100/cnt_max;
Curve_ISCA_500 = Curve_ISCA_500/cnt_max;
Curve_ISCA_1000 = Curve_ISCA_1000/cnt_max;

std_isca_100 = std(ISCA_Best_score_100);
std_isca_500 = std(ISCA_Best_score_500);
std_isca_1000 = std(ISCA_Best_score_1000);

best_isca_100 = min(ISCA_Best_score_100);
best_isca_500 = min(ISCA_Best_score_500);
best_isca_1000 = min(ISCA_Best_score_1000);

worst_isca_100 = max(ISCA_Best_score_100);
worst_isca_500 = max(ISCA_Best_score_500);
worst_isca_1000 = max(ISCA_Best_score_1000);

mean_isca_100 = mean(ISCA_Best_score_100);
mean_isca_500 = mean(ISCA_Best_score_500);
mean_isca_1000 = mean(ISCA_Best_score_1000);

%% 画图
% % 1、画出所选基准函数的三维立体图形
figure;
func_plot(Function_name);
title(Function_name)
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
img =gcf;  %获取当前画图的句柄
print(img, '-dpng', '-r600', './运行结果.png')         %即可得到对应格式和期望dpi的图像
% 2、画出目标函数值变化曲线图
figure;
t = 1:Max_iteration;
semilogy(t, Curve_ISCA_100, 'bo-', t, Curve_ISCA_500, 'ms-', t, Curve_ISCA_1000, 'rd-',...
'linewidth', 1.5, 'markersize', 8, 'MarkerIndices', 1:50:Max_iteration);
title(Function_name)
xlabel('迭代次数');
ylabel('平均值');
axis tight
grid on
box on
legend('D=100', 'D=500', 'D=1000');
img =gcf;  %获取当前画图的句柄
print(img, '-dpng', '-r600', './运行结果2.png')         %即可得到对应格式和期望dpi的图像

3 仿真结果

4 参考文献

[1]徐松金, & 龙文. (2018). 求解高维优化问题的改进正弦余弦算法. 计算机应用研究, 35(09), 20-23.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Matlab科研辅导帮

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

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

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

打赏作者

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

抵扣说明:

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

余额充值