【单目标优化求解】基于matlab混沌算法求解单目标问题【含Matlab源码 1410期】

举报
海神之光 发表于 2022/05/29 01:27:23 2022/05/29
【摘要】 一、获取代码方式 获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。 获取代码方式2: 完整代码已上传我的资源:【单目标优化求解】基于matlab混沌算法求解单目标问...

一、获取代码方式

获取代码方式1:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。

获取代码方式2:
完整代码已上传我的资源:【单目标优化求解】基于matlab混沌算法求解单目标问题【含Matlab源码 1410期】

备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);

二、部分源代码


clear all
close all
clc

N = 50;                              % Number of Searcher Agents "
Max_Iteration  = 100;                % Maximum number of "iterations"
Q=1;            % ACO Parameter
tau0=10;        % Initial Phromone             (ACO)
alpha=0.3;      % Phromone Exponential Weight  (ACO)
rho=0.1;        % Evaporation Rate             (ACO)
beta_min=0.2;   % Lower Bound of Scaling Factor (DE)
beta_max=0.8;   % Upper Bound of Scaling Factor (DE)
pCR=0.2;        % Crossover Probability         (DE)
 ElitistCheck=1; % GSA Parameter
 Rpower=1;       % GSA Parameter
 min_flag=1; % 1: minimization, 0: maximization (GSA)
 Algorithm_num=2;  %% These are 10 chaotic maps mentioned in the paper. So, change the value of Algorithm_num from 2 to 11 as 1 is for standard GSA.
 chValueInitial=20; % CGSA

 Benchmark_Function_ID=1 %Benchmark function ID

    RunNo  = 20; 
    
for k = [ 1 : 1 : RunNo ]   
% % %   
[gBestScore,gBest,GlobalBestCost]= CPSOGSA(Benchmark_Function_ID, N, Max_Iteration);
BestSolutions1(k) = gBestScore;
% [Fbest,Lbest,BestChart]=GSA(Benchmark_Function_ID,N,Max_Iteration,ElitistCheck,min_flag,Rpower);
% BestSolutions2(k) = Fbest;
%   [PcgCurve,GBEST]=pso(Benchmark_Function_ID,N,Max_Iteration);
%      BestSolutions3(k) = GBEST.O;
%  [BestCost,BestSol] = bbo( Benchmark_Function_ID, N, Max_Iteration);
%      BestSolutions4(k) = BestSol.Cost;
% [BestSolDE,DBestSol,BestCostDE] = DE(Benchmark_Function_ID, N, Max_Iteration,beta_min,beta_max,pCR);
% BestSolutions5(k) = BestSolDE.Cost ;
%   [BestSolACO,BestAnt,BestCostACO] = ACO(Benchmark_Function_ID, N, Max_Iteration,Q,tau0,alpha,rho);
% BestSolutions6(k) = BestSolACO.Cost ;
% [Best_score,Best_pos,SSA_cg_curve]=SSA(Benchmark_Function_ID, N, Max_Iteration);
% BestSolutions7(k) = Best_score ;
% [Best_scoreSCA,Best_pos,SCA_cg_curve]=SCA(Benchmark_Function_ID, N, Max_Iteration);
% BestSolutions8(k) = Best_scoreSCA ;
% [Best_scoreGWO,Best_pos,GWO_cg_curve]=GWO(Benchmark_Function_ID, N, Max_Iteration);
% BestSolutions9(k) = Best_scoreGWO ;

%  if Algorithm_num==6
%     [CFbest,CLbest1,CBestChart]=CGSA(Benchmark_Function_ID,N,Max_Iteration,ElitistCheck,min_flag,Rpower,Algorithm_num,chValueInitial);
%     BestSolutions10(k) = CFbest ;
%  end
 
    Average= mean(BestSolutions1);
    StandDP=std(BestSolutions1);
    Med = median(BestSolutions1); 
    [BestValueP I] = min(BestSolutions1);
    [WorstValueP IM]=max(BestSolutions1);

     disp(['Run # ' , num2str(k), ' gBestScore:  ' , num2str( gBestScore)]);
