#' @title
#' Simple selector.
#'
#' @description
#' Sorts the individuals according to their fitness value in increasing order
#' and selects the best ones.
#'
#' @template arg_fitness
#' @template arg_n_select
#' @return [\code{integer}] Vector of survivor indizes.
#' @family selectors
#' @export
EASelectorGreedy = function() {
EASelector$new(
name = "Greedy selector",
minimize = TRUE,
setting = "single",
direction = "minimize",
fun = function(fitness, size) {
.Call(`_ecr3_EASelectorGreedyC`, fitness, size)
nc = ncol(fitness)
if (size > nc)
BBmisc::stopf("[ecr3] EASelectorGreedy: Selection of %i individuals required, but only %i available.
Probably, you apply a (mu, lambda)-strategy with mu lambda < mu.", size, nc)
fitness = as.numeric(fitness)
idx = order(fitness)[seq(size)]
return(idx)
}
)
} # EASelectorGreedy
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.