diff --git a/NAMESPACE b/NAMESPACE index 3a298ec..27bcd97 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,31 +8,31 @@ S3method(getSupportedRepresentations,ecr_operator) S3method(is.supported,ecr_operator) S3method(print,ecr_control) S3method(print,ecr_result) -export(bitflipMutator) -export(crossoverRecombinator) export(ecr) export(ecr.control) -export(gaussMutator) export(getBestIndividual) export(getOperatorCheckFunction) export(getOperatorDefaultParameters) export(getOperatorName) export(getSupportedRepresentations) -export(intermediateRecombinator) export(is.supported) export(isEcrOperator) export(makeBinaryGenerator) +export(makeBitFlipMutator) export(makeConsoleMonitor) +export(makeCrossoverRecombinator) +export(makeGaussMutator) +export(makeIntermediateRecombinator) export(makeMaximumIterationsStoppingCondition) export(makeMaximumTimeStoppingCondition) export(makeMonitor) export(makeNullMonitor) +export(makeNullRecombinator) export(makePermutationGenerator) export(makeStoppingCondition) +export(makeSwapMutator) export(makeUniformGenerator) -export(nullRecombinator) export(setupStoppingConditions) -export(swapMutator) import(BBmisc) import(ParamHelpers) import(checkmate) diff --git a/R/checkOperator.R b/R/checkOperator.R index e71f2fc..06d1692 100644 --- a/R/checkOperator.R +++ b/R/checkOperator.R @@ -7,12 +7,12 @@ checkOperator = function(operator) { assertCharacter(attr(operator, "name"), len = 1L, any.missing = FALSE) assertCharacter(attr(operator, "description"), len = 1L, any.missing = FALSE) assertCharacter(attr(operator, "supported"), min.len = 1L, any.missing = FALSE) + assertList(attr(operator, "defaults"), any.missing = FALSE) } checkMutator = function(mutator) { checkOperator(mutator) assertClass(mutator, "ecr_mutator") - assertList(attr(mutator, "defaults"), any.missing = FALSE) } checkRecombinator = function(recombinator) { diff --git a/R/ecrControl.R b/R/ecrControl.R index 91c4020..029e501 100644 --- a/R/ecrControl.R +++ b/R/ecrControl.R @@ -62,8 +62,8 @@ ecr.control = function( save.population.at = integer(0), mating.pool.generator = simpleMatingPoolGenerator, generator = makeUniformGenerator(), - mutator = list(gaussMutator), - recombinator = intermediateRecombinator, + mutator = list(makeGaussMutator()), + recombinator = makeIntermediateRecombinator(), mutator.control = list(), recombinator.control = list(), monitor = makeConsoleMonitor(), diff --git a/R/generator.random.binary.R b/R/generator.random.binary.R index 79a53b6..e49299d 100644 --- a/R/generator.random.binary.R +++ b/R/generator.random.binary.R @@ -26,6 +26,7 @@ makeBinaryGenerator = function() { operator = makeOperator( operator = generateBinaryPopulation, name = "Binary generator", + description = "Samples uniformally distributed 0, 1 values.", supported = c("binary") ) operator = addClasses(operator, c("ecr_generator")) diff --git a/R/generator.random.permutation.R b/R/generator.random.permutation.R index 53a7277..d00b429 100644 --- a/R/generator.random.permutation.R +++ b/R/generator.random.permutation.R @@ -29,6 +29,7 @@ makePermutationGenerator = function() { operator = makeOperator( operator = generatePermutationPopulation, name = "Permutation generator", + description = "Generates random permutations.", supported = c("permutation") ) operator = addClasses(operator, c("ecr_generator")) diff --git a/R/generator.uniform.float.R b/R/generator.uniform.float.R index 6645fae..7811617 100644 --- a/R/generator.uniform.float.R +++ b/R/generator.uniform.float.R @@ -29,7 +29,8 @@ makeUniformGenerator = function() { operator = makeOperator( operator = generateUniformPopulation, name = "Uniform generator", - supported = c("float") + description = "Samples uniformally distributed points in the design space.", + supported = "float" ) operator = addClasses(operator, c("ecr_generator")) return(operator) diff --git a/R/getOperatorCheckFunction.R b/R/getOperatorCheckFunction.R index 4a29910..c8825cf 100644 --- a/R/getOperatorCheckFunction.R +++ b/R/getOperatorCheckFunction.R @@ -11,5 +11,5 @@ getOperatorCheckFunction = function(operator) { #' @export getOperatorCheckFunction.ecr_operator = function(operator) { - attr(operator, "checkFunction") + attr(operator, "checker") } diff --git a/R/makeMutator.R b/R/makeMutator.R index 8c1a4d8..6984e88 100644 --- a/R/makeMutator.R +++ b/R/makeMutator.R @@ -4,13 +4,21 @@ # Actual mutation operator. # @param name [\code{character(1)}]\cr # Name of the mutator. +# @param description [\code{character(1)}]\cr +# Short description of how the mutator works. # @param supported [\code{character}]\cr # Vector of strings/names of supported parameter representations. For example # 'permutation', 'float', 'binary'. +# @param checker [\code{function}]\cr +# Check object, which performs a sanity check in mutator strategy parameters +# passed to the control object. # @return [\code{ecr_mutator}] # Mutator object. -makeMutator = function(mutator, name, supported = getAvailableRepresentations()) { - mutator = makeOperator(mutator, name, supported) +makeMutator = function(mutator, name, description, + supported = getAvailableRepresentations(), + defaults = list(), + checker = function(operator.control) TRUE) { + mutator = makeOperator(mutator, name, description, supported, defaults, checker) mutator = addClasses(mutator, c("ecr_mutator")) return(mutator) } diff --git a/R/makeOperator.R b/R/makeOperator.R index f4fc89e..5c537a7 100644 --- a/R/makeOperator.R +++ b/R/makeOperator.R @@ -4,18 +4,31 @@ # Actual mutation operator. # @param name [\code{character(1)}]\cr # Name of the operator. +# @param description [\code{character(1)}]\cr +# Short description of how the mutator works. # @param supported [\code{character}]\cr # Vector of names of supported parameter representations. For example # 'permutation', 'float', 'binary'. +# @param defaults [\code{list}]\cr +# List of default values for the operators strategy parameters. # @return [\code{ecr_operator}] # Operator object. -makeOperator = function(operator, name, supported = getAvailableRepresentations()) { +makeOperator = function(operator, name, description, + supported = getAvailableRepresentations(), + defaults = list(), + checker = function(operator.control) TRUE) { assertFunction(operator) assertCharacter(name, len = 1L, any.missing = FALSE) + assertCharacter(description, len = 1L, any.missing = FALSE) assertSubset(supported, choices = getAvailableRepresentations(), empty.ok = FALSE) + assertList(defaults, unique = TRUE, any.missing = FALSE) + assertFunction(checker, args = "operator.control") attr(operator, "name") = name + attr(operator, "description") = description attr(operator, "supported") = supported + attr(operator, "defaults") = defaults + attr(operator, "checker") = checker operator = addClasses(operator, c("ecr_operator")) return(operator) diff --git a/R/makeRecombinator.R b/R/makeRecombinator.R index 34cfe1c..ef0048f 100644 --- a/R/makeRecombinator.R +++ b/R/makeRecombinator.R @@ -12,12 +12,17 @@ # @return [\code{ecr_recombinator}] # Recombinator object. makeRecombinator = function( - recombinator, name, + recombinator, name, description, supported = getAvailableRepresentations(), - n.parents = 2L) { + n.parents = 2L, + defaults = list(), + checker = function(operator.control) TRUE) { + recombinator = makeOperator(recombinator, name, description, supported, defaults) + assertInteger(n.parents, len = 1L, lower = 2L, any.missing = FALSE) - recombinator = makeOperator(recombinator, name, supported) attr(recombinator, "n.parents") = n.parents + recombinator = addClasses(recombinator, c("ecr_recombinator")) + return(recombinator) } diff --git a/R/mutator.bitflip.R b/R/mutator.bitflip.R index 399c763..9be0204 100644 --- a/R/mutator.bitflip.R +++ b/R/mutator.bitflip.R @@ -1,31 +1,35 @@ #' Bitplip mutation operator. #' -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' Not used. -#' @return [\code{setOfIndividuals}] -#' Set of individuals. +#' @param mutator.flip.prob [\code{numeric(1)}]\cr +#' Probability to flip a single bit. Default is \code{0.1}. +#' @return [\code{ecr_mutator}] #' @export -bitflipMutator = function(setOfIndividuals, control) { - n.params = ncol(setOfIndividuals$individuals) - n = nrow(setOfIndividuals$individuals) - - for (i in seq(n)) { - do.mutate = runif(n.params) < control$mutator.flip.prob - setOfIndividuals$individuals[i, do.mutate] = 1 - setOfIndividuals$individuals[i, do.mutate] +makeBitFlipMutator = function(mutator.flip.prob = 0.1) { + mutatorCheck = function(operator.control) { + assertNumber(operator.control$mutator.flip.pro, lower = 0.000001, upper = 0.999999, na.ok = FALSE) } - return(setOfIndividuals) -} -attr(bitflipMutator, "name") = "Bitplip mutator" -attr(bitflipMutator, "description") = "Flips each bit of the allele with a specific probability." -attr(bitflipMutator, "supported") = c("binary") -attr(bitflipMutator, "class") = c("ecr_operator", "ecr_mutator") -attr(bitflipMutator, "defaults") = list(mutator.flip.prob = 1 / 10) + force(mutator.flip.prob) + defaults = list(mutator.flip.prob = mutator.flip.prob) + mutatorCheck(defaults) -bitflipMutatorCheck = function(operator.control) { - assertNumber(operator.control$mutator.flip.pro, lower = 0.000001, upper = 0.999999, na.ok = FALSE) -} + mutator = function(setOfIndividuals, control = defaults) { + n.params = ncol(setOfIndividuals$individuals) + n = nrow(setOfIndividuals$individuals) -attr(bitflipMutator, "checkFunction") = bitflipMutator + for (i in seq(n)) { + do.mutate = runif(n.params) < control$mutator.flip.prob + setOfIndividuals$individuals[i, do.mutate] = 1 - setOfIndividuals$individuals[i, do.mutate] + } + return(setOfIndividuals) + } + + makeMutator( + mutator = mutator, + name = "Bitplip mutator", + description = "Flips each bit of the allele with a specific probability.", + supported = "binary", + defaults = defaults, + checker = mutatorCheck + ) +} diff --git a/R/mutator.gauss.R b/R/mutator.gauss.R index ed454c7..7fe4c9a 100644 --- a/R/mutator.gauss.R +++ b/R/mutator.gauss.R @@ -1,40 +1,44 @@ #' Generator of the Gauss mutation operator. #' #' Default Gauss mutation operator known from Evolutionary Algorithms. -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' List containing evolutionary operators for fine-tuning the mutation operator. -#' The \code{gaussMutator} function expects the two values: -#' \itemize{ -#' \item{mutator.gauss.prob [\code{numeric(1)}]}{Probability of mutation for the gauss mutation operator.} -#' \item{mutator.gauss.sd [\code{numeric(1)}}{Standard deviance of the Gauss mutation, i. e., the mutation strength.} -#' } -#' @return [\code{setOfIndividuals}] -#' Set of individuals. +#' +#' @param mutator.gauss.prob [\code{numeric(1)}]\cr +#' Probability of mutation for the gauss mutation operator. +#' @param mutator.gauss.sd [\code{numeric(1)}\cr +#' Standard deviance of the Gauss mutation, i. e., the mutation strength. +#' @return [\code{ecr_mutator}] #' @export -gaussMutator = function(setOfIndividuals, control = list(mutator.gauss.prob = 1, mutator.gauss.sd = 0.05)) { - n.params = ncol(setOfIndividuals$individuals) - n = nrow(setOfIndividuals$individuals) +makeGaussMutator = function(mutator.gauss.prob = 1L, mutator.gauss.sd = 0.05) { + force(mutator.gauss.prob) + force(mutator.gauss.sd) - mutation.bool = matrix(runif(n * n.params) < control$mutator.gauss.prob, ncol = n.params) - mutation = matrix(0, ncol = n.params, nrow = n) - idx = which(mutation.bool) - mutation[idx] = rnorm(length(idx), mean = 0, sd = control$mutator.gauss.sd) - setOfIndividuals$individuals = setOfIndividuals$individuals + mutation + mutatorCheck = function(operator.control) { + assertNumber(operator.control$mutator.gauss.prob, lower = 0, finite = TRUE, na.ok = FALSE) + assertNumber(operator.control$mutator.gauss.sd, lower = 0, finite = TRUE, na.ok = FALSE) + } - return(setOfIndividuals) -} + defaults = list(mutator.gauss.prob = mutator.gauss.prob, mutator.gauss.sd = mutator.gauss.sd) + mutatorCheck(defaults) -attr(gaussMutator, "name") = "Gauss mutator" -attr(gaussMutator, "description") = "Adds gaussian noise to each gene" -attr(gaussMutator, "supported") = c("float") -attr(gaussMutator, "class") = c("ecr_operator", "ecr_mutator") -attr(gaussMutator, "defaults") = list(mutator.gauss.prob = 1, mutator.gauss.sd = 0.05) + mutator = function(setOfIndividuals, control = defaults) { + n.params = ncol(setOfIndividuals$individuals) + n = nrow(setOfIndividuals$individuals) -gaussMutatorCheck = function(operator.control) { - assertNumber(operator.control$mutator.gauss.prob, lower = 0, finite = TRUE, na.ok = FALSE) - assertNumber(operator.control$mutator.gauss.sd, lower = 0, finite = TRUE, na.ok = FALSE) -} + mutation.bool = matrix(runif(n * n.params) < control$mutator.gauss.prob, ncol = n.params) + mutation = matrix(0, ncol = n.params, nrow = n) + idx = which(mutation.bool) + mutation[idx] = rnorm(length(idx), mean = 0, sd = control$mutator.gauss.sd) + setOfIndividuals$individuals = setOfIndividuals$individuals + mutation -attr(gaussMutator, "checkFunction") = gaussMutatorCheck + return(setOfIndividuals) + } + + makeMutator( + mutator = mutator, + name = "Gauss mutator", + description = "Adds gaussian noise to each gene", + supported = "float", + defaults = defaults, + checker = mutatorCheck + ) +} diff --git a/R/mutator.swap.R b/R/mutator.swap.R index 36d74df..31ce276 100644 --- a/R/mutator.swap.R +++ b/R/mutator.swap.R @@ -1,34 +1,28 @@ #' Swap mutation operator. #' -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' Not used. -#' @return [\code{setOfIndividuals}] -#' Set of individuals. +#' @return [\code{ecr_mutator}] #' @export -swapMutator = function(setOfIndividuals, control = list()) { - n.params = ncol(setOfIndividuals$individuals) - n = nrow(setOfIndividuals$individuals) +makeSwapMutator = function() { + mutator = function(setOfIndividuals, control = list()) { + n.params = ncol(setOfIndividuals$individuals) + n = nrow(setOfIndividuals$individuals) - for (i in seq(n)) { - pos = sample(1:n.params, size = 2) - pos1 = pos[1] - pos2 = pos[2] - #catf("Positions: %i, %i", pos1, pos2) - tmp = setOfIndividuals$individuals[i, pos1] - setOfIndividuals$individuals[i, pos1] = setOfIndividuals$individuals[i, pos2] - setOfIndividuals$individuals[i, pos2] = tmp + for (i in seq(n)) { + pos = sample(1:n.params, size = 2) + pos1 = pos[1] + pos2 = pos[2] + #catf("Positions: %i, %i", pos1, pos2) + tmp = setOfIndividuals$individuals[i, pos1] + setOfIndividuals$individuals[i, pos1] = setOfIndividuals$individuals[i, pos2] + setOfIndividuals$individuals[i, pos2] = tmp + } + return(setOfIndividuals) } - return(setOfIndividuals) -} - -attr(swapMutator, "name") = "Swap mutator" -attr(swapMutator, "description") = "Swaps two alleles" -attr(swapMutator, "supported") = c("permutation") -attr(swapMutator, "class") = c("ecr_operator", "ecr_mutator") -attr(swapMutator, "defaults") = list() -swapMutatorCheck = function(operator.control) {} - -attr(swapMutator, "checkFunction") = swapMutatorCheck + makeMutator( + mutator = mutator, + name = "Swap mutator", + description = "Swaps two alleles", + supported = "permutation", + ) +} diff --git a/R/recombinator.crossover.R b/R/recombinator.crossover.R index 418dade..1bec223 100644 --- a/R/recombinator.crossover.R +++ b/R/recombinator.crossover.R @@ -1,13 +1,9 @@ #' Generator of the crossover recombination operator. #' -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' Empty list. Intermediate recombinator has no parameters. -#' @return [\code{setOfIndividuals}] -#' Recombined offspring. +#' @return [\code{ecr_recombinator}] #' @export -crossoverRecombinator = function(setOfIndividuals, control = list()) { +makeCrossoverRecombinator = function() { + recombinator = function(setOfIndividuals, control = list()) { parents = setOfIndividuals$individuals parent1 = parents[1, ] parent2 = parents[2, ] @@ -18,15 +14,13 @@ crossoverRecombinator = function(setOfIndividuals, control = list()) { child[idx:n] = parent2[idx:n] child = matrix(child, nrow = 1L) makePopulation(child) -} - -attr(crossoverRecombinator, "name") = "Crossover recombinator" -attr(crossoverRecombinator, "description") = "No description" -attr(crossoverRecombinator, "supported") = c("float", "binary") -attr(crossoverRecombinator, "n.parents") = 2L -attr(crossoverRecombinator, "defaults") = list() -attr(crossoverRecombinator, "class") = c("ecr_operator", "ecr_recombinator") + } -crossoverRecombinatorCheck = function(operator.control) {} - -attr(crossoverRecombinator, "checkFunction") = crossoverRecombinatorCheck + makeRecombinator( + recombinator = recombinator, + name = "Crossover recombinator", + description = "Performs classical crossover", + n.parents = 2L, + supported = c("float", "binary") + ) +} diff --git a/R/recombinator.intermediate.R b/R/recombinator.intermediate.R index 35d3422..ab8cea6 100644 --- a/R/recombinator.intermediate.R +++ b/R/recombinator.intermediate.R @@ -1,24 +1,18 @@ #' Generator of the indermediate recombination operator. #' -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' Empty list. Intermediate recombinator has no parameters. -#' @return [\code{setOfIndividuals}] -#' Recombined offspring. +#' @return [\code{ecr_recombinator}] #' @export -intermediateRecombinator = function(setOfIndividuals, control = list()) { - child = matrix(colSums(setOfIndividuals$individuals) / 2, nrow = 1L) - makePopulation(child) -} - -attr(intermediateRecombinator, "name") = "Intermediate recombinator" -attr(intermediateRecombinator, "description") = "No description" -attr(intermediateRecombinator, "supported") = c("float") -attr(intermediateRecombinator, "n.parents") = 10L -attr(intermediateRecombinator, "defaults") = list() -attr(intermediateRecombinator, "class") = c("ecr_operator", "ecr_recombinator") +makeIntermediateRecombinator = function() { + recombinator = function(setOfIndividuals, control = list()) { + child = matrix(colSums(setOfIndividuals$individuals) / 2, nrow = 1L) + makePopulation(child) + } -intermediateRecombinatorCheck = function(operator.control) {} - -attr(intermediateRecombinator, "checkFunction") = intermediateRecombinatorCheck + makeRecombinator( + recombinator = recombinator, + name = "Intermediate recombinator", + description = "Performs intermediate recombination.", + supported = "float", + n.parents = 10L + ) +} diff --git a/R/recombinator.null.R b/R/recombinator.null.R index 2caddea..bc37ec6 100644 --- a/R/recombinator.null.R +++ b/R/recombinator.null.R @@ -1,24 +1,18 @@ #' The nullRecombinator does not perform any recombination. #' -#' @param setOfIndividuals [\code{setOfIndividuals}]\cr -#' Set of individuals. -#' @param control [\code{list}]\cr -#' Empty list. Intermediate recombinator has no paramerters. -#' @return [\code{setOfIndividuals}] -#' Recombined offspring. +#' @return [\code{ecr_recombinator}] #' @export -nullRecombinator = function(setOfIndividuals, control=list()) { - child = setOfIndividuals$individuals[1, , drop = FALSE] - makePopulation(child) -} - -attr(nullRecombinator, "name") = "null recombinator" -attr(nullRecombinator, "description") = "No description" -attr(nullRecombinator, "supported") = getAvailableRepresentations() -attr(nullRecombinator, "n.parents") = 10L -attr(nullRecombinator, "defaults") = list() -attr(nullRecombinator, "class") = c("ecr_operator", "ecr_recombinator") +makeNullRecombinator = function() { + recombinator = function(setOfIndividuals, control=list()) { + child = setOfIndividuals$individuals[1, , drop = FALSE] + makePopulation(child) + } -nullRecombinatorCheck = function(operator.control) {} - -attr(nullRecombinator, "checkFunction") = nullRecombinatorCheck + makeRecombinator( + recombinator = recombinator, + name = "NULL recombinator", + description = "Does not perform any recombination.", + supported = getAvailableRepresentations(), + n.parents = 10L + ) +} diff --git a/inst/examples/1plus1_GA_example.R b/inst/examples/1plus1_GA_example.R index 6d0a398..3613eab 100644 --- a/inst/examples/1plus1_GA_example.R +++ b/inst/examples/1plus1_GA_example.R @@ -40,8 +40,8 @@ control = ecr.control( survival.strategy = "plus", n.params = n.params, generator = makeBinaryGenerator(), - mutator = list(bitflipMutator), - recombinator = crossoverRecombinator, + mutator = list(makeBitFlipMutator()), + recombinator = makeCrossoverRecombinator(), # see the literature on 1+1 GA for this parameter recommendation mutator.control = list(mutator.flip.prob = 1 / n.params), stopping.conditions = list(makeMaximumIterationsStoppingCondition(max.iter = 500L)) diff --git a/inst/examples/tspmeta_example.R b/inst/examples/tspmeta_example.R index 3f079e4..a7bd248 100644 --- a/inst/examples/tspmeta_example.R +++ b/inst/examples/tspmeta_example.R @@ -37,8 +37,8 @@ control = ecr.control( elite.size = 1L, n.params = tspmeta:::number_of_cities(inst), generator = makePermutationGenerator(), - mutator = list(swapMutator), - recombinator = nullRecombinator, + mutator = list(makeSwapMutator()), + recombinator = makeNullRecombinator(), stopping.conditions = list(makeMaximumIterationsStoppingCondition(max.iter = 200L)) ) print(control) diff --git a/man/bitflipMutator.Rd b/man/bitflipMutator.Rd deleted file mode 100644 index 07d24be..0000000 --- a/man/bitflipMutator.Rd +++ /dev/null @@ -1,40 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/mutator.bitflip.R -\docType{data} -\name{bitflipMutator} -\alias{bitflipMutator} -\title{Bitplip mutation operator.} -\format{\preformatted{function (setOfIndividuals, control) - - attr(*, "name")= chr "Bitplip mutator" - - attr(*, "description")= chr "Flips each bit of the allele with a specific probability." - - attr(*, "supported")= chr "binary" - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_mutator" - - attr(*, "defaults")=List of 1 - ..$ mutator.flip.prob: num 0.1 - - attr(*, "checkFunction")=function (setOfIndividuals, control) - ..- attr(*, "name")= chr "Bitplip mutator" - ..- attr(*, "description")= chr "Flips each bit of the allele with a specific probability." - ..- attr(*, "supported")= chr "binary" - ..- attr(*, "class")= chr [1:2] "ecr_operator" "ecr_mutator" - ..- attr(*, "defaults")=List of 1 - .. ..$ mutator.flip.prob: num 0.1 -}} -\usage{ -bitflipMutator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -Not used.} -} -\value{ -[\code{setOfIndividuals}] - Set of individuals. -} -\description{ -Bitplip mutation operator. -} -\keyword{datasets} - diff --git a/man/crossoverRecombinator.Rd b/man/crossoverRecombinator.Rd deleted file mode 100644 index 633a066..0000000 --- a/man/crossoverRecombinator.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/recombinator.crossover.R -\docType{data} -\name{crossoverRecombinator} -\alias{crossoverRecombinator} -\title{Generator of the crossover recombination operator.} -\format{\preformatted{function (setOfIndividuals, control = list()) - - attr(*, "name")= chr "Crossover recombinator" - - attr(*, "description")= chr "No description" - - attr(*, "supported")= chr [1:2] "float" "binary" - - attr(*, "n.parents")= int 2 - - attr(*, "defaults")= list() - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_recombinator" - - attr(*, "checkFunction")=function (operator.control) -}} -\usage{ -crossoverRecombinator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -Empty list. Intermediate recombinator has no parameters.} -} -\value{ -[\code{setOfIndividuals}] - Recombined offspring. -} -\description{ -Generator of the crossover recombination operator. -} -\keyword{datasets} - diff --git a/man/ecr.control.Rd b/man/ecr.control.Rd index caba902..53daed0 100644 --- a/man/ecr.control.Rd +++ b/man/ecr.control.Rd @@ -9,8 +9,8 @@ ecr.control(population.size, offspring.size, survival.strategy = "plus", elite.size = 0L, n.params, target.name = "y", save.population.at = integer(0), mating.pool.generator = simpleMatingPoolGenerator, - generator = makeUniformGenerator(), mutator = list(gaussMutator), - recombinator = intermediateRecombinator, mutator.control = list(), + generator = makeUniformGenerator(), mutator = list(makeGaussMutator()), + recombinator = makeIntermediateRecombinator(), mutator.control = list(), recombinator.control = list(), monitor = makeConsoleMonitor(), stopping.conditions = list()) } diff --git a/man/gaussMutator.Rd b/man/gaussMutator.Rd deleted file mode 100644 index 6df7d85..0000000 --- a/man/gaussMutator.Rd +++ /dev/null @@ -1,40 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/mutator.gauss.R -\docType{data} -\name{gaussMutator} -\alias{gaussMutator} -\title{Generator of the Gauss mutation operator.} -\format{\preformatted{function (setOfIndividuals, control = list(mutator.gauss.prob = 1, mutator.gauss.sd = 0.05)) - - attr(*, "name")= chr "Gauss mutator" - - attr(*, "description")= chr "Adds gaussian noise to each gene" - - attr(*, "supported")= chr "float" - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_mutator" - - attr(*, "defaults")=List of 2 - ..$ mutator.gauss.prob: num 1 - ..$ mutator.gauss.sd : num 0.05 - - attr(*, "checkFunction")=function (operator.control) -}} -\usage{ -gaussMutator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -List containing evolutionary operators for fine-tuning the mutation operator. -The \code{gaussMutator} function expects the two values: -\itemize{ - \item{mutator.gauss.prob [\code{numeric(1)}]}{Probability of mutation for the gauss mutation operator.} - \item{mutator.gauss.sd [\code{numeric(1)}}{Standard deviance of the Gauss mutation, i. e., the mutation strength.} -}} -} -\value{ -[\code{setOfIndividuals}] - Set of individuals. -} -\description{ -Default Gauss mutation operator known from Evolutionary Algorithms. -} -\keyword{datasets} - diff --git a/man/intermediateRecombinator.Rd b/man/intermediateRecombinator.Rd deleted file mode 100644 index 4b4cf1f..0000000 --- a/man/intermediateRecombinator.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/recombinator.intermediate.R -\docType{data} -\name{intermediateRecombinator} -\alias{intermediateRecombinator} -\title{Generator of the indermediate recombination operator.} -\format{\preformatted{function (setOfIndividuals, control = list()) - - attr(*, "name")= chr "Intermediate recombinator" - - attr(*, "description")= chr "No description" - - attr(*, "supported")= chr "float" - - attr(*, "n.parents")= int 10 - - attr(*, "defaults")= list() - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_recombinator" - - attr(*, "checkFunction")=function (operator.control) -}} -\usage{ -intermediateRecombinator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -Empty list. Intermediate recombinator has no parameters.} -} -\value{ -[\code{setOfIndividuals}] - Recombined offspring. -} -\description{ -Generator of the indermediate recombination operator. -} -\keyword{datasets} - diff --git a/man/makeBitFlipMutator.Rd b/man/makeBitFlipMutator.Rd new file mode 100644 index 0000000..036b02c --- /dev/null +++ b/man/makeBitFlipMutator.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/mutator.bitflip.R +\name{makeBitFlipMutator} +\alias{makeBitFlipMutator} +\title{Bitplip mutation operator.} +\usage{ +makeBitFlipMutator(mutator.flip.prob = 0.1) +} +\arguments{ +\item{mutator.flip.prob}{[\code{numeric(1)}]\cr +Probability to flip a single bit. Default is \code{0.1}.} +} +\value{ +[\code{ecr_mutator}] +} +\description{ +Bitplip mutation operator. +} + diff --git a/man/makeCrossoverRecombinator.Rd b/man/makeCrossoverRecombinator.Rd new file mode 100644 index 0000000..a5d3ae5 --- /dev/null +++ b/man/makeCrossoverRecombinator.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/recombinator.crossover.R +\name{makeCrossoverRecombinator} +\alias{makeCrossoverRecombinator} +\title{Generator of the crossover recombination operator.} +\usage{ +makeCrossoverRecombinator() +} +\value{ +[\code{ecr_recombinator}] +} +\description{ +Generator of the crossover recombination operator. +} + diff --git a/man/makeGaussMutator.Rd b/man/makeGaussMutator.Rd new file mode 100644 index 0000000..17ebcb1 --- /dev/null +++ b/man/makeGaussMutator.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/mutator.gauss.R +\name{makeGaussMutator} +\alias{makeGaussMutator} +\title{Generator of the Gauss mutation operator.} +\usage{ +makeGaussMutator(mutator.gauss.prob = 1L, mutator.gauss.sd = 0.05) +} +\arguments{ +\item{mutator.gauss.prob}{[\code{numeric(1)}]\cr +Probability of mutation for the gauss mutation operator.} + +\item{mutator.gauss.sd}{[\code{numeric(1)}\cr +Standard deviance of the Gauss mutation, i. e., the mutation strength.} +} +\value{ +[\code{ecr_mutator}] +} +\description{ +Default Gauss mutation operator known from Evolutionary Algorithms. +} + diff --git a/man/makeIntermediateRecombinator.Rd b/man/makeIntermediateRecombinator.Rd new file mode 100644 index 0000000..53c69a7 --- /dev/null +++ b/man/makeIntermediateRecombinator.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/recombinator.intermediate.R +\name{makeIntermediateRecombinator} +\alias{makeIntermediateRecombinator} +\title{Generator of the indermediate recombination operator.} +\usage{ +makeIntermediateRecombinator() +} +\value{ +[\code{ecr_recombinator}] +} +\description{ +Generator of the indermediate recombination operator. +} + diff --git a/man/makeNullRecombinator.Rd b/man/makeNullRecombinator.Rd new file mode 100644 index 0000000..f362fb8 --- /dev/null +++ b/man/makeNullRecombinator.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/recombinator.null.R +\name{makeNullRecombinator} +\alias{makeNullRecombinator} +\title{The nullRecombinator does not perform any recombination.} +\usage{ +makeNullRecombinator() +} +\value{ +[\code{ecr_recombinator}] +} +\description{ +The nullRecombinator does not perform any recombination. +} + diff --git a/man/makeSwapMutator.Rd b/man/makeSwapMutator.Rd new file mode 100644 index 0000000..13ecb27 --- /dev/null +++ b/man/makeSwapMutator.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/mutator.swap.R +\name{makeSwapMutator} +\alias{makeSwapMutator} +\title{Swap mutation operator.} +\usage{ +makeSwapMutator() +} +\value{ +[\code{ecr_mutator}] +} +\description{ +Swap mutation operator. +} + diff --git a/man/nullRecombinator.Rd b/man/nullRecombinator.Rd deleted file mode 100644 index ba1e7f2..0000000 --- a/man/nullRecombinator.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/recombinator.null.R -\docType{data} -\name{nullRecombinator} -\alias{nullRecombinator} -\title{The nullRecombinator does not perform any recombination.} -\format{\preformatted{function (setOfIndividuals, control = list()) - - attr(*, "name")= chr "null recombinator" - - attr(*, "description")= chr "No description" - - attr(*, "supported")= chr [1:4] "permutation" "binary" "float" "integer" - - attr(*, "n.parents")= int 10 - - attr(*, "defaults")= list() - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_recombinator" - - attr(*, "checkFunction")=function (operator.control) -}} -\usage{ -nullRecombinator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -Empty list. Intermediate recombinator has no paramerters.} -} -\value{ -[\code{setOfIndividuals}] - Recombined offspring. -} -\description{ -The nullRecombinator does not perform any recombination. -} -\keyword{datasets} - diff --git a/man/swapMutator.Rd b/man/swapMutator.Rd deleted file mode 100644 index 4a6cfa2..0000000 --- a/man/swapMutator.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand -% Please edit documentation in R/mutator.swap.R -\docType{data} -\name{swapMutator} -\alias{swapMutator} -\title{Swap mutation operator.} -\format{\preformatted{function (setOfIndividuals, control = list()) - - attr(*, "name")= chr "Swap mutator" - - attr(*, "description")= chr "Swaps two alleles" - - attr(*, "supported")= chr "permutation" - - attr(*, "class")= chr [1:2] "ecr_operator" "ecr_mutator" - - attr(*, "defaults")= list() - - attr(*, "checkFunction")=function (operator.control) -}} -\usage{ -swapMutator -} -\arguments{ -\item{setOfIndividuals}{[\code{setOfIndividuals}]\cr -Set of individuals.} - -\item{control}{[\code{list}]\cr -Not used.} -} -\value{ -[\code{setOfIndividuals}] - Set of individuals. -} -\description{ -Swap mutation operator. -} -\keyword{datasets} -