资源简介
对于遗传算法中的初始种群的产生过程进行了详尽的解释,对于大家对遗传算法的理解十分有用!
代码片段和文件信息
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上使用verilog实现SPI通信协议
- 自动白平衡、色彩恒常性源代码之:
- GAT832-2014-《道路交通安全违法行为图
- 7kbscan domain gather V2.5.exe
- RibbonGadgets
- ZYNQ-7000系列所有型号PFGA管脚分配表
- 基于FPGA的数字频率计设计与仿真
- 北京市电子设计大赛模块驱动msp430g
- FPGA LCD1602驱动
- IC芯片封装库
- 基于FPGA的HDB3码编码
- 基于FPGA的verilog实现的AMI码的编解码
- 基于FPGA的Verilog编写的交通灯程序
- FPGA 多功能信号发生器
- cordic算法的FPGA流水线实现
- Vega Prime
- FPGA架构设计(经典).docx
- 基于FPGA实现的深空通信中turbo码编译
- FIFO代码以及对应的testbench
- Altera FPGA Cyclone IV E 原理图和封装库
-
gameob
jects-0.0.3.win32.exe - Cyclone_IV_board_shematic.pdf
- GA-BP优化算法
- 基于FPGA的AD/DA采集原码
- 基于NSGA-II的多目标优化算法及论文
- N皇后问题Las Vegas优化算法的实现
- mod_encodingapache支持中文路径工具
- 基于spartan3an的贪吃蛇游戏设计
- 片外SRAM读写测试代码,亲测可用
- 步态识别gaitgan论文
评论
共有 条评论