byte_crossover_1p | R Documentation |
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_1p
than
the byte-coded one-point 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_1p
function simply takes two double vectors
(parents) and combines the bytes of doubles using given cut-point.
byte_crossover_1p(object, parents, ...)
object |
A |
parents |
Indices of the selected parents |
... |
Additional arguments to be passed to the function |
List of two generated offspring
Mehmet Hakan Satman - mhsatman@istanbul.edu.tr
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
mcga2
f <- function(x){
return(-sum( (x-5)^2 ) )
}
myga <- GA::ga(type="real-valued", fitness = f, popSize = 100, maxiter = 200,
min = rep(-50,5), max = rep(50,5), crossover = byte_crossover_1p,
mutation = byte_mutation)
print(myga@solution)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.