rws: Roulette Wheel Selection

Description Usage Arguments Details Value Algorithm Author(s) See Also Examples

View source: R/rws.R

Description

This function selects a given number of individuals from a population.

Usage

1
rws(FitnV, Nsel)

Arguments

FitnV

a vector containing the fitness values of the individuals in the population.

Nsel

a number indicating individuals to be selected

Details

rws probabilistically select Nsel individuals for reproduction according to their fitness, FitnV, in the current population.

NewChrIx = rws(FitnV,Nsel) selects Nsel individuals from a population using roulette wheel selection. FitnV is a vector containing a performance measure for each individual in the population. This can be achieved by using the function ranking or scaling to assign a fitness level to each individual.

rws is a low-level selection function normally called by select.

Value

a vector containing the indexes of the selected individuals relative to the original population, shuffled. The new population, ready for mating, can be obtained by calculating OldChrom[NewChrIx,].

Algorithm

A form of roulette wheel selection is implemented by obtaining a cumulative sum of the fitness vector, FitnV, and generating Nsel uniformly at random distributed numbers between 0 and sum(FitnV). The index of the individuals selected is determined by comparing the generated numbers with the cumulative sum vector. The probability of an individual being selected is the given by:

F(xi) = f(xi)/sum(f(xi))

where f(xi) is the fitness of individual xi and F(xi) is the probability of that individual being selected.

Author(s)

The original matlab implementation of rws was written by Carlos Fonseca and Andrew Chipperfield. The R implementation was written by David Zhao.

See Also

select, sus, reins, ranking, scaling

Examples

1
2
3
4
## Consider a population of 8 individuals with the assigned fitness values, FitnV:
FitnV = c(1.5,1.35,1.21,1.07,0.92,0.78,0.64,0.5)
## Select the indices of 6 individuals:
NewChrIx = rws(FitnV,6)

drizztxx/gatbxr documentation built on Dec. 27, 2021, 2:26 a.m.