mcga (version 3.0.3)

unfair_average_crossover: Performs unfair average 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 unfair_average_crossover than the unfair average crossover operator is applied in the genetic search.

Usage

unfair_average_crossover(object, parents, ...)

Value

List of two generated offspring

Arguments

object

A GA::ga object

parents

Indices of the selected parents

...

Additional arguments to be passed to the function

Author

Mehmet Hakan Satman - mhsatman@istanbul.edu.tr

Examples

Run this code
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 = unfair_average_crossover)
print(myga@solution)

Run the code above in your browser using DataCamp Workspace