Learn R Programming

adana (version 1.1.0)

selrswrp: Random selection with replacement and proportion

Description

Random selection is made by simple random sampling method with replacements, based on the fitness values of individuals. Each individual has the chance to be selected proportionally to their fitness value.

Usage

selrswrp(fitvals, ns, ...)

Arguments

fitvals

Vector of fitness values belonging to individuals

ns

Number of individuals to be selected

Further arguments passed to or from other methods.

Value

The indices of randomly selected individuals are returned.

See Also

select, selrand, seltrunc, selrws, selrws2, selrss, selsus, seldet, selwscale, selsscale, selsscale2, sellscale, selrscale, selrscale2, selpscale, selescale, seltour, seltour2, selboltour, sellrs, sellrs2, sellrs3, selnlrs, selers

Examples

Run this code
# NOT RUN {
fitvals = c(6, 1, 2, 4, 5)              # Fitness Values
cnames = paste0("C",1:length(fitvals))  # Chromosome names
matpool = selrswrp(fitvals)
cat("Selected Chromosomes: ", cnames[matpool], "\n")
# }

Run the code above in your browser using DataLab