Hide Comments
Hide Comments

Comments (0)

Provides a mapping for an entire sequence of genes in the chromosome of the population of the RSGeneticAlgorithm.TRSCustomGeneticAlgorithm component and its descendants. The TRSGAGenes collection maintains the list of all genes. The TRSCustomGeneticAlgorithm class contains a population of individuals ( RSGeneticAlgorithm.TRSGAPopulation ), which contain chromosomes (Bits property). These chromosomes are used to abstractly represent the solution to the search problem. They represent through their bits the DNA of each candidate solution (or individual), represented by a RSGeneticAlgorithm.TRSGAIndividual class. The chromosomes are created by taking the parameters or factors (integers, booleans, floats, and enumerations) of your search problem and concatenating them together into a sequence of bits. Each gene, RSGeneticAlgorithm.TRSGAGene , of the collection provides a mapping for a section of the chromosome. Each gene occupies a number of bits of the chromosome (based on their Size property). The Size property of the collection tracks the number of bits necessary for the entire chromosome.

Use the properties and methods of TRSGAGenes to:

Access a specific gene.
Add or delete genes from the list.
Get or set the values of individual genes.
Iterate through all genes.
Read and write genes to XML.

noteNote

Genes are optional (instead, you can use the GeneSize property). These classes help you decode the bits of an individual but if you don't want to use them, you do not have to. If they are defined, the size of the chromosomes for every individual is the same.

Namespace: RSGeneticAlgorithm

expandingInheritance Hierarchy

TOwnedCollection
  RSGeneticAlgorithm.TRSGAGenes
 

expandingSyntax

Delphi

type 
  TRSGAGenes = class(TOwnedCollection) 
  end;  
 

expandingProperties

 

Name

Description

public property

Items[Integer]

Lists the individual genes of a TRSGAGenes object. Use the Items property to iterate through all the genes. Index identifies the index in the range 0 to Count - 1.
 

public property

Size

Returns the number of bits necessary for the entire chromosome. Each individual gene occupies a number of bits of the chromosome (based on their Size property).
 

Top

expandingMethods

 

Name

Description

public method

Add

Creates a new gene ( RSGeneticAlgorithm.TRSGAGene) and adds it to the Items array. Call Add to create a gene in the collection. The new gene is placed at the end of the Items array. The Add method returns the new gene

public method

FindItemID(Integer)

Returns the item with the specified ID.

The FindItemID method returns the item in the collection whose ID property is passed to it as a parameter. If no item has the specified ID, FindItemID returns nil.
 
 

public method

Insert(Integer)

Creates a new RSGeneticAlgorithm.TRSGAGene instance and adds it to the Items array.

Call Insert to add a new item at a specified position in the collection. Existing items (starting from the specified position) are moved up in the     Items array.

Insert returns the new collection item.
 

public method

LoadFromXML(IXMLGenoType)

Loads the entire collection of genes from the XML parameter. The old genes are first cleared.

protected method

Notify(TCollectionItem,TCollectionNotification)

Represents method Notify(TCollectionItem,TCollectionNotification).

public method

Owner

Returns the RSGeneticAlgorithm.TRSCustomGeneticAlgorithm component that owns the genes.

public method

SaveToXML(IXMLGenes,TRSGAIndividual)

Overloaded. Saves the specific individual's chromosome values to the XML parameter.

public method

SaveToXML(IXMLGenoType)

Overloaded. Saves all the genes to the XML parameter.

protected method

SizeChange(Integer)

Represents method SizeChange(Integer).

protected method

Update(TCollectionItem)

Represents method Update(TCollectionItem).

protected method

UpdateOffsets(Integer)

Represents method UpdateOffsets(Integer).

Top

expandingSee Also

Reference

Comments (0)