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

📄 truncationselection.m

📁 This matlab code on reed solomon and BCH encoding and different decoding algorithms. Also errors and
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: truncationSelection.m
%
% Description: Perform truncation selection and return the mating pool
% (index of selected individuals)
%
% @param truncParam is the selection pressure parameter
%
% @return winners is an array with the index of the individuals that won
% the tournaments.
%
% Author: Kumara Sastry
%
% Date: March 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function winners = truncationSelection(truncParam, fitness)

n = length(fitness);
numWinners = floor(n*truncParam);
numCopies = ceil(1/truncParam);

[sortedFitness, index] = sort(fitness,'descend');
potentialWinners = repmat(index(1:numWinners),numCopies,1);
winners = potentialWinners(1:n);

⌨️ 快捷键说明

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