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

📄 select7.m

📁 王小平《遗传算法——理论、应用与软件实现》随书光盘
💻 M
字号:
function [out,coefs,pin]=select(in,d,x,y,h1,h2)
%
% out=select(in);
%
% selects a new population
%
%
global stop;
%
% Mix up the population
%
chrom=shuffle(in);

%
% Decode the existing population
%
coefs=decodall(chrom,d);

%
% Evaluate its' performance
%
pin=perf7(coefs,x,y,h1,1);


%
% Now work through the population to
% select the best.
% "Who's the hardest?" selection
%

[D L]=size(chrom);


for i = 1:2:D
	if stop == 1 
		break;
	end
	if pin(i)<pin(i+1)
		chrom(i+1,:)=chrom(i,:);
	else
		chrom(i,:)=chrom(i+1,:);
	end
end
coefs=decodall(chrom,d);
pin=perf7(coefs,x,y,h2,2);

out=chrom;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -