⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initialindexpop.m

📁 一个用于自然数编码遗传算法的工具包indexGA
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -