initialindexpop.m
来自「一个用于自然数编码遗传算法的工具包indexGA」· M 代码 · 共 16 行
M
16 行
function [pop] = initialIndexPop(s,popSize)
% from s to initial a Pop
%the pop's column is add one for fitness
solSize=size(s,2);
pop=zeros(popSize,solSize);
for n=1:popSize
pop(n,:)=randArray(s);
%pop(n,:)=s;
end
tm=zeros(popSize,1);
pop=[pop tm];
%make out the fitness of every sol in pop
for n=1:popSize
[pop(n,:) pop(n,solSize+1)]=routFitness(pop(n,:),0);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?