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.

noteNote

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

Namespace: RSGeneticBase

expandingSyntax

Delphi

public
  property CrossoverProbability: TGAProbability read FCrossoverProbability write SetCrossoverProbability stored IsCrossoverProbabilityStored;
 

Property Value

Type: TGAProbability

expandingExamples

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

Delphi

function TRSCustomGeneticComponent.DoReproduce(const Parent1, Parent2,
   Child: TRSIndividual): Boolean;
 begin
   // 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;
 end;

expandingSee Also

Comments (0)