正余弦算法(SCA)求解单目标优化问题
Posted 这是一个很随便的名字
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了正余弦算法(SCA)求解单目标优化问题相关的知识,希望对你有一定的参考价值。
【Matlab源码】
正弦余弦算法(SCA)是解决优化问题提供了新的优化技术。SCA 使用基于正弦和余弦函数的数学模型创建多个初始随机候选解决方案,并要求它们向外波动或朝着最佳解决方案波动。该算法还集成了几个随机变量和自适应变量,以强调在优化的不同里程碑中对搜索空间的探索和利用。
SCA 旨在解决单目标优化问题
代码:
% You can simply define your cost function in a seperate file and load its handle to fobj
% The initial parameters that you need are:
%__________________________________________
% fobj = @YourCostFunction
% dim = number of your variables
% Max_iteration = maximum number of iterations
% SearchAgents_no = number of search agents
% lb=[lb1,lb2,...,lbn] where lbn is the lower bound of variable n
% ub=[ub1,ub2,...,ubn] where ubn is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define lb and ub as two single numbers
% To run SCA: [Best_score,Best_pos,cg_curve]=SCA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj)
%______________________________________________________________________________________________
clear all
clc
SearchAgents_no=30; % Number of search agents
Function_name='F1'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper)
Max_iteration=1000; % Maximum numbef of iterations
% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);
[Best_score,Best_pos,cg_curve]=SCA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
figure('Position',[284 214 660 290])
%Draw search space
subplot(1,2,1);
func_plot(Function_name);
title('Test function')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
grid off
%Draw objective space
subplot(1,2,2);
semilogy(cg_curve,'Color','b')
title('Convergence curve')
xlabel('Iteration');
ylabel('Best flame (score) obtained so far');
axis tight
grid off
box on
legend('SCA')
display(['The best solution obtained by SCA is : ', num2str(Best_pos)]);
display(['The best optimal value of the objective funciton found by SCA is : ', num2str(Best_score)]);
运行结果:
以上是关于正余弦算法(SCA)求解单目标优化问题的主要内容,如果未能解决你的问题,请参考以下文章
单目标优化求解基于matlab混合正弦余弦算法和Lévy飞行改进麻雀算法求解单目标优化问题含Matlab源码 1653期
单目标优化求解基于matlab混合正弦余弦算法和Lévy飞行改进麻雀算法求解单目标优化问题含Matlab源码 1653期
优化算法基于matlab cubic混沌初始化结合纵横策略正弦余弦算子的黑猩猩优化算法求解单目标优化问题含Matlab源码 2065期
优化算法基于matlab cubic混沌初始化结合纵横策略正弦余弦算子的黑猩猩优化算法求解单目标优化问题含Matlab源码 2065期