Hide Comments
Hide Comments

Comments (0)

Controls the likelihood that crossover (also known as recombination) will occur when 2 parents are selected to create a new child. When crossover occurs, the 2 parents genes or DNA are combined to make the child. The crossover probability is checked for each new child (e.g., if there are 100 children created each generation, the CrossoverProbability will be tested 100 times).

The Operations property controls whether crossover occurs at all during evolution.


If crossover does not occur, the child is a duplicate of the first parent (but may be mutated or inverted).

Namespace: RSGeneticBase



  property CrossoverProbability: TGAProbability read FCrossoverProbability write SetCrossoverProbability stored IsCrossoverProbabilityStored;

Property Value

Type: TGAProbability


The following code modifies a child based on CrossOver, Mutation, and Inversion:


function TRSCustomGeneticComponent.DoReproduce(const Parent1, Parent2,
   Child: TRSIndividual): Boolean;
   // return true if any of the genetic operations besides initialize child occured
   result := False;
   InitializeChild(Parent1, Parent2, Child);
   // crossover
   if goCrossover in Operations then
     result := Crossover(Parent1, Parent2, Child);
   // mutate
   if goMutate in Operations then
     result := Mutate(Child) or result;
   // invert
   if goInvert in Operations then
     result := Invert(Child) or result;

expandingSee Also

Comments (0)