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

📄 elitistreplacement.m

📁 This matlab code on reed solomon and BCH encoding and different decoding algorithms. Also errors and
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: ElitistReplacement.m
%
% Description: Perform Lambda+Mu elitist replacement. Combine parent and
% offspring population and choose the best n individuals
%
% @param population is the parent population
%
% @param fitness is the fitness of parent individuals
%
% @param newPopulation is the offspring population
%
% @param newFitness is the fitness of offspring individuals
%
% @return bestPopulation is the top n individuals from the combined
% population of parent and offspring individuals.
%
% @return bestFitness is the fitness of the top n individuals from the
% combined population of parent and offspring individuals.
%
% Author: Kumara Sastry
%
% Date: March 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [bestPopulation, bestFitness] = elitistReplacement(population, fitness, newPopulation, newFitness)

% Determine the population size;
n = size(population,1);

% Combine the parent and offspring population and their fitness values
combinedPopulation = [population; newPopulation];
combinedFitness = [fitness; newFitness];

% Sort the combined fitness vector
[sortedFitness, index] = sort(combinedFitness, 'descend');

% Select the top n individuals and their fitness.
bestPopulation = combinedPopulation(index(1:n),:);
bestFitness = combinedFitness(index(1:n));

⌨️ 快捷键说明

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