%      disp(['Run # ' , num2str(k), ' Fbest:  ' , num2str( Fbest)]);
%      disp(['Run # ' , num2str(k), ' GBEST.O: ' , num2str( GBEST.O)]);
%      disp(['Run # ' , num2str(k), ' BestSol.Cost:  ' , num2str( BestSol.Cost)]);
%      disp(['Run # ' , num2str(k), ' BestSolDE.Cost :  ' , num2str( BestSolDE.Cost)]);
%      disp(['Run # ' , num2str(k), ' BestSolACO.Cost:  ' , num2str( BestSolACO.Cost )]);
%      disp(['Run # ' , num2str(k), ' Best_score :  ' , num2str( Best_score)]);
%      disp(['Run # ' , num2str(k), ' Best_scoreSCA :  ' , num2str( Best_scoreSCA)]);
%      disp(['Run # ' , num2str(k), ' Best_scoreGWO :  ' , num2str( Best_scoreGWO)]);      
%      disp(['Run # ' , num2str(k), ' CFbest :  ' , num2str( CFbest ),' Algorithm_num= ' , num2str(Algorithm_num)])
end




     disp([ 'Best=',num2str( BestValueP)]);
     disp(['Worst=',num2str(WorstValueP)]);
     disp(['Average=',num2str( Average)]);
     disp([ 'Standard Deviation=',num2str( StandDP)]);
     disp(['Median=',num2str(Med)]);



    figure
    
   semilogy(1:Max_Iteration,GlobalBestCost,'DisplayName','CPSOGSA', 'Color', 'r','Marker','diamond','LineStyle','-','LineWidth',2,...
       'MarkerEdgeColor','r','MarkerFaceColor',[.49 1 .63],'MarkerSize',2);
%    hold on
%    semilogy(1:Max_Iteration,BestChart,'DisplayName','GSA','Color','g','Marker','o','LineStyle','-','LineWidth',2,...
%         'MarkerEdgeColor','g','MarkerFaceColor',[.49 1 .63],'MarkerSize',2);
%    semilogy(1:Max_Iteration,PcgCurve,'DisplayName','PSO','Color','c','Marker','square','LineStyle','-','LineWidth',2,...
%        'MarkerEdgeColor','c','MarkerFaceColor',[.49 1 .63],'MarkerSize',2);
%    semilogy(1:Max_Iteration,BestCost,'DisplayName','BBO','Color','b','Marker','*','LineStyle','-','LineWidth',2,...
%        'MarkerEdgeColor','b','MarkerFaceColor',[.49 1 .63],'MarkerSize',2);
%    semilogy(1:Max_Iteration,BestCostDE,'DisplayName','DE','Color','y','Marker','+','LineStyle','-','LineWidth',2,...
%        'MarkerEdgeColor','y','MarkerFaceColor',[.49 1 .63],'MarkerSize',2);
%    semilogy(1:Max_Iteration,BestCostACO,'DisplayName','ACO','Color','m','LineStyle','-','LineWidth',2);
%    semilogy(1:Max_Iteration,SSA_cg_curve,'DisplayName','SSA','Color','c','LineStyle','-','LineWidth',2);
%    semilogy(1:Max_Iteration,SCA_cg_curve,'DisplayName','SCA','Color','b','LineStyle','--','LineWidth',2);
%    semilogy(1:Max_Iteration,GWO_cg_curve,'DisplayName','GWO','Color','r','LineStyle','--','LineWidth',2);
%    semilogy(1:Max_Iteration,CBestChart,'DisplayName','CGSA','Color','m','LineStyle',':','LineWidth',2);
    
    

title ('\fontsize{15}\bf Welded Beam Design');
% title ('\fontsize{15}\bf Compression Spring Design');
% title ('\fontsize{15}\bf Pressure Vessel Design');

 xlabel('\fontsize{15}\bf Iteration');
 ylabel('\fontsize{15}\bf Fitness(Best-so-far)');
 legend('\fontsize{12}\bf CPSOGSA');
 
%  legend('\fontsize{12}\bf CPSOGSA','\fontsize{12}\bf GSA','\fontsize{12}\bf PSO','\fontsize{12}\bf BBO',...
%     '\fontsize{12}\bf DE','\fontsize{12}\bf ACO','\fontsize{12}\bf GWO','\fontsize{12}\bf SCA','\fontsize{12}\bf SSA','\fontsize{12}\bf CGSA',1);

    


  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113

三、运行结果

在这里插入图片描述

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
《智能优化算法及其MATLAB实例(第2版)》包子阳 余继周 杨杉著 电子工业出版社

文章来源: qq912100926.blog.csdn.net,作者:海神之光,版权归原作者所有,如需转载,请联系作者。

原文链接:qq912100926.blog.csdn.net/article/details/120858477

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。