generateOffspring: Helper functions for offspring generation

View source: R/generateOffspring.R

generateOffspringR Documentation

Helper functions for offspring generation

Description

Function mutate expects a control object, a list of individuals, and a mutation probability. The mutation operator registered in the control object is then applied with the given probability to each individual. Function recombinate expects a control object, a list of individuals as well as their fitness matrix and creates lambda offspring individuals by recombining parents from inds. Which parents take place in the parent selection depends on the parent.selector registered in the control object. Finally, function generateOffspring is a wrapper for both recombinate and mutate. Both functions are applied subsequently to generate new individuals by variation and mutation.

Usage

generateOffspring(control, inds, fitness, lambda, p.recomb = 0.7, p.mut = 0.1)

mutate(control, inds, p.mut = 0.1, slot = "mutate", ...)

recombinate(
  control,
  inds,
  fitness,
  lambda = length(inds),
  p.recomb = 0.7,
  slot = "recombine",
  ...
)

Arguments

control

[ecr_control]
Control object.

inds

[list]
List of individuals.

fitness

[matrix]
Matrix of fitness values (each column contains the fitness value(s) of one individual).

lambda

[integer(1)]
Number of individuals generated in each generation.

p.recomb

[numeric(1)]
Probability of two parents to perform crossover. Default is 0.7.

p.mut

[numeric(1)]
The probability that the mutation operator will be applied to a child. Refers only to the application of the mutation operator, not to the probability of mutating individual genes of the respective child. Default is 0.1.

slot

[character(1)]
The slot of the control object which contains the registered operator to use. Default is “mutate” for mutate and “recombine” for recombinate. In most cases there is no need to change this. However, it might be useful if you make use of different mutation operators registerted, e.g., in the slots “mutate1” and “mutate2”.

...

[any]
Furhter arguments passed down to recombinator/mutator. There parameters will overwrite parameters in par.list.

Value

[list] List of individuals.


ecr documentation built on March 31, 2023, 10:07 p.m.