R/core.makeRecombinator.R

Defines functions makeRecombinator mr

#' @title
#' Construct a recombination operator.
#'
#' @description
#' Helper function which constructs a recombinator, i. e., a recombination operator.
#'
#' @note If a recombinator returns more than one child, the \code{multiple.children}
#' parameter needs to be \code{TRUE}, which is the default. In case of multiple
#' children produced these have to be placed within a list.
#'
#' @param recombinator [\code{function}]\cr
#'   Actual mutation operator.
#' @param supported [\code{character}]\cr
#'   Vector of strings/names of supported parameter representations. Possible choices:
#'   \dQuote{permutation}, \dQuote{float}, \dQuote{binary} or \dQuote{custom}.
#' @param n.parents [\code{integer(1)}]\cr
#'   Number of parents supported.
#' @param n.children [\code{integer(1)}]\cr
#'   How many children does the recombinator produce?
#'   Default is \code{1}.
#' @return [\code{ecr_recombinator}]
#'   Recombinator object.
#' @export
makeRecombinator = function(
  name = "Recombinator",
  fun,
  params,
  representations,
  n.parents = 2L,
  n.children = NULL) {
  EARecombinator$new(
    name = name, params = params, fun = fun, representations = representations,
    n.parents, n.children = n.children)
}

mr = function(...) {
  makeRecombinator(...)
}
jakobbossek/ecr3 documentation built on Nov. 14, 2019, 7:47 p.m.