Learn R Programming

mcga (version 3.0.7)

byte_mutation_random_dynamic: Performs mutation operation on a given double vector with dynamic mutation probabilities

Description

This function is not called directly but is given as a parameter in GA::ga function. In GA::ga, if the parameter mutation= is set to byte_mutation_random_dynamic than the byte-coded mutation operator with dynamic probabilities is applied in the genetic search. In mcga2 function, the hard-coded mutation parameter is set to byte_mutation by definition. This function simply takes an double vector and changes bytes randomly in the range of [0,255] using the descrasing values of pre-determined mutation probabilty by generations.

Usage

byte_mutation_random_dynamic(object, parent, ...)

Value

Mutated double vector

Arguments

object

A GA::ga object

parent

Index of the candidate solution of the current population

...

Additional arguments to be passed to the function

Author

Mehmet Hakan Satman - mhsatman@istanbul.edu.tr

References

M.H.Satman (2013), Machine Coded Genetic Algorithms for Real Parameter Optimization Problems, Gazi University Journal of Science, Vol 26, No 1, pp. 85-95

Examples

Run this code
f <- function(x){ 
  return(-sum( (x-5)^2 ) )
}
# Increase popSize and maxiter for more precise solutions
myga <- GA::ga(type="real-valued", fitness = f, popSize = 100, maxiter = 200, 
              min = rep(-50,5), max = rep(50,5), crossover = byte_crossover,
              mutation = byte_mutation_random_dynamic, pmutation = 0.20)
print(myga@solution)

Run the code above in your browser using DataLab