一、获取代码方式

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

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

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

二、生物地理算法简介

1 基本思路
BBO 算法起源于生物地理学,它通过模拟多物种在不同栖息地的分布、迁移、突变等规律求解寻优问题,在多目标规划领域有广泛应用. 栖息地被认为是独立的区域,不同的栖息地拥有不同的适宜指数HSI(Habitat suitability index)。 HSI较高的栖息地物种丰富度较高,随着种群趋于饱和,其迁出率增高,迁入率减少,而HIS较低的栖息地与之相反,迁入率增高,迁出率减少. 当栖息地遭遇灾害或瘟疫等突发事件时,HIS将随之突变,打破动态平衡,为低HIS的栖息地添加了不可预见性,增大了搜索目标解的几率2.2 迁移和突变操作物种的迁移有其具体的物理模型,最常的有线性模型、二次模型、余弦模型等 . 以图 3线性模型为例,当某栖息地物种数目为 0 时迁入率最高,此刻 λ = I,随着迁入物种数目不断增加,受阳光、水、食物等资源限制,迁入率不断降低,迁出率不断增高 . 当栖息地物种数目为 S0时,恰好达到动态平衡,此时迁出率与迁入率相同 . 而栖息地达到饱和状态时,物种数量达到最大值Smax ,此刻不再有物种迁入,迁出率 μ = E.突变操作基于生物地理学统计公式完成:


式中:ms为栖息地发生突变的概率,mmax为最大突变率,用户可自行设定 . ps为栖息地容纳s种物种的概率, pmax代表容纳最大种群的概率。

三、部分源代码

