gena.mutation {gena} | R Documentation |
Mutation
Description
Mutation method (algorithm) to be used in the genetic algorithm.
Usage
gena.mutation(
children,
lower,
upper,
prob = 0.2,
prob.genes = 1/nrow(children),
method = "constant",
par = 1,
iter = NULL
)
Arguments
children |
numeric matrix which rows are children i.e. vectors of parameters values. |
lower |
lower bound of the search space. |
upper |
upper bound of the search space. |
prob |
probability of mutation for a child. |
prob.genes |
numeric vector or numeric value representing the probability of mutation of a child's gene. See 'Details'. |
method |
mutation method to be used for transforming genes of children. |
par |
additional parameters to be passed depending on the |
iter |
iteration number of the genetic algorithm. |
Details
Denote children
by C^{child}
which i
-th row
children[i, ]
is a chromosome c_{i}^{child}
i.e. the vector of
parameter values of the function being optimized f(.)
that is
provided via fn
argument of gena
.
The elements of chromosome c_{ij}^{child}
are genes
representing parameters values.
Mutation algorithm determines random transformation of children's genes.
Each child may be selected for mutation with probability prob
.
If i
-th child is selected for mutation and prob.genes
is a
vector then j
-th gene of this child
is transformed with probability prob.genes[j]
. If prob.genes
is a constant then this probability is the same for all genes.
Argument method
determines particular mutation algorithm to
be applied. Denote by \tau
the vector of parameters used by the
algorithm. Note that \tau
corresponds to par
.
Also let's denote by c_{ij}^{mutant}
the value of
gene c_{ij}^{child}
after mutation.
If method = "constant"
then c_{ij}^{mutant}
is a uniform random variable between lower[j]
and upper[j]
.
If method = "normal"
then c_{ij}^{mutant}
equals to the sum of c_{ij}^{child}
and normal random variable
with zero mean and standard deviation par[j]
.
By default par
is identity vector of length ncol(children)
so par[j] = 1
for all j
.
If method = "percent"
then c_{ij}^{mutant}
is generated
from c_{ij}^{child}
by equiprobably increasing or decreasing it
by q
percent,
where q
is a uniform random variable between 0
and par[j]
.
Note that par
may also be a constant then all
genes have the same maximum possible percentage change.
By default par = 20
.
For more information on mutation algorithms please see Patil, Bhende (2014).
Value
The function returns a matrix which rows are children (after mutation has been applied to some of them).
References
S. Patil, M. Bhende. (2014). Comparison and Analysis of Different Mutation Strategies to improve the Performance of Genetic Algorithm. International Journal of Computer Science and Information Technologies, 5 (3), 4669-4673.
Examples
# Randomly initialize some children
set.seed(123)
children.n <- 10
children <- gena.population(pop.n = children.n,
lower = c(-5, -5),
upper = c(5, 5))
# Perform the mutation
mutants <- gena.mutation(children = children,
prob = 0.6,
prob.genes = c(0.7, 0.8),
par = 30,
method = "percent")
print(mutants)