【FNN预测】基于蝙蝠优化的模糊神经网络FNN研究附Matlab代码

2023-10-21 07:59

本文主要是介绍【FNN预测】基于蝙蝠优化的模糊神经网络FNN研究附Matlab代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信       无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机 

⛄ 内容介绍

耙吸挖泥船的耙头产量主要取决于耙头的吸入密度,准确的吸入密度预测对提高耙吸挖泥船疏浚产量具有重要的意义.针对目前对吸入密度预测方法存在精度低,实时效果性差的缺点,提出了一种蝙蝠算法与模糊神经网络相结合的预测方法.通过实测施工数据,构建BA-FNN预测模型.实验表明:BA-FNN预测精度高且稳定性能好,能够为耙头产量预测以及指导施工提供科学有效的参考依据.

⛄ 部分代码

% ======================================================== % 

% Files of the Matlab programs included in the book:       %

% Xin-She Yang, Nature-Inspired Metaheuristic Algorithms,  %

% Second Edition, Luniver Press, (2010).   www.luniver.com %

% ======================================================== %    

% -------------------------------------------------------- %

% Bat-inspired algorithm for continuous optimization (demo)%

% Programmed by Xin-She Yang @Cambridge University 2010    %

% -------------------------------------------------------- %

% Usage: bat_algorithm([20 1000 0.5 0.5]);                 %

% -------------------------------------------------------------------

% This is a simple demo version only implemented the basic          %

% idea of the bat algorithm without fine-tuning(微调)the parameters,     % 

% Then, though this demo works very well, it is expected that       %

% this demo is much less efficient than the work reported in        % 

% the following papers:                                             %

% (Citation details):                                               %

% 1) Yang X.-S., A new metaheuristic bat-inspired algorithm,        %

%    in: Nature Inspired Cooperative Strategies for Optimization    %

%    (NISCO 2010) (Eds. J. R. Gonzalez et al.), Studies in          %

%    Computational Intelligence, Springer, vol. 284, 65-74 (2010).  %

% 2) Yang X.-S., Nature-Inspired Metaheuristic Algorithms,          %

%    Second Edition, Luniver Presss, Frome, UK. (2010).             %

% 3) Yang X.-S. and Gandomi A. H., Bat algorithm: A novel           %

%    approach for global engineering optimization,                  %

%    Engineering Computations, Vol. 29, No. 5, pp. 464-483 (2012).  %

% -------------------------------------------------------------------

% Main programs starts here

function [best,fmin,N_iter]=bat_algorithm(para)

% Display help

 help bat_algorithm.m

% Default parameters 默认参数

if nargin<1,  para=[20 1000 0.5 0.5];  end

n=para(1);      % Population size, typically10 to 40

N_gen=para(2);  % Number of generations

A=para(3);      % Loudness  (constant or decreasing)

r=para(4);      % Pulse rate (constant or decreasing)

% This frequency range determines the scalings

% You should change these values if necessary

Qmin=0;         % Frequency minimum

Qmax=2;         % Frequency maximum

% Iteration parameters

N_iter=0;       % Total number of function evaluations  %这是什么意思???

% Dimension of the search variables

d=10;           % Number of dimensions 

% Lower limit/bounds/ a vector

Lb=-2*ones(1,d);

% Upper limit/bounds/ a vector

Ub=2*ones(1,d);   

% Initializing arrays

Q=zeros(n,1);   % Frequency

v=zeros(n,d);   % Velocities

% Initialize the population/solutions

for i=1:n,

  Sol(i,:)=Lb+(Ub-Lb).*rand(1,d);

  Fitness(i)=Fun(Sol(i,:));

end

% Find the initial best solution

[fmin,I]=min(Fitness);   %返回多个参数的时候用[ ],fmin接受第一个参数,I接受第二个参数

%这里fmin是最小值,I是最小值的索引,也就是第几个

best=Sol(I,:);

% ======================================================  %

% Note: As this is a demo, here we did not implement the  %

% reduction of loudness and increase of emission rates.   %

% Interested readers can do some parametric studies       %

% and also implementation various changes of A and r etc  %

% ======================================================  %

% Start the iterations -- Bat Algorithm (essential part)  %

for t=1:N_gen, 

% Loop over all bats/solutions

        for i=1:n,

          Q(i)=Qmin+(Qmin-Qmax)*rand;%其中rand产生一个0到1的随机数

          v(i,:)=v(i,:)+(Sol(i,:)-best)*Q(i);

          S(i,:)=Sol(i,:)+v(i,:);

          % Apply simple bounds/limits

          Sol(i,:)=simplebounds(Sol(i,:),Lb,Ub);

          % Pulse rate

          if rand>r

          % The factor 0.001 limits the step sizes of random walks 

              S(i,:)=best+0.001*randn(1,d);

          end

     % Evaluate new solutions

           Fnew=Fun(S(i,:));

     % Update if the solution improves, or not too loud

           if (Fnew<=Fitness(i)) & (rand<A) ,

                Sol(i,:)=S(i,:);

                Fitness(i)=Fnew;

           end

          % Update the current best solution

          if Fnew<=fmin,

                best=S(i,:);

                fmin=Fnew;

          end

        end

        N_iter=N_iter+n;

         

end

% Output/display

disp(['Number of evaluations: ',num2str(N_iter)]);

disp(['Best =',num2str(best),' fmin=',num2str(fmin)]);

% Application of simple limits/bounds

