Hide Comments
Hide Comments

Comments (0)

Defines the string labels or enumerated values for an gtEnumeration gene ( GeneType ). Use the AsEnumeration property to read and write the enumerated values into the bits of the chromosome. When you change the number of strings that are in the Enumerations string list, the TRSGAGene class automatically recalculates the  Size (number of bits) of the gene in order to properly store all enumerated values

Namespace: RSGeneticAlgorithm

expandingSyntax

Delphi

published
  property Enumerations: TStrings read GetEnumerations write SetEnumerations stored IsEnumeration;
 

Property Value

Type: TStrings

expandingExamples

The following example sets up and uses an enumeration with four values:

Delphi

begin
      with RSGeneticAlgorithm1.Genes.Add do
      begin
           GeneType := gtEnumeration;
           // define the enumerations
           Enumerations.Add('one');
           Enumerations.Add('two');
           Enumerations.Add('three');
           Enumerations.Add('four');
           // set all individual's chromosome for this gene to the enumerated value 'two'
           for i := 0 to RSGeneticAlgorithm1.Population.Count - 1 do
             AsEnumeration[i] := 'two';
      end;
 end;

expandingSee Also

Comments (0)