Hide Comments
Hide Comments

Comments (0)

Defines the number of bits that are used by this gene in the  Population's Chromosome bits. Use this property to create 6-bit integer genes, 24-bit floating point genes, etc. The TRSGAGene class automatically adjusts the size for you when the  GeneType is gtBoolean (1-bit) or gtEnumerations (minimum number of bits to hold all indices into the Enumerations string list), though you are allowed to change this later. Using both the  Offset and the  Size, the gene is able to read and write into a specific area of the bits.

Namespace: RSGeneticAlgorithm

expandingSyntax

Delphi

published
  property Size: Integer read FSize write SetSize;
 

Property Value

Type: Integer

expandingExamples

Here is example code for creating an integer gene:

Delphi

begin
      with RSGeneticAlgorithm1.Genes.Add do
      begin
           GeneType := gtInteger;
           Size := BitsRequired( NUM_QUEENS-1 );
           MaxValue := NUM_QUEENS - 1; // MinValue is 0
      end;
 end;

expandingSee Also

Comments (0)