Function to select individuals based on fitness scores
Examples
# example of usage
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10)
population <- BioGA::initialize_population_cpp(genomic_data,
population_size = 5)
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population)
BioGA::selection_cpp(population, fitness, num_parents = 2)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0.2445431 2.617297 -0.7378764 0.5842284 -1.238873 -0.8900997 -1.510025
#> [2,] 0.2445431 2.617297 -0.7378764 0.5842284 -1.238873 -0.8900997 -1.510025
#> [,8] [,9] [,10]
#> [1,] -0.5851824 -1.553676 -0.5760951
#> [2,] -0.5851824 -1.553676 -0.5760951