1 简介 2 部分代码 %% Chameleon Swarm Algorithm (CSA) source codes version 1.0 clear close all clc %% % Prepare the problem SearchAgents_no=30; % Number of search agents 种群数量 Function_name='F11'; % Name of the test function tha
1 简介
2 部分代码
%% Chameleon Swarm Algorithm (CSA) source codes version 1.0clear
close all
clc
%% % Prepare the problem
SearchAgents_no=30; % Number of search agents 种群数量
Function_name='F11'; % 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); %设定边界以及优化函数
%% % CSA parameters
noP = 30;
maxIter = 1000;
[bestFitness, bestPosition, CSAConvCurve] =Chameleon(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
figure('Position',[269 240 660 290])
%Draw search space
subplot(1,2,1);
func_plot(Function_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
%Draw objective space
subplot(1,2,2);
semilogy(CSAConvCurve,'Color','g','linewidth',2)
hold on
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
legend('CSA');
axis tight
grid on
box on
3 仿真结果
4 参考文献
[1]姚鹏, 冯超. 基于变色龙算法的工程优化应用[C]// 0.