The TRSGABits class is a descendant class of the TRSEncodedBits class which adds methods useful for genetic operations: CrossOver, Mutate, and Invert. This class is used by the RSGeneticAlgorithm.TRSGAIndividual class to hold the genetic information, or chromosome, of each individual in a genetic algorithm population.
Namespace: RSGeneticAlgorithm
TRSEncodedBits
RSGeneticAlgorithm.TRSGABits

Delphi

type
TRSGABits = class(TRSEncodedBits)
end;


Name

Description


Owner

Returns the individual that owns the genetic information encoded in the TRSGABits instantiation.

Top


Name

Description


Clear

Resets all bits to 0


CrossOver(TRSGABits,TRSGABits)

Overloaded. Modifies the bits of the current object by mixing the bits of the two Source bits, or Parents. The method randomly selects a crossover point and then copies bits from Source1 from the first bit to the crossover bit and then copies bits from Source2 from the crossover bit to the last bit. Thus, the current bits object becomes the child of the two parent bits.


CrossOver(TRSGABits,TRSGABits,Integer)

Overloaded. Modifies the bits of the current object by mixing the bits of the two Source bits, or Parents. The method uses the CrossBit crossover point to copy bits from Source1 from the first bit to the crossover bit and then copy bits from Source2 from the crossover bit to the last bit. Thus, the current bits object becomes the child of the two parent bits.


Invert(Integer,Integer)

Flips the bits in range of bits specified from Offset to Offset + Len. If Offset or Len are 1, the method selects a random number within the range of bits in the object.


Mutate(TGAProbability)

Randomly mutates the bits in the object. The method steps through all of the bits of the object. For each bit, the Mutate method has a chance (based on the MutationProbability) to flip the bit, e.g., from True to False, or from False to True. If any bits are mutated, the method returns True.


Randomize

Randomizes the bits of the class, e.g., it arbitrarily sets bits to True or False.


ToString

Returns a string representation (0s and 1s) of the bits in the object

Top

Reference
•  RSEncodedBitsTRSEncodedBits 
