Hide Comments
Hide Comments

Comments (0)

Controls the likelihood that inversion will occur in a child's DNA or chromosome, e.g., whether a portion of the child's chromosome will be flipped. The probability is between 0 (no chance) and 1 (always). When 2 parents reproduce and create a new child, their chromosomes are combined using Crossover and then the child's chromosome may be mutated and/or inverted. The InversionProbability is checked once per child.

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

noteNote

In genetic programming, inversion is actually a point mutation (i.e., a node in an individual's GP tree may be flipped and become a different instruction of the same arity and type). You can either 0 out the probability here and handle it all in the mutation phase or leave it in.

Namespace: RSGeneticBase

expandingSyntax

Delphi

public
  property InversionProbability: TGAProbability read FInversionProbability write SetInversionProbability stored IsInversionProbabilityStored;
 

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)