?【优化求解】基于黑洞算法求解最优目标matlab源码
2021/10/24 22:42:52
本文主要是介绍?【优化求解】基于黑洞算法求解最优目标matlab源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1 简介
2 部分代码
clear all clc close all d=5; % dimension options.lk=-32*ones(1,d); % lower bound options.uk=32*ones(1,d); % upper bound options.m=50; % Size of the population options.MAXITER=500; % Maximum number of iterations options.n=length(options.uk); % dimension of the problem. options.ObjFunction=@Ackley; % the name of the objective function options.Display_Flag=1; % Flag for displaying results over iterations options.run_parallel_index=0; options.run=10; if options.run_parallel_index % run_parallel stream = RandStream('mrg32k3a'); parfor index=1:options.run % tic % index set(stream,'Substream',index); RandStream.setGlobalStream(stream) [bestX, bestFitness, bestFitnessEvolution,nEval]=BH_v1(options); bestX_M(index,:)=bestX; Fbest_M(index)=bestFitness; fbest_evolution_M(index,:)=bestFitnessEvolution; end else rng('default') for index=1:options.run [bestX, bestFitness, bestFitnessEvolution,nEval]=BH_v1(options); bestX_M(index,:)=bestX; Fbest_M(index)=bestFitness; fbest_evolution_M(index,:)=bestFitnessEvolution; end end [a,b]=min(Fbest_M); figure plot(1:options.MAXITER,fbest_evolution_M(b,:)) xlabel('Iterations') ylabel('Fitness') img =gcf; %获取当前画图的句柄 print(img, '-dpng', '-r600', './img.png') %即可得到对应格式和期望dpi的图像 fprintf(' MIN=%g MEAN=%g MEDIAN=%g MAX=%g SD=%g \n',... min(Fbest_M),mean(Fbest_M),median(Fbest_M),max(Fbest_M),std(Fbest_M))
`
3 仿真结果
4 参考文献
[1]王通, 高宪文, and 蒋子健. "基于黑洞算法的LSSVM的参数优化." 东北大学学报:自然科学版 35.2(2014):5.
这篇关于?【优化求解】基于黑洞算法求解最优目标matlab源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26结对编程到底难不难?答案在这里
- 2024-06-19《2023版Java工程师》课程升级公告
- 2024-06-15matplotlib作图不显示3D图,怎么办?
- 2024-06-1503-Loki 日志监控
- 2024-06-1504-让LLM理解知识 -Prompt
- 2024-06-05做软件测试需要懂代码吗?
- 2024-06-0514-ShardingSphere的分布式主键实现
- 2024-06-03为什么以及如何要进行架构设计权衡?
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)