clear all
clcnMonte = 100; % Number of Monte Carlo runs
DisplayFlag = true; % Whether or not to display results during run
GenFlag = true; % whether or not to exit BBO after population becomes uniform
PopSize = 30; % Population sizes for which to run SBBO% Choose the test function% ProblemFunction=@Sphere;
% ProblemFunction=@Ackley;
% ProblemFunction=@Fletcher;
% ProblemFunction=@Griewank;
% ProblemFunction=@Penalty1;
% ProblemFunction=@Penalty2;ProblemFunction=@Quartic;
% ProblemFunction=@Rastrigin;
% ProblemFunction=@Rosenbrock;
% ProblemFunction=@Schwefel;% or you objective function
% ProblemFunction=@YourObjectiveFunction;%Chaotic_map_no=1; %Chebyshev
%Chaotic_map_no=2; %Circle
Chaotic_map_no=3; %Gauss/mouse
%Chaotic_map_no=4; %Iterative
%Chaotic_map_no=5; %Logistic
%Chaotic_map_no=6; %Piecewise
%Chaotic_map_no=7; %Sine
%Chaotic_map_no=8; %Singer
%Chaotic_map_no=9; %Sinusoidal
%Chaotic_map_no=10; %Tent%You can define the number of search agents and iterations in the Init.m file
Max_iterations=10000;% This should be equal or greater than OPTIONS.Maxgen in Init.m fileChaosVec=zeros(10,Max_iterations);
%Calculate chaos vector
for i=1:10ChaosVec(i,:)=chaos(i,Max_iterations,1);
end% BBO algorithm
[cg_curve0] = BBO(ProblemFunction, DisplayFlag, PopSize, GenFlag);% BBO with chaotic selection operator
[cg_curve1] = CBBO1_10(ProblemFunction, DisplayFlag, PopSize, GenFlag,ChaosVec(Chaotic_map_no,:));           % BBO with chaotic migration operator
[cg_curve2] = CBBO11_20(ProblemFunction, DisplayFlag, PopSize, GenFlag,ChaosVec(Chaotic_map_no,:));           % BBO with chaotic mutation operator
[cg_curve3] = CBBO21_30(ProblemFunction, DisplayFlag, PopSize, GenFlag,ChaosVec(Chaotic_map_no,:));           % BBO with chaotic selection/migration operators combined
[cg_curve4] = CBBO31_40(ProblemFunction, DisplayFlag, PopSize, GenFlag,ChaosVec(Chaotic_map_no,:));           % BBO with chaotic selection/migration/mutation operators combined
[cg_curve5] = CBBO41_50(ProblemFunction, DisplayFlag, PopSize, GenFlag,ChaosVec(Chaotic_map_no,:)); semilogy(cg_curve0,'Color','y')
hold on
semilogy(cg_curve1,'Color','k')
semilogy(cg_curve2,'Color','b')
semilogy(cg_curve3,'Color','g')
semilogy(cg_curve4,'Color','r')
semilogy(cg_curve5,'Color','c')xlabel('Iteration');
ylabel('Best score obtained so far');axis tight
grid on
box on
legend('BBO' , ['CBBO' num2str(Chaotic_map_no)] , ['CBBO' num2str(Chaotic_map_no+10)] ,['CBBO' num2str(Chaotic_map_no+20)] ,['CBBO' num2str(Chaotic_map_no+30)] ,['CBBO' num2str(Chaotic_map_no+40)] )function [OPTIONS, MinCost, AvgCost, InitFunction, CostFunction, FeasibleFunction, ...MaxParValue, MinParValue, Population] = Init(DisplayFlag, ProblemFunction, RandSeed)% Initialize population-based optimization software.% WARNING: some of the optimization routines will not work if population size is odd.
OPTIONS.popsize = 30; % total population size
OPTIONS.Maxgen = 499; % generation count limit
OPTIONS.numVar = 30; % number of genes in each population member
OPTIONS.pmutate = 0; % mutation probabilityif ~exist('RandSeed', 'var')RandSeed = round(sum(100*clock));
end
%rand('state', RandSeed); % initialize random number generator
if DisplayFlagdisp(['random # seed = ', num2str(RandSeed)]);
end% Get the addresses of the initialization, cost, and feasibility functions.
[InitFunction, CostFunction, FeasibleFunction] = ProblemFunction();
% Initialize the population.
[MaxParValue, MinParValue, Population, OPTIONS] = InitFunction(OPTIONS);
% Make sure the population does not have duplicates.
Population = ClearDups(Population, MaxParValue, MinParValue);
% Compute cost of each individual
Population = CostFunction(OPTIONS, Population);
% Sort the population from most fit to least fit
Population = PopSort(Population);
% Compute the average cost
AverageCost = ComputeAveCost(Population);
% Display info to screen
MinCost = [Population(1).cost];
AvgCost = [AverageCost];
if DisplayFlagdisp(['The best and mean of Generation # 0 are ', num2str(MinCost(end)), ' and ', num2str(AvgCost(end))]);
endreturn;
function O=chaos(index,max_iter,Value)O=zeros(1,max_iter);
x(1)=0.7;
switch index
%Chebyshev mapcase 1
for i=1:max_iterx(i+1)=cos(i*acos(x(i)));G(i)=((x(i)+1)*Value)/2;
endcase 2
%Circle map
a=0.5;
b=0.2;
for i=1:max_iterx(i+1)=mod(x(i)+b-(a/(2*pi))*sin(2*pi*x(i)),1);G(i)=x(i)*Value;
endcase 3
%Gauss/mouse map
for i=1:max_iterif x(i)==0x(i+1)=0;elsex(i+1)=mod(1/x(i),1);endG(i)=x(i)*Value;
endcase 4
%Iterative map
a=0.7;
for i=1:max_iterx(i+1)=sin((a*pi)/x(i));G(i)=((x(i)+1)*Value)/2;
endcase 5
%Logistic map
a=4;
for i=1:max_iterx(i+1)=a*x(i)*(1-x(i));G(i)=x(i)*Value;
endcase 6
%Piecewise map
P=0.4;
for i=1:max_iterif x(i)>=0 && x(i)<Px(i+1)=x(i)/P;endif x(i)>=P && x(i)<0.5x(i+1)=(x(i)-P)/(0.5-P);endif x(i)>=0.5 && x(i)<1-Px(i+1)=(1-P-x(i))/(0.5-P);endif x(i)>=1-P && x(i)<1x(i+1)=(1-x(i))/P;end    G(i)=x(i)*Value;
endcase 7
%Sine map
for i=1:max_iterx(i+1) = sin(pi*x(i));G(i)=(x(i))*Value;endcase 8%Singer map u=1.07;for i=1:max_iterx(i+1) = u*(7.86*x(i)-23.31*(x(i)^2)+28.75*(x(i)^3)-13.302875*(x(i)^4));G(i)=(x(i))*Value;endcase 9
%Sinusoidal mapfor i=1:max_iterx(i+1) = 2.3*x(i)^2*sin(pi*x(i));G(i)=(x(i))*Value;endcase 10%Tent mapx(1)=0.6;for i=1:max_iterif x(i)<0.7x(i+1)=x(i)/0.7;endif x(i)>=0.7x(i+1)=(10/3)*(1-x(i));endG(i)=(x(i))*Value;endend
O=G;

四、运行结果

五、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.

