【优化求解-单目标求解】基于黑猩猩算法求解单目标问题matlab源码

一、黑猩猩算法

This article proposes a novel metaheuristic algorithm called Chimp Optimization Algorithm (ChOA) inspired by the individual intelligence and sexual motivation of chimps in their group hunting, which is different from the other social predators. ChOA is designed to further alleviate the two problems of slow convergence speed and trapping in local optima in solving high-dimensional problems. In this article, a mathematical model of diverse intelligence and sexual motivation is proposed. Four types of chimps entitled attacker, barrier, chaser, and driver are employed for simulating the diverse intelligence. Moreover, the four main steps of hunting, driving, blocking, and attacking, are implemented. Afterward, the algorithm is tested on 30 well-known benchmark functions, and the results are compared to four newly proposed meta-heuristic algorithms in term of convergence speed, the probability of getting stuck in local minimums, and the accuracy of obtained results. The results indicate that the ChOA outperforms the other benchmark optimization algorithms.

 

 

 

二、部分代码

%___________________________________________________________________%
% Chimp Optimization Algorithm (ChOA) source codes version 1.0   
% By: M. Khishe, M. R. Musavi
% m_khishe@alumni.iust.ac.ir
%For more information please refer to the following papers:
% M. Khishe, M. R. Mosavi, 揅himp Optimization Algorithm,�Expert Systems
% With Applications, 2020.
% Please note that some files and functions are taken from the GWO algorithm
% such as: Get_Functions_details, PSO,  
%  For more information please refer to the following papers:
% Mirjalili, S., Mirjalili, S. M., & Lewis, A. (2014). Grey Wolf Optimizer. Advances in engineering software, 69, 46-61.            %
%___________________________________________________________________%

% You can simply define your cost 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 generations
% 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 number numbers

%
%__________________________________________

clear all 
clc

SearchAgents_no=30; % Number of search agents
N=SearchAgents_no;
Function_name='F2'; % Name of the test function that can be from F1 to F23 (Table 3,4,5 in the paper)

Max_iteration=500; % Maximum numbef of iterations
Max_iter=Max_iteration;

% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);


[ABest_scoreChimp,ABest_posChimp,Chimp_curve]=Chimp(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
[PSO_gBestScore,PSO_gBest,PSO_cg_curve]=PSO(N,Max_iteration,lb,ub,dim,fobj);
[TACPSO_gBestScore,TACPSO_gBest,TACPSO_cg_curve]=TACPSO(N,Max_iteration,lb,ub,dim,fobj);
[MPSO_gBestScore,MPSO_gBest,MPSO_cg_curve]=MPSO(N,Max_iteration,lb,ub,dim,fobj);

% PSO_cg_curve=PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); % run PSO to compare to results

figure('Position',[500 500 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(MPSO_cg_curve,'Color','g')
hold on
semilogy(PSO_cg_curve,'Color','b')
hold on
semilogy(TACPSO_cg_curve,'Color','y')
hold on
semilogy(Chimp_curve,'--r')


title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');

axis tight
grid on
box on
legend('MPSO','PSO','TACPSO','Chimp')

display(['The best optimal value of the objective funciton found by TACPSO is : ', num2str(TACPSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by PSO is : ', num2str(PSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by PSO is : ', num2str(MPSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by Chimp is : ', num2str(ABest_scoreChimp)]);


        



三、仿真结果 

 四、参考文献

Khishe, M., and M. R. Mosavi. “Chimp Optimization Algorithm.” Expert Systems with Applications, vol. 149, Elsevier BV, July 2020, p. 113338, doi:10.1016/j.eswa.2020.113338.

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Matlab科研辅导帮

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

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

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

打赏作者

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

抵扣说明:

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

余额充值