arithmetic_crossover {mcga} | R Documentation |
Performs arithmetic crossover operation on a pair of two selected parent candidate solutions
Description
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 arithmetic_crossover
than
the arithmetic crossover operator is applied in the genetic search. arithmetic_crossover
generates offspring using the weighted mean of parents' genes. Weights are drawn randomly.
Usage
arithmetic_crossover(object, parents, ...)
Arguments
object |
A |
parents |
Indices of the selected parents |
... |
Additional arguments to be passed to the function |
Value
List of two generated offspring
Author(s)
Mehmet Hakan Satman - mhsatman@istanbul.edu.tr
Examples
f <- function(x){
return(-sum( (x-5)^2 ) )
}
myga <- ga(type="real-valued", fitness = f, popSize = 100, maxiter = 100,
min = rep(-50,5), max = rep(50,5), crossover = arithmetic_crossover)
print(myga@solution)
[Package mcga version 3.0.7 Index]