mutate: Genetic Algorithms Mutation Operation

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Performs a mutation operation for a given rate on an offspring.

Usage

1
mutate(rate, offspring)

Arguments

rate

The rate of mutation.

offspring

The candidate solution (a vector of 0's and 1's) to potentially mutate.

Value

The mutated or unmutated candidate.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Y <- mtcars$mpg
X <- mtcars[2:11]
P = 2 * ncol(X)
regType = 'lm'
family = 'gaussian'
seed = 1

initPop <- initialize(Y, X, P, regType, family, seed)
crossoverSingle <- crossover(initPop[[1]]$variables,
initPop[[2]]$variables, "single")

mutate(rate = .05, offspring = crossoverSingle$child1

erickim/GA documentation built on May 28, 2019, 7:15 a.m.