【优化求解】基于GUI界面之BP神经网络优化求解【Matlab 179期】

一、简介

BP网络(Back Propagation),是1986年由Rumelhart和McCelland为首的科学家小组提出,是一种按误差逆传播算法训练的多层前馈网络,是目前应用最广泛的神经网络模型之一。BP网络能学习和存贮大量的输入-输出模式映射关系,而无需事前揭示描述这种映射关系的数学方程。
在人工神经网络发展历史中,很长一段时间里没有找到隐层的连接权值调整问题的有效算法。直到误差反向传播算法(BP算法)的提出,成功地解决了求解非线性连续函数的多层前馈神经网络权重调整问题。

BP (Back Propagation)神经网络,即误差反传误差反向传播算法的学习过程,由信息的正向传播和误差的反向传播两个过程组成。输入层各神经元负责接收来自外界的输入信息,并传递给中间层各神经元;中间层是内部信息处理层,负责信息变换,根据信息变化能力的需求,中间层可以设计为单隐层或者多隐层结构;最后一个隐层传递到输出层各神经元的信息,经进一步处理后,完成一次学习的正向传播处理过程,由输出层向外界输出信息处理结果。当实际输出与期望输出不符时,进入误差的反向传播阶段。误差通过输出层,按误差梯度下降的方式修正各层权值,向隐层、输入层逐层反传。周而复始的信息正向传播和误差反向传播过程,是各层权值不断调整的过程,也是神经网络学习训练的过程,此过程一直进行到网络输出的误差减少到可以接受的程度,或者预先设定的学习次数为止。

BP神经网络模型BP网络模型包括其输入输出模型、作用函数模型、误差计算模型和自学习模型。
【优化求解】基于GUI界面之BP神经网络优化求解【Matlab 179期】_第1张图片
在这里插入图片描述

二、源代码

function varargout = network1(varargin)
% NETWORK1 M-file for network1.fig
%      NETWORK1, by itself, creates a new NETWORK1 or raises the existing
%      singleton*.
%
%      H = NETWORK1 returns the handle to a new NETWORK1 or the handle to
%      the existing singleton*.
%
%      NETWORK1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in NETWORK1.M with the given input arguments.
%
%      NETWORK1('Property','Value',...) creates a new NETWORK1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before network1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to network1_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help network1

% Last Modified by GUIDE v2.5 20-Dec-2010 21:29:05

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @network1_OpeningFcn, ...
                   'gui_OutputFcn',  @network1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{
     1})
    gui_State.gui_Callback = str2func(varargin{
     1});
end

if nargout
    [varargout{
     1:nargout}] = gui_mainfcn(gui_State, varargin{
     :});
else
    gui_mainfcn(gui_State, varargin{
     :});
end
% End initialization code - DO NOT EDIT


% --- Executes just before network1 is made visible.
function network1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to network1 (see VARARGIN)

% Choose default command line output for network1
handles.output = hObject;

set(handles.radiobutton1,'value',1);
set(handles.radiobutton2,'value',0);
set(handles.radiobutton3,'value',0);
set(handles.radiobutton4,'value',0);
set(handles.radiobutton5,'value',1);
set(handles.radiobutton6,'value',0);
set(handles.radiobutton7,'value',0);
% set(handles.radiobutton8,'value',0);
% set(handles.radiobutton9,'value',1);
% set(handles.radiobutton10,'value',0);

set(handles.edit1,'string','y(k)=(0.8-0.5*exp(-y(k-1)^2))*y(k-1)-(0.3+0.9*exp(-y(k-1)^2))*y(k-2)+u(k-1)+0.2*u(k-2)+0.1u(k-1)*u(k-2)');
set(handles.edit2,'string','4');
set(handles.edit3,'string','10');
set(handles.edit4,'string','1');
% set(handles.edit5,'visible','on');
% set(handles.edit5,'String','300');
% set(handles.edit6,'visible','off');
% set(handles.edit7,'string','0');
% set(handles.edit8,'string','0');

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes network1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = network1_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{
     1} = handles.output;




function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
input=str2num(get(hObject,'String'));
if(isempty(input))
    set(hObject,'String','0');
end
guidata(hObject,handles);
% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double

三、运行结果

【优化求解】基于GUI界面之BP神经网络优化求解【Matlab 179期】_第2张图片

四、备注

完整代码或者代写添加QQ912100926
往期回顾>>>>>>
【优化求解】粒子群算法之充电站最优布局【Matlab 061期】
【优化求解】遗传算法之多旅行商问题【Matlab 062期】
【优化求解】遗传和模拟退火之三维装箱问题【Matlab 063期】
【优化求解】遗传算法之求最短路径【Matlab 064期】
【优化求解】粒子群之优化灰狼算法【Matlab 065期】
【优化求解】多目标之灰狼优化算法MOGWO 【Matlab 066期】
【优化求解】遗传算法之求解优化车辆发车间隔【Matlab 067期】
【优化求解】磷虾群算法简介【Matlab 068期】
【优化求解】差分进化算法简介【Matlab 069期】
【优化求解】约束优化之惩罚函数法简介【Matlab 070期】
【优化求解】改进灰狼算法之求解重油热解模型【Matlab 072期】
【优化求解】蚁群算法之配电网故障定位【Matlab 073期】
【优化求解】遗传算法之求解岛屿物资补给优化问题【Matlab 137期】
【优化求解】基于matlab冠状病毒群体免疫优化算法(CHIO)【Matlab 138期】
【优化求解】基于matlab之金鹰优化求解算法(GEO)【Matlab 139期】

你可能感兴趣的:(matlab,优化求解)