ga_initpopu.m
来自「基因演算法genetic algorthim的程式實現」· M 代码 · 共 16 行
M
16 行
function popu=GA_initpopu(popuSize, bit_n, var_n, PRINT)
% popuSize is the size of population, an even positive
% integer is prefered. i.e. popuSize=36.
% bit_n is the bit length.
% var_n is the number of parameters(Genes)
% PRINT=1 then print out Binary Population Chromosomes
% For example:
% GA_initpopu(36, 8, 2)
% PenChen Chou, 6-30-2001
if nargin==3
popu = rand(popuSize, bit_n*var_n) > 0.5;
else
popu = rand(popuSize, bit_n*var_n) > 0.5
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?