function s=simplebounds(s,Lb,Ub)

  % Apply the lower bound vector

  ns_tmp=s;

  I=ns_tmp<Lb;

  ns_tmp(I)=Lb(I);

  

  % Apply the upper bound vector 

  J=ns_tmp>Ub;

  ns_tmp(J)=Ub(J);

  % Update this new move 

  s=ns_tmp;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Objective function: your own objective function can be written here

% Note: When you use your own function, please remember to 

%       change limits/bounds Lb and Ub (see lines 52 to 55) 

%       and the number of dimension d (see line 51). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function z=Fun(u)

% Sphere function with fmin=0 at (0,0,...,0)

z=sum(u.^2);

%%%%% ============ end ====================================

⛄ 运行结果

⛄ 参考文献

[1]张容, 阎红, 杜丽萍. 基于模糊神经网络(FNN)的赤潮预警预测研究[J]. 海洋通报:英文版, 2006, 25(001):83-91.

[2]赵建强, 陈必科, 葛考, et al. 基于FOA—FNN算法的边坡稳定性评价研究[C]// 中国系统工程学会第十八届学术年会. 2014.

[3]郝光杰, 俞孟蕻, and 苏贞. "基于蝙蝠算法优化模糊神经网络的耙吸挖泥船耙头吸入密度研究." 计算机与数字工程 002(2022):050.

⛳️ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除

❤️ 关注我领取海量matlab电子书和数学建模资料

这篇关于【FNN预测】基于蝙蝠优化的模糊神经网络FNN研究附Matlab代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/253022

相关文章

使用Python和PaddleOCR实现图文识别的代码和步骤

《使用Python和PaddleOCR实现图文识别的代码和步骤》在当今数字化时代,图文识别技术的应用越来越广泛,如文档数字化、信息提取等,PaddleOCR是百度开源的一款强大的OCR工具包,它集成了... 目录一、引言二、环境准备2.1 安装 python2.2 安装 PaddlePaddle2.3 安装

SpringBoot中四种AOP实战应用场景及代码实现

《SpringBoot中四种AOP实战应用场景及代码实现》面向切面编程(AOP)是Spring框架的核心功能之一,它通过预编译和运行期动态代理实现程序功能的统一维护,在SpringBoot应用中,AO... 目录引言场景一:日志记录与性能监控业务需求实现方案使用示例扩展:MDC实现请求跟踪场景二:权限控制与

MyBatis模糊查询报错:ParserException: not supported.pos 问题解决

《MyBatis模糊查询报错:ParserException:notsupported.pos问题解决》本文主要介绍了MyBatis模糊查询报错:ParserException:notsuppo... 目录问题描述问题根源错误SQL解析逻辑深层原因分析三种解决方案方案一:使用CONCAT函数(推荐)方案二:

利用Python调试串口的示例代码

《利用Python调试串口的示例代码》在嵌入式开发、物联网设备调试过程中,串口通信是最基础的调试手段本文将带你用Python+ttkbootstrap打造一款高颜值、多功能的串口调试助手,需要的可以了... 目录概述:为什么需要专业的串口调试工具项目架构设计1.1 技术栈选型1.2 关键类说明1.3 线程模

Python Transformers库(NLP处理库)案例代码讲解

《PythonTransformers库(NLP处理库)案例代码讲解》本文介绍transformers库的全面讲解,包含基础知识、高级用法、案例代码及学习路径,内容经过组织,适合不同阶段的学习者,对... 目录一、基础知识1. Transformers 库简介2. 安装与环境配置3. 快速上手示例二、核心模

Java的栈与队列实现代码解析

《Java的栈与队列实现代码解析》栈是常见的线性数据结构,栈的特点是以先进后出的形式,后进先出,先进后出,分为栈底和栈顶,栈应用于内存的分配,表达式求值,存储临时的数据和方法的调用等,本文给大家介绍J... 目录栈的概念(Stack)栈的实现代码队列(Queue)模拟实现队列(双链表实现)循环队列(循环数组

MySQL索引的优化之LIKE模糊查询功能实现

《MySQL索引的优化之LIKE模糊查询功能实现》:本文主要介绍MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一、前缀匹配优化二、后缀匹配优化三、中间匹配优化四、覆盖索引优化五、减少查询范围六、避免通配符开头七、使用外部搜索引擎八、分

使用Java将DOCX文档解析为Markdown文档的代码实现

《使用Java将DOCX文档解析为Markdown文档的代码实现》在现代文档处理中,Markdown(MD)因其简洁的语法和良好的可读性,逐渐成为开发者、技术写作者和内容创作者的首选格式,然而,许多文... 目录引言1. 工具和库介绍2. 安装依赖库3. 使用Apache POI解析DOCX文档4. 将解析

C++使用printf语句实现进制转换的示例代码

《C++使用printf语句实现进制转换的示例代码》在C语言中,printf函数可以直接实现部分进制转换功能,通过格式说明符(formatspecifier)快速输出不同进制的数值,下面给大家分享C+... 目录一、printf 原生支持的进制转换1. 十进制、八进制、十六进制转换2. 显示进制前缀3. 指

使用Python实现全能手机虚拟键盘的示例代码

《使用Python实现全能手机虚拟键盘的示例代码》在数字化办公时代,你是否遇到过这样的场景:会议室投影电脑突然键盘失灵、躺在沙发上想远程控制书房电脑、或者需要给长辈远程协助操作?今天我要分享的Pyth... 目录一、项目概述:不止于键盘的远程控制方案1.1 创新价值1.2 技术栈全景二、需求实现步骤一、需求