R/operator.EASelectorRandom.R

Defines functions EASelectorRandom

#' @title
#' Simple (naive) selector.
#'
#' @description
#' Just for testing. Actually does not really select, but instead returns a random
#' sample of \code{ncol(fitness)} indizes.
#'
#' @template arg_fitness
#' @template arg_n_select
#' @return [\code{setOfIndividuals}]
#' @family selectors
#' @export
EASelectorRandom = function() {
  EASelector$new(
    name = "Random selector",
    params = list(),
    minimize = TRUE,
    setting = c("single", "multi"),
    direction = "minimize",
    fun = function(fitness, size) {
      sample(1:ncol(fitness), size = size, replace = TRUE)
    }
  )
} # EASelectorRandom
jakobbossek/ecr3 documentation built on Nov. 14, 2019, 7:47 p.m.