# 【智能优化算法-圆圈搜索算法】基于圆圈搜索算法Circle Search Algorithm求解单目标优化问题附matlab代码

## 2 仿真代码

%___________________________________________________________________%

%      This is the main program that call all compared algorithms

clear all;

clc; close all;

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=500; % Maximum numbef of iterations

% Load details of the selected benchmark function

[lb,ub,dim,fobj]=Get_Functions_details(Function_name);

Positions=zeros(SearchAgents_no,dim);

%initialize the search agents for all algorithms

for i=1:SearchAgents_no

Positions(i,:)=lb+rand*(ub-lb);

end

[X_c1,X_t1,curve1]=CSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c2,X_t2,curve2]=SCA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c3,X_t3,curve3]=SSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c4,X_t4,curve4]=HHO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c5,X_t5,curve5]=WOA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c6,X_t6,curve6]=PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c7,X_t7,curve7]=TSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c8,X_t8,curve8]=GWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

[X_c9,X_t9,curve9]=CGO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Positions);

semilogy(curve1,'Color','r','LineWidth',2)%CSA

hold on

semilogy(curve8,'Color','b','LineWidth',2)%GWO

semilogy(curve2,'Color','m','LineWidth',2)%SCA

semilogy(curve3,'Color','g','LineWidth',2)%SSA

semilogy(curve4,'Color','y','LineWidth',2)%HHO

semilogy(curve5,'Color','k','LineWidth',2)%WOA

semilogy(curve6,'Color',[0.9290 0.6940 0.1250],'LineWidth',2)%PSO

semilogy(curve7,'Color',[0.4940 0.1840 0.5560],'LineWidth',2)%TSO

semilogy(curve9,'Color','c','LineWidth',2)%CGO

title(Function_name)

xlabel('Iteration','fontsize',12,'FontWeight','bold','FontName','Arial Narrow');

ylabel('Best Fitness','fontsize',12,'FontWeight','bold','FontName','Arial Narrow');

axis tight

grid on

box on

legend('CSA','GWO','SCA','SSA','HHO','WOA','PSO','TSO','CGO','fontsize',12,'FontWeight','bold','FontName','Arial Narrow')

disp(["CSA","   SCA","     SSA","    HHO","    WOA","     PSO","     TSO","     GWO","     CGO"])

output=[X_c1 X_c2 X_c3 X_c4 X_c5 X_c6 X_c7 X_c8 X_c9]

## 5 往期回顾扫扫下方二维码

|
7天前
|

27 5
|
4天前
|

m基于BP译码算法的LDPC编译码matlab误码率仿真,对比不同的码长
MATLAB 2022a仿真实现了LDPC码的性能分析，展示了不同码长对纠错能力的影响。短码长LDPC码收敛快但纠错能力有限，长码长则提供更强纠错能力但易陷入局部最优。核心代码通过循环进行误码率仿真，根据EsN0计算误比特率，并保存不同码长（12-768）的结果数据。
24 9
|
5天前
|

MATLAB|【免费】融合正余弦和柯西变异的麻雀优化算法SCSSA-CNN-BiLSTM双向长短期记忆网络预测模型

22 3
|
7天前
|

11 1
|
7天前
|

m基于遗传优化的LDPC码OMS译码算法最优偏移参数计算和误码率matlab仿真
MATLAB2022a仿真实现了遗传优化的LDPC码OSD译码算法，通过自动搜索最佳偏移参数ΔΔ以提升纠错性能。该算法结合了低密度奇偶校验码和有序统计译码理论，利用遗传算法进行全局优化，避免手动调整，提高译码效率。核心程序包括编码、调制、AWGN信道模拟及软输入软输出译码等步骤，通过仿真曲线展示了不同SNR下的误码率性能。
11 1
|
7天前
|

17 0
|
7天前
|

18 1
|
7天前

44 1
|
7天前
|

29 0
|
7天前
|

20 1