Function revonet::ga::cross [] [src]

pub fn cross<R: Rng + Sized, T: Individual + Clone>(
    popul: &Vec<T>,
    sel_inds: &Vec<usize>,
    children: &mut Vec<T>,
    use_elite: bool,
    x_type: CrossoverOperator,
    x_prob: f32,
    x_alpha: f32,
    rng: &mut R
)

Function for crossing individuals to produce children.

Arguments:

  • popul - reference to parent population.
  • sel_inds - reference to vector of individuals selected for crossing.
  • children - container for children individuals.
  • use_elite - flag to specify whether elite individual should be copied to the children population.
  • x_type - crossover operator type defined by CrossoverOperator enum.
  • x_prob - crossing probability. If random U(0, 1) number is above this probability then no crossing is performed and children are simply copy of selected parents.
  • x_alpha - parameter for a crossover operator.
  • rng - reference to pre-initialized RNG.