byte_crossover function

Performs crossover operation on a pair of two selected parent candidate solutions

Performs crossover operation on a pair of two selected parent candidate solutions

This function is not called directly but is given as a parameter in GA::ga function. In GA::ga, if the parameter crossover= is set to byte_crossover than the byte-coded crossover operator is applied in the genetic search. In mcga2 function, the hard-coded crossover parameter is set to byte_crossover by definition. byte_crossover function simply takes two double vectors (parents) and combines the bytes of doubles using a Uniform distribution with parameters 0 and 1.

byte_crossover(object, parents, ...)

Arguments

  • object: A GA::ga object
  • parents: Indices of the selected parents
  • ...: Additional arguments to be passed to the function

Returns

List of two generated offspring

Examples

f <- function(x){ return(-sum( (x-5)^2 ) ) } myga <- GA::ga(type="real-valued", fitness = f, popSize = 100, maxiter = 200, lower = rep(-50,5), upper = rep(50,5), crossover = byte_crossover, mutation = byte_mutation) print(myga@solution)

Author(s)

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

See Also

mcga2

  • Maintainer: Mehmet Hakan Satman
  • License: GPL (>= 2)
  • Last published: 2023-11-27

Useful links