【单目标优化求解】基于matlab混沌生物地理算法求解单目标问题【含Matlab源码 1411期】相关推荐

  1. 【Matlab图像融合】小波变换遥感图像融合【含GUI源码 744期】

    一.代码运行视频(哔哩哔哩) [Matlab图像融合]小波变换遥感图像融合[含GUI源码 744期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 包子阳,余 ...

  2. 【Matlab人脸识别】KL变换人脸识别【含GUI源码 859期】

    一.代码运行视频(哔哩哔哩) [Matlab人脸识别]KL变换人脸识别[含GUI源码 859期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 蔡利梅.MAT ...

  3. 【Matlab心音信号】EMD心音信号特征提取【含GUI源码 1735期】

    一.代码运行视频(哔哩哔哩) [Matlab心音信号]EMD心音信号特征提取[含GUI源码 1735期] 二.matlab版本及参考文献 1 matlab版本 2014a *2 参考文献 [1] 沈再 ...

  4. 【Matlab图像加密】正交拉丁方置乱算法图像加解密【含GUI源码 182期】

    一.代码运行视频(哔哩哔哩) [Matlab图像加密]正交拉丁方置乱算法图像加解密[含GUI源码 182期] 二.matlab版本及参考文献 一.代码运行视频(哔哩哔哩) [Matlab图像处理]自动 ...

  5. 【Matlab语音隐写】DWT音频数字水印【含GUI源码 712期】

    一.代码运行视频(哔哩哔哩) [Matlab语音隐写]DWT音频数字水印[含GUI源码 712期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]韩纪庆,张磊, ...

  6. 【Matlab通信】DTMF双音多频电话拨号仿真【含GUI源码 805期】

    一.代码运行视频(哔哩哔哩) [Matlab通信]DTMF双音多频电话拨号仿真[含GUI源码 805期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 蔡利梅 ...

  7. 【Matlab生物电信号】生物电信号仿真【含GUI源码 684期】

    一.代码运行视频(哔哩哔哩) [Matlab生物电信号]生物电信号仿真[含GUI源码 684期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]董兵,超于毅,李 ...

  8. 【Matlab验证码识别】遗传算法和最大熵优化+大津法(OTSU)+自定义阈值数字验证码识别【含GUI源码 1694期】

    一.代码运行视频(哔哩哔哩) [Matlab验证码识别]遗传算法和最大熵优化+大津法(OTSU)+自定义阈值数字验证码识别[含GUI源码 1694期] 二.matlab版本及参考文献 1 matlab ...

  9. 【Matlab电力负荷预测】粒子群优化支持向量机短期电力负荷预测【含GUI源码 751期】

    一.代码运行视频(哔哩哔哩) [Matlab电力负荷预测]粒子群优化支持向量机短期电力负荷预测[含GUI源码 751期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 ...

  10. 【Matlab指纹识别】指纹识别门禁系统【含GUI源码 1692期】

    一.代码运行视频(哔哩哔哩) [Matlab指纹识别]指纹识别门禁系统[含GUI源码 1692期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 包子阳,余继 ...

最新文章

  1. 结构成员访问的三种方法
  2. PMP 学习之一:PMP五大过程组十大知识领域47个子过程
  3. linux进程授权,一个linux小程序的免授权或通用授权
  4. 【数据结构与算法】之“寻找两个正序数组的中位数”的求解思路和算法示例
  5. 传输层:IP 地址解析 路由转发
  6. 案例八:shell自动化管理账本脚本
  7. php继承和重载区别,php继承中方法重载(覆盖)的应用场合
  8. 广工计算机组成原理实验报告_计算机组成原理:存储器
  9. 【K210】【MaixPy】二、Maix Dock入门之Timer、PWM基础模块,实现一个变色呼吸灯(效果参考罗技G502)
  10. 异常和中断处理流程: Exception- or Interrupt-Handler Procedures
  11. js实现抽饭系统(类似抽检系统)双按钮控制系统
  12. 微信电脑多开,骚操作走起
  13. Android 实现自定义宽高比的ImageView
  14. OpenCV-Python 中文教程15——OpenCV 中的轮廓
  15. 1083. Windy数
  16. 作业Android自我介绍
  17. php网页地图上自定义,如何添加在线自定义地图
  18. 华为P30震撼来袭!刘海屏+麒麟980+3650mAh,网友直呼:年度机皇呀
  19. 服务器定时发送IP地址到邮箱
  20. windows常用命令及相关命令

热门文章

  1. 项目部署到自己的IIS上
  2. struts2入门第一天----------一个简单例
  3. [html] 回到页首
  4. SQL2008触发器
  5. [转]在Sql Server中将字符串分割成表格数据示例
  6. final关键字多态
  7. WinEdt Latex使用人家提供的模板时无法插入参考文献的方法
  8. fatal error LNK1281: 无法生成 SAFESEH 映像
  9. Atitit Queue consum algo 队列消费算法fifo lifo ro目录1. 队列消费算法 11.1. FIFO 先入先出 11.2. LIFO 后入先出 不能多开 1
  10. Atitit 计算机的组成与设计 目录 1. 计算机系统是由硬件系统和软件系统两大部分组成。  1 1.1. Cpu(alu+cu ) 1 1.2. 存储内存 外村 1 1.3. Io设备 鼠标