【优化算法】黑洞模拟算法(MVO)matlab源码
一、简介
多元宇宙优化算法(Multi-Verse Optimizer,MVO)是Seyedali Mirjalili等于2016年提出的一种新型智能优化算法[1]。它基于宇宙中的物质通过虫洞由白洞向黑洞进行转移的原理进行模拟。在MVO算法中,主要的性能参数是虫洞存在概率和虫洞旅行距离率,参数相对较少,低维度数值实验表现出了相对较优异的性能。
1 算法原理
该算法主要借助宇宙在随机创建过程中高膨胀率物体总是趋于低膨胀率的物体,这种万有引力作用可以使物体转移,借助相关宇宙学规则,可以在搜索空间逐渐趋于最优位置.遍历过程主要分为探索和开采过程,虫洞可以作为转移物体的媒介,通过白洞和黑洞交互作用进行搜索空间探测,本文算法具体操作如下:
2 算法流程图
二、源代码
%_______________________________________________________________________________________%
% Multi-Verse Optimizer (MVO) source codes demo version 1.0 %
% %
% Developed in MATLAB R2011b(7.13) %
% %
% Author and programmer: Seyedali Mirjalili %
% %
% e-Mail: ali.mirjalili@gmail.com %
% seyedali.mirjalili@griffithuni.edu.au %
% %
% Homepage: http://www.alimirjalili.com %
% %
% Main paper: %
% %
% S. Mirjalili, S. M. Mirjalili, A. Hatamlou %
% Multi-Verse Optimizer: a nature-inspired algorithm for global optimization %
% Neural Computing and Applications, in press,2015, %
% DOI: http://dx.doi.org/10.1007/s00521-015-1870-7 %
% %
%_______________________________________________________________________________________%% 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% To run MVO: [Best_score,Best_pos,cg_curve]=MVO(Universes_no,Max_iteration,lb,ub,dim,fobj)
%__________________________________________clear all
clcUniverses_no=60; %Number of search agents (universes)Function_name='F17'; %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);[Best_score,Best_pos,cg_curve]=MVO(Universes_no,Max_iteration,lb,ub,dim,fobj);figure('Position',[290 206 648 287])%Draw the search space
subplot(1,2,1);
func_plot(Function_name);
title('Test function')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
grid off
shading interp;
light;
lighting phong;
shading interp;%Draw the convergence curve
subplot(1,2,2);
semilogy(cg_curve,'Color','r')
title('Convergence curve')
xlabel('Iteration');
ylabel('Best score obtained so far');axis tight
grid off
box on
legend('MVO')
%_______________________________________________________________________________________%
% Multi-Verse Optimizer (MVO) source codes demo version 1.0 %
% %
% Developed in MATLAB R2011b(7.13) %
% %
% Author and programmer: Seyedali Mirjalili %
% %
% e-Mail: ali.mirjalili@gmail.com %
% seyedali.mirjalili@griffithuni.edu.au %
% %
% Homepage: http://www.alimirjalili.com %
% %
% Main paper: %
% %
% S. Mirjalili, S. M. Mirjalili, A. Hatamlou %
% Multi-Verse Optimizer: a nature-inspired algorithm for global optimization %
% Neural Computing and Applications, in press,2015, %
% DOI: http://dx.doi.org/10.1007/s00521-015-1870-7 %
% %
%_______________________________________________________________________________________%% 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% To run MVO: [Best_score,Best_pos,cg_curve]=MVO(Universes_no,Max_iteration,lb,ub,dim,fobj)
%__________________________________________function [Best_universe_Inflation_rate,Best_universe,Convergence_curve]=MVO(N,Max_time,lb,ub,dim,fobj)%Two variables for saving the position and inflation rate (fitness) of the best universe
Best_universe=zeros(1,dim);
Best_universe_Inflation_rate=inf;%Initialize the positions of universes
Universes=initialization(N,dim,ub,lb);%Minimum and maximum of Wormhole Existence Probability (min and max in
% Eq.(3.3) in the paper
WEP_Max=1;
WEP_Min=0.2;Convergence_curve=zeros(1,Max_time);%Iteration(time) counter
Time=1;%Main loop
while Time<Max_time+1%Eq. (3.3) in the paperWEP=WEP_Min+Time*((WEP_Max-WEP_Min)/Max_time);%Travelling Distance Rate (Formula): Eq. (3.4) in the paperTDR=1-((Time)^(1/6)/(Max_time)^(1/6));%Inflation rates (I) (fitness values)Inflation_rates=zeros(1,size(Universes,1));for i=1:size(Universes,1)%Boundary checking (to bring back the universes inside search% space if they go beyoud the boundariesFlag4ub=Universes(i,:)>ub;Flag4lb=Universes(i,:)<lb;Universes(i,:)=(Universes(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;%Calculate the inflation rate (fitness) of universesInflation_rates(1,i)=fobj(Universes(i,:));%Elitismif Inflation_rates(1,i)<Best_universe_Inflation_rateBest_universe_Inflation_rate=Inflation_rates(1,i);Best_universe=Universes(i,:);endend[sorted_Inflation_rates,sorted_indexes]=sort(Inflation_rates);for newindex=1:NSorted_universes(newindex,:)=Universes(sorted_indexes(newindex),:);end%Normaized inflation rates (NI in Eq. (3.1) in the paper)normalized_sorted_Inflation_rates=normr(sorted_Inflation_rates);Universes(1,:)= Sorted_universes(1,:);%Update the Position of universesfor i=2:size(Universes,1)%Starting from 2 since the firt one is the eliteBack_hole_index=i;for j=1:size(Universes,2)r1=rand();if r1<normalized_sorted_Inflation_rates(i)White_hole_index=RouletteWheelSelection(-sorted_Inflation_rates);% for maximization problem -sorted_Inflation_rates should be written as sorted_Inflation_ratesif White_hole_index==-1White_hole_index=1;end%Eq. (3.1) in the paperUniverses(Back_hole_index,j)=Sorted_universes(White_hole_index,j);end
三、运行结果
【优化算法】黑洞模拟算法(MVO)matlab源码相关推荐
- 【SVM分类】基于matlab哈里斯鹰算法优化支持向量机SVM分类【含Matlab源码 2243期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[SVM分类]基于matlab哈里斯鹰算法优化支持向量机SVM分类[含Matlab源码 2243期] 获取代码方式2: 付费专栏Matla ...
- 【MVO TSP】基于matlab灰狼算法求解旅行商问题【含Matlab源码 1327期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab灰狼算法求解旅行商问题[含Matlab源码 1327期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: ...
- 【图像重建】基于matlab布雷格曼迭代算法集合ART算法CT图像重建【含Matlab源码 1905期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[图像重建]基于matlab布雷格曼迭代算法集合ART算法CT图像重建[含Matlab源码 1905期] 获取代码方式2: 通过订阅紫极神光 ...
- 【AFSA TSP】基于matlab人工鱼群算法求解旅行商问题【含Matlab源码 422期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab人工鱼群算法求解旅行商问题[含Matlab源码 422期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...
- 【BA TSP】基于matlab蜜蜂算法求解旅行商问题【含matlab源码 1248期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab蜜蜂算法求解旅行商问题[含matlab源码 1248期] 获取代码方式2: 付费专栏Matlab路径规划(初级版 ...
- 【IA TSP】基于matlab免疫算法求解旅行商问题【含Matlab源码 195期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[旅行商问题]基于matlab免疫算法求解旅行商问题[含Matlab源码 195期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...
- matlab三维路径规划,【路径规划】基于A星算法的三维路径规划matlab源码
%% 该函数用于演示基于A_Star算法的三维路径规划算法 %% 清空环境 clc clear %% 数据初始化 %下载数据 starttime=cputime; load HeightData z ...
- 【ELM分类】基于matlab遗传算法优化ELM神经网络数据分类【含Matlab源码 2138期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[ELM分类]基于matlab遗传算法优化ELM神经网络数据分类[含Matlab源码 2138期] 点击上面蓝色字体,直接付费下载,即可. ...
- 【数学建模】基于matlab武汉地铁2号线路线地图动态模拟【含Matlab源码 1092期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数学建模]基于matlab武汉地铁2号线路线地图动态模拟[含Matlab源码 1092期] 点击上面蓝色字体,直接付费下载,即可. 获取代 ...
- 【运动学】基于matlab GUI三体运动模拟【含Matlab源码 871期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[运动学]基于matlab GUI三体运动模拟[含Matlab源码 871期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: ...
最新文章
- python getostime_python中sys,os,time模块的使用(包括时间格式的各种转换)
- 路由器学习之静态路由实验
- mysql获取日期的月日_MySQL获取月,日的日期列表
- 两种选择排序算法:简单选择排序、堆排序
- emacs c语言,如何利用Emacs来调试C++程序
- java中大数开方_大数开方(Java版)
- node.js 学习笔记四:读取文件
- [leetcode]_Best Time to Buy and Sell Stock I II
- 扶贫计算机考试试题,计算机基础知识试题1.doc
- 从零开始学习Android开发-Android概览
- MySQL 高可用MMM
- mac显示和隐藏文件命令
- Python自我成长笔记(一)
- 使用sublime构建latex编辑器
- logo制作软件 Ai怎么设计创意LOGO
- 001:这里是一个关于易康分割+分类的记录
- 近红外PbSAg2S量子点(齐岳生物)
- 论文阅读-Training a Helpful and Harmless Assistant withReinforcement Learning from Human Feedback
- IT运维:服务器管理
- 电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)【6节点 9节点 14节点 26节点 30节点 57节点】(Matlab代码实现)