Learn R Programming

adana (version 1.1.0)

randmut2: Random mutation 2

Description

For each gene, if a random number is less than the mutation rate, the gene's value is modified by adding a random value selected from the normal distribution with a mean of zero and a standard deviation of 0.1x(ub-lb).

This operator is used for value encoded (integer or real number) chromosomes.

Usage

randmut2(y, lb, ub, mutpm, ...)

Arguments

y

A vector. Chromosome of the offspring

lb

A vector. Lower bounds of genes

ub

A vector. Upper bounds of genes

mutpm

Mutation rate

Further arguments passed to or from other methods.

Value

mutant

A vector. Chromosome of the offspring

mutgen

The number of the mutated gene.

See Also

mutate, bitmut, randmut, randmut3, randmut4, unimut, boundmut, nunimut, nunimut2, powmut, powmut2, gaussmut, gaussmut2, gaussmut3, bsearchmut1, bsearchmut2, swapmut, invmut, shufmut, insmut, dismut, invswapmut, insswapmut, invdismut

Examples

Run this code
# NOT RUN {
lb = c( 2,  1, 3, 1, 0, 4)
ub = c(10, 15, 8, 5, 6, 9)
offspring = c(8, 6, 4, 1, 3, 7)
randmut2(offspring, lb=lb, ub=ub, mutpm=0.1)
# }

Run the code above in your browser using DataLab