Gointerface接口声明实现及作用详解
253
2022-09-06
【灰狼算法】基于改进灰狼优化算法求解单目标优化问题附matlab代码
1 简介
1.1 灰狼算法介绍
2 部分代码
%___________________________________________________________________%% An Improved Grey Wolf Optimizer for Solving Engineering %% Problems (I-GWO) source codes version 1.0 %% % %%___________________________________________________________________%% 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% N = 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% To run I-GWO: [Best_score,Best_pos,GWO_cg_curve]=IGWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj)%__________________________________________close allclearclcAlgorithm_Name = 'I-GWO';N = 30; % Number of search agentsFunction_name='F2'; % 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);[Fbest,Lbest,Convergence_curve]=IGWO(dim,N,Max_iteration,lb,ub,fobj);display(['The best solution obtained by I-GWO is : ', num2str(Lbest)]);display(['The best optimal value of the objective funciton found by I-GWO is : ', num2str(Fbest)]);figure('Position',[500 500 660 290])%Draw search spacesubplot(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 spacesubplot(1,2,2);semilogy(Convergence_curve,'Color','r')title('Objective space')xlabel('Iteration');ylabel('Best score obtained so far');axis tightgrid onbox onlegend('I-GWO')
3 仿真结果
4 参考文献
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~