Learn R Programming

nlmixr2auto (version 1.0.0)

ga.mutation: Mutation operator for binary genetic algorithms

Description

Mutate a binary population by flipping bits with probability pmut.

Usage

ga.mutation(children.cross, pmut)

Value

Numeric matrix containing the mutated population.

Arguments

children.cross

Numeric matrix containing the child population. Rows are individuals and columns are bits. Values are expected to be 0/1.

pmut

Single numeric value in \([0, 1]\) giving the per-bit mutation probability.

Author

Zhonghui Huang

Details

Mutation is applied independently to each bit (gene). For each position, a Bernoulli trial with success probability pmut determines whether the bit is flipped (0 becomes 1, 1 becomes 0).

Examples

Run this code
children.cross <- matrix(sample(0:1, 120, replace = TRUE), nrow = 10)
ga.mutation(children.cross, pmut = 0.1)

Run the code above in your browser using DataLab