没有合适的资源?快使用搜索试试~ 我知道了~
matlab的差分算法实现以及粒子群优化算法介绍.docx
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 56 浏览量
2022-06-18
06:56:32
上传
评论
收藏 70KB DOCX 举报
温馨提示
试读
28页
。。。
资源推荐
资源详情
资源评论
from:
http://www.madio.net/Article/Class36/Class5/200508/983.html
function dedemov(action);
% DE function minimization demonstration.
% dedemov is called with no parameters.
%
% Differential Evolution for MATLAB
% Copyright (C) 1996 R. Storn
% International Computer Science Institute (ICSI)
% 1947 Center Street, Suite 600
% Berkeley, CA 94704
% E-mail: [email protected]
% WWW:
http://http.icsi.berkeley.edu/~storn
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 1, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details. A copy of the GNU
% General Public License can be obtained from the
% Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
if nargin<1, %---number of arguments less than one ?
action='initialize';
end;
if strcmp(action,'initialize'),
%---Header of Window--------------------------------
figNumber=figure( ...
'Name','Differential Evolution Demo', ...
'NumberTitle','off', ...
'Visible','off');
%---define area for graphics------------------------
axes( ...
'Units','normalized', ...
'Visible','off', ...
'Position',[0.1 0.35 0.60 0.75]);
%---Set up the Comment Window-----------------------
top1=0.25;
left1=0.05;
right1=0.75;
bottom1=0.05;
labelHt1=0.05;
spacing1=0.005;
promptStr=str2mat(' ',...
' This demo shows the track of the best', ...
' population member for each generation.');
%---First, the MiniCommand Window frame------------------------
frmBorder=0.02;
frmPos1=[left1-frmBorder bottom1-frmBorder ...
(right1-left1)+2*frmBorder (top1-bottom1)+2*frmBorder];
uicontrol( ...
'Style','frame', ...
'Units','normalized', ...
'Position',frmPos1, ...
'BackgroundColor',[0.5 0.5 0.5]);
%---Then the text label----------------------------------------
labelPos1=[left1 top1-labelHt1 (right1-left1) labelHt1];
uicontrol( ...
'Style','text', ...
'Units','normalized', ...
'Position',labelPos1, ...
'BackgroundColor',[0.5 0.5 0.5], ...
'ForegroundColor',[1 1 1], ...
'String','Comment Window');
%---Then the editable text field-------------------------------
txtPos1=[left1 bottom1 (right1-left1) top1-bottom1-labelHt1-spacing1];
txtHndl=uicontrol( ...
'Style','edit', ...
'Units','normalized', ...
'Max',10, ...
'BackgroundColor',[1 1 1], ...
'Position',txtPos1, ...
'Callback','dedemov(''eval'')', ...
'String',promptStr);
%---Save the text handle for future use------------------------
set(gcf,'UserData',txtHndl)
%==============================================================
%---Information for all buttons (and menus)--------------------
labelColor=[0.8 0.8 0.8];
yInitPos=0.90;
menutop=0.95;
btnTop = 0.6;
top=0.75;
left=0.785;
btnWid=0.175;
btnHt=0.06;
textHeight = 0.05;
textWidth = 0.06;
%---Spacing between the button and the next command's label
spacing=0.019;
%---The CONSOLE frame------------------------------------------
frmBorder=0.019; frmBottom=0.04;
frmHeight = 0.92; frmWidth = btnWid;
yPos=frmBottom-frmBorder;
frmPos=[left-frmBorder yPos frmWidth+2*frmBorder frmHeight+2*frmBorder];
h=uicontrol( ...
'Style','frame', ...
'Units','normalized', ...
'Position',frmPos, ...
'BackgroundColor',[0.5 0.5 0.5]);
%===Define the individual selection items======================
%---The DE strategy Selection Menu-----------------------------
btnNumber=1;
yPos=menutop-(btnNumber-1)*(btnHt+spacing);
btnPos=[left yPos-btnHt btnWid btnHt];
labelStr='rand/1|best/1|best/2|rtb/1|rand/2';
callbackStr='dedemov(''changemethod'');';
MethodHndl=uicontrol( ...
'Style','popupmenu', ...
'Units','normalized', ...
'Position',btnPos, ...
'String',labelStr, ...
'Interruptible','yes', ...
'Callback',callbackStr);
%---Size of Population NP--------------------------------------
btnNumber=1;
yPos=menutop-(btnNumber-1)*(btnHt+spacing);
top = yPos - btnHt - spacing;
labelWidth = frmWidth-textWidth-.01;
labelBottom=top-textHeight;
labelLeft = left;
labelPos = [labelLeft labelBottom labelWidth textHeight];
h = uicontrol( ...
'Style','text', ...
'Units','normalized', ...
'Position',labelPos, ...
'Horiz','left', ...
'String','NP', ...
'Interruptible','no', ...
'BackgroundColor',[0.5 0.5 0.5], ...
'ForegroundColor','white');
%---Weighting factor F-----------------------------------------
btnNumber=2;
yPos=menutop-(btnNumber-1)*(btnHt+spacing);
top = yPos - btnHt - spacing;
labelWidth = frmWidth-textWidth-.01;
labelBottom=top-textHeight;
labelLeft = left;
labelPos = [labelLeft labelBottom labelWidth textHeight];
h = uicontrol( ...
'Style','text', ...
'Units','normalized', ...
'Position',labelPos, ...
'Horiz','left', ...
'String','F', ...
'Interruptible','no', ...
'BackgroundColor',[0.5 0.5 0.5], ...
'ForegroundColor','white');
%---Crossover probability CR-----------------------------------
btnNumber=3;
yPos=menutop-(btnNumber-1)*(btnHt+spacing);
top = yPos - btnHt - spacing;
labelWidth = frmWidth-textWidth-.01;
labelBottom=top-textHeight;
labelLeft = left;
labelPos = [labelLeft labelBottom labelWidth textHeight];
h = uicontrol( ...
'Style','text', ...
'Units','normalized', ...
'Position',labelPos, ...
'Horiz','left', ...
'String','CR', ...
'Interruptible','no', ...
'BackgroundColor',[0.5 0.5 0.5], ...
'ForegroundColor','white');
%---Maximum number of iterations itermax------------------------
btnNumber=4;
yPos=menutop-(btnNumber-1)*(btnHt+spacing);
top = yPos - btnHt - spacing;
labelWidth = frmWidth-textWidth-.01;
labelBottom=top-textHeight;
labelLeft = left;
labelPos = [labelLeft labelBottom labelWidth textHeight];
h = uicontrol( ...
'Style','text', ...
'Units','normalized', ...
'Position',labelPos, ...
'Horiz','left', ...
'String','itermax', ...
'Interruptible','no', ...
'BackgroundColor',[0.5 0.5 0.5], ...
'ForegroundColor','white');
%---Text field---------------------------------------------------
textPos = [labelLeft+labelWidth-.015 labelBottom textWidth+.025 7*.85*textHeight];
callbackStr = 'dedemov(''setContr'')';
%---Enter the default values-------------------------------------
str = sprintf('15\n\n0.9\n\n0.9\n\n200');
mat = [15; 0.9; 0.9; 200]; % default values
CvarsHndl = uicontrol( ...
'Style','edit', ...
'Units','normalized', ...
'Position',textPos, ...
'Max',2, ... % makes this a multiline edit object
'Horiz','right', ...
'Background','white', ...
'Foreground','black', ...
'String',str,'Userdata',mat, ...
'callback',callbackStr);
剩余27页未读,继续阅读
资源评论
苦茶子12138
- 粉丝: 1w+
- 资源: 6万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- postgresql-42.7.3.jar
- 2024-05-21 20-36-43.mkv
- 基于QT+C++的智能云监护仪项目,能够实时显示使用者心电、血氧、血压波形及其它各种参数+源码(毕业设计&课程设计&项目开发)
- 基于java开发的app接收硬件端传输的心音信号,具有显示心音波形,发出心音的功能+源码(毕业设计&课程设计&项目开发)
- Python 程序语言设计模式思路-行为型模式:职责链模式:将请求从一个处理者传递到下一个处理者
- 9241703124789646.16健身系统2.apk
- postgresql-16.3-1-windows-x64.exe
- Python 程序语言设计模式思路-结构型模式:装饰器讲解及利用Python装饰器模式实现高效日志记录和性能测试
- 基于YOLOv5和DeepSORT的多目标跟踪仿真与记录
- Python 程序语言设计模式思路-创建型模式:原型模式:通过复制现有对象来创建新对象,面向对象编程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功