资源简介
对于遗传算法中的初始种群的产生过程进行了详尽的解释,对于大家对遗传算法的理解十分有用!
代码片段和文件信息
function [pop] = initializega(num bounds evalFNevalOpsoptions) %有5个输入项,1个输出项
% function [pop]=initializega(populationSize variableBoundsevalFN
% evalOpsoptions)
% initializega creates a matrix of random numbers with
% a number of rows equal to the populationSize and a number
% columns equal to the number of rows in bounds plus 1 for
% the f(x) value which is found by applying the evalFN.
% This is used by the ga to create the population if it
% is not supplied.
%
% pop - the initial evaluated random population
% populatoinSize - the size of the population i.e. the number to create
% variableBounds - a matrix which contains the bounds of each variable i.e.
% [var1_high var1_low; var2_high var2_low; ....]
% evalFN - the evaluation fn usually the name of the .m file for
% evaluation
% evalOps - any options to be passed to the eval function defaults []
% options - options to the initialize function ie.
% [type prec] where eps is the epsilon value
% and the second option is 1 for float and 0 for binary
% prec is the precision of the variables defaults [1e-6 1]
% Binary and Real-Valued Simulation Evolution for Matlab GAOT V2
% Copyright (C) 1998 C.R. Houck J.A. Joines M.G. Kay
%
% C.R. Houck J.Joines and M.Kay. A genetic algorithm for function
% optimization: A Matlab implementation. ACM Transactions on Mathmatical
% Software Submitted 1996.
%
% 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<5 %nargin:是用来判断输入项个数的函数
options=[1e-6 1]; %如果初始化函数的输入项个数小于5,则参数结构体options=[1e-6 1]
end
if nargin<4 %如果初始化函数的输入项个数小于4,则传递给适应度函数的参数evalOps=[]
evalOps=[];
end
if any(evalFN<48) %Not a .m file 意思是说如果evalFN不是一个M文件
if options(2)==1 %Float GA
estr=[‘x=pop(i1); pop(ixZomeLength)=‘ evalFN ‘;‘];
else %Binary GA
estr=[‘x=b2f(pop(i:)boundsbits); pop(ixZomeLength)=‘ evalFN ‘;‘];
end
else %A .m file 如果是M文件
if options(2)==1 %Float GA 如果options的第二列为1,则采用实数编码
estr=[‘[ pop(i:) pop(ixZomeLength)]=‘ evalFN ‘(pop(i:)[0 evalOps]);‘]; %实际上就是和适应度函数衔接了。‘[ pop(i:) pop(ixZomeLength)]=‘ evalFN ‘(pop(i:)[0 evalOps]);‘的格式和适应度函数的定义的格式是一摸一样。
else %Binary GA 如果参数结构体的第二列为0,则采用二进制编码
estr=[‘x=b2f(pop(i:)boundsbits);[x v]=‘ evalFN ...
‘(x[0 evalOps]); pop(i:)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4299 2009-05-06 07:49 initializega.m
----------- --------- ---------- ----- ----
4299 1
相关资源
- FPGA实现PID.v
- 基于FPGA的sdi视频传输工程(k7_sdi_rx
- FPGA彩条显示
- Xilinx-FPGA-引脚功能详细介绍.doc
- 基于xilinx FPGA的PCIe设计实战
- 基于PCIe的FPGA动态配置设计与实现
- 为什么工程师要掌握FPGA开发知识?
- 数字频率合成dds正弦波基于FPGA的DDS产
- Verilog FPGA UART串口控制器
- gmsk调制在FPGA上实现
- 一个简单的verilog编写的DMA IP CORE,和
- FPGA在步进电机驱动上的应用实例及代
- QGA 量子遗传算法
- fpga实现频率测量
- MCGS与单片机通信
- FPGA开发-ChipScope教程
- 红外循迹小车VHDL程序
- atmega16硬件产生方波的程序
- Gamma函数的解法
- 基于Gabor滤波器的图像纹理特征提取
- atmega64bootload
- 基于FPGA的USB接口设计
- DE2模拟的交通红绿灯
- planeGame飞机游戏
- 一种抗SEU存储器电路的FPGA设计
- Furan-BDOPV Donor-Acceptor Polymers with Plana
- Behaviors of fatigue crack propagation in fric
- Dibrugarh地区牛场土壤中潜在的益生菌
- Gauss-Bonnet AdS黑洞的参数相变
- SX1301 +sx1255 GATEWAY.zip
评论
共有 条评论