【优化算法】正弦余弦算法(SCA):SCA: A Sine Cosine Algorithm

论文题目:SCA is a novel algorithm for solving single-objective optimization problems

这个算法是澳大利亚学者Mirjalili提出的。这个人在这类优化算法中真的是很厉害,像鲸鱼优化算法,多元宇宙算法,包括这个正弦余弦算法,都是他提出的。给我的感觉就是,这类算法大部分在寻优的时候,分为两部分,也就是局部挖掘和全局搜索。这两个部分相互促进又相互矛盾,全局搜索用于快速定位最优解的范围,而局部挖掘用于寻找最优解,这两者必须达到一种动态平衡的状态。全局搜索过多的时候,运行会特别慢,尤其是用MATLAB这种不擅长循环的软件;局部挖掘过多的时候,就容易陷入局部最优解,当然实际工程里,全局最优解可能真的不容易找到,尤其在一些非凸问题里,局部最优解也凑合。

引用格式:

Seyedali Mirjalili (2022). SCA: A Sine Cosine Algorithm (https://www.mathworks.com/matlabcentral/fileexchange/54948-sca-a-sine-cosine-algorithm), MATLAB Central File Exchange. 检索来源 2022/7/28.

少废话,直接上算法源码

%  Sine Cosine Algorithm (SCA)
%
%  Source codes demo version 1.0
%
%  Developed in MATLAB R2011b(7.13)
%
%  Author and programmer: Seyedali Mirjalili
%
%         e-Mail: ali.mirjalili@gmail.com
%                 seyedali.mirjalili@griffithuni.edu.au
%
%       Homepage: http://www.alimirjalili.com
%
%  Main paper:
%  S. Mirjalili, SCA: A Sine Cosine Algorithm for solving optimization problems
%  Knowledge-Based Systems, DOI: http://dx.doi.org/10.1016/j.knosys.2015.12.022
%_______________________________________________________________________________________________
% 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)
%______________________________________________________________________________________________function [Destination_fitness,Destination_position,Convergence_curve]=SCA(N,Max_iteration,lb,ub,dim,fobj)display('SCA is optimizing your problem');%Initialize the set of random solutions
X=initialization(N,dim,ub,lb);Destination_position=zeros(1,dim);
Destination_fitness=inf;Convergence_curve=zeros(1,Max_iteration);
Objective_values = zeros(1,size(X,1));% Calculate the fitness of the first set and find the best one
for i=1:size(X,1)Objective_values(1,i)=fobj(X(i,:));if i==1Destination_position=X(i,:);Destination_fitness=Objective_values(1,i);elseif Objective_values(1,i)<Destination_fitnessDestination_position=X(i,:);Destination_fitness=Objective_values(1,i);endAll_objective_values(1,i)=Objective_values(1,i);
end%Main loop
t=2; % start from the second iteration since the first iteration was dedicated to calculating the fitness
while t<=Max_iteration% Eq. (3.4)a = 2;Max_iteration = Max_iteration;r1=a-t*((a)/Max_iteration); % r1 decreases linearly from a to 0% Update the position of solutions with respect to destinationfor i=1:size(X,1) % in i-th solutionfor j=1:size(X,2) % in j-th dimension% Update r2, r3, and r4 for Eq. (3.3)r2=(2*pi)*rand();r3=2*rand;r4=rand();% Eq. (3.3)if r4<0.5% Eq. (3.1)X(i,j)= X(i,j)+(r1*sin(r2)*abs(r3*Destination_position(j)-X(i,j)));else% Eq. (3.2)X(i,j)= X(i,j)+(r1*cos(r2)*abs(r3*Destination_position(j)-X(i,j)));endendendfor i=1:size(X,1)% Check if solutions go outside the search spaceand bring them backFlag4ub=X(i,:)>ub;Flag4lb=X(i,:)<lb;X(i,:)=(X(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;% Calculate the objective valuesObjective_values(1,i)=fobj(X(i,:));% Update the destination if there is a better solutionif Objective_values(1,i)<Destination_fitnessDestination_position=X(i,:);Destination_fitness=Objective_values(1,i);endendConvergence_curve(t)=Destination_fitness;% Display the iteration and best optimum obtained so farif mod(t,50)==0display(['At iteration ', num2str(t), ' the optimum is ', num2str(Destination_fitness)]);end% Increase the iteration countert=t+1;
end

The SCA creates multiple initial random candidate solutions and requires them to fluctuate outwards or towards the best solution using a mathematical model based on sine and cosine functions. Several random and adaptive variables also are integrated to this algorithm to emphasize exploration and exploitation of the search space in different milestones of optimization.
This is the source codes of the paper:

S. Mirjalili, SCA: A Sine Cosine Algorithm for solving optimization problems, Knowledge-Based Systems, in press, 2015, DOI: Redirecting

Link: http://www.sciencedirect.com/science/article/pii/S0950705115005043

A Matlab toolbox for this algorithm can be found here: Sine Cosine Algorithm Toolbox - File Exchange - MATLAB Central

If you have no access to the paper, please drop me an email at ali.mirjalili@gmail.com and I will send you the paper.

All of the source codes and extra information as well as more optimization techniques can be found in my personal website at http://www.alimirjalili.com

I have a number of relevant courses in this area. You can enrol via the following links with 95% discount:

*******************************************************************************************************************************************
A course on “Optimization Problems and Algorithms: how to understand, formulation, and solve optimization problems”:
https://www.udemy.com/optimisation/?couponCode=MATHWORKSREF

A course on “Introduction to Genetic Algorithms: Theory and Applications”
https://www.udemy.com/geneticalgorithm/?couponCode=MATHWORKSREF
*******************************************************************************************************************************************

(SCA)正弦余弦算法SCA: A Sine Cosine Algorithm(代码可复制粘贴)相关推荐

  1. SCA: A Sine Cosine Algorithm for solving optimization problems

    文章目录 摘要 1. 介绍 2. 相关的工作 2.1 初步和定义 2.2 文献综述 2.3 工作动机 3. 正弦余弦算法(SCA) 4. 结果与讨论 5. 翼型设计使用SCA 6. 结论 论文题目: ...

  2. 基于改进正弦余弦算法的函数寻优算法

    文章目录 一.理论基础 1.基本正弦余弦算法 2.改进正弦余弦算法 (1)基于双曲正弦调节因子和动态余弦波权重的位置更新 (2)基于拉普拉斯分布和高斯分布的动态混合变异 二.算法流程图 三.仿真实验与 ...

  3. 求解高维优化问题的改进正弦余弦算法

    文章目录 一.理论基础 1.正弦余弦算法 2.改进的正弦余弦算法 (1)反向学习初始化 (2)修改个体位置更新方程 (3)算法步骤 二.仿真实验与结果分析 1.测试函数 2.实验结果 (1)和原始SC ...

  4. 【智能优化算法-正弦余弦算法】基于反向正弦余弦算法求解高维优化问题附matlab代码

    1 内容介绍 提出一种改进的正弦余弦算法(简记为ISCA).受粒子群优化(PSO)算法的启发,引入惯性权重以提高正弦余弦算法的收敛精度和加快收敛速度.此外,采取反向学习策略产生初始个体以提高种群的多样 ...

  5. 基于采蜜机制的正弦余弦算法

    文章目录 一.理论基础 1.标准正弦余弦算法 2.基于采蜜机制的正弦余弦算法 (1)每个个体采用相同的参数r1r_1r1​.r2r_2r2​.r3r_3r3​和r4r_4r4​ (2)按幂递减函数自适 ...

  6. MATLAB算法实战应用案例精讲-【智能优化算法】 正弦余弦算法(SCA)(附MATLAB和Python代码实现)

    目录 前言 算法原理 数学模型 算法思想 算法步骤

  7. 【PID优化】基于正余弦算法 (SCA)优化PID实现微型机器人系统位置控制附simulink模型和matlab代码

    ​✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.

  8. 自学习策略和Levy飞行的正弦余弦优化算法-附代码

    自学习策略和Levy飞行的正弦余弦优化算法 文章目录 自学习策略和Levy飞行的正弦余弦优化算法 1.正余弦算法 2. 改进的正弦余弦优化算法 2.1 自学习策略 2.2 停滞扰动策略 3.实验结果 ...

  9. 混合正弦余弦算法和Lévy飞行的麻雀算法

    文章目录 一.理论基础 1.基本麻雀搜索算法 2.混合正弦余弦算法和Lévy飞行的麻雀算法(ISSA) (1)融合正弦余弦算法(SCA)思想 (2)Lévy飞行策略 二.ISSA算法流程图 三.算法性 ...

最新文章

  1. perl:cpanm安装方式的一种取代方法
  2. 在docker中安装RabbitMQ
  3. 用TensorFlow基于神经网络实现井字棋(含代码)
  4. Interview:算法岗位面试—10.17早上—上海某科技公司算法岗位(偏算法,独角兽)非技术面试之比赛项目讲解和项目意义的探讨
  5. 在hive中对日期数据进行处理,毫秒级时间转化为yyyy-MM-dd格式
  6. 微信企业号第三方应用开发[二]——创建应用
  7. 出栈是如何操作的?指令:POP dest dest为16位操作数
  8. 自动化测试常用python库_Python自动化测试常用库
  9. 使用VMware虚拟机安装Windows XP系统
  10. 人脸检测(十)--强分类器源码分析
  11. iOS国际化(本地化)详解
  12. 数字时代的保险创新与升级 | 创新场景50
  13. 影片:天空上尉与明日世界
  14. csdn博客文章头部自动生成目录
  15. 前端职业规划 - 写给年轻的前端韭菜们
  16. 电主轴编码器测试工具VS sensorikHCU500/DCMU-BOX,海德汉PWM21/PWT101,LENORD+BAUER(L+B)211BSO/211CS04E2M使用对比
  17. ABP理论学习之数据过滤器
  18. HYPEREAL带来突破性的深度感知摄像头,在虚拟世界睁开真实之眼
  19. k线符号图解大全_股市k线图各种符号意义?k线符号图解大全!
  20. [玩转UE4/UE5动画系统>Control Rig篇] 之 Control Rig + Fullbody IK版的足部IK实现(附项目代码)

热门文章

  1. 银行精准营销的概念讲解
  2. 学生DW网页设计作业成品 HTML+CSS+JS大作业——汽车设备营销企业模板(13页) 静态HTML网页设计模板
  3. pdf转换成excel转换器怎么用
  4. Cloud Studio
  5. 微信开发者工具跨域问题
  6. Anylogic轨道库入门
  7. html网页设计期末大作业——酒庄网页设计实例(5页)
  8. 用Grads画等值线(二)------.map生成
  9. Windows的批处理脚本
  10. 2019年高教社杯全国大学生数学建模竞赛题目 E题 “薄利多销”分析