The TRSPopulation class is the base population class for the library. It represents the entire population (the collection of TRSIndividual items) in a Genetic Algorithm or Programming problem.
Genetic components work by evolving your population towards the solution of the problem. Parents are selected from the current generation to reproduce the children of the next generation. Evolving a new generation involves:
• | Selecting 2 parents (Individuals) to reproduce |
• | Splicing the the 2 parents together to make a child (called Crossover) |
• | Optionally Mutating and Inverting the "dna" of the child to provide randomness |
• | Repeating the above steps until the population of the new generation has been produced.
|
Namespace: RSGeneticBase
Delphi
|
type
TRSPopulation = class(TOwnedCollection)
end;
|
|
Name
|
Description
|
|
Items[Integer]
|
Lists the individuals of the population object. Use the Items property to iterate through all the individuals. Index identifies the index in the range 0 to Count - 1.
|
Top
|
|
Name
|
Description
|
|
Add
|
Creates a new individual (TRSIndividual) and adds it to the Items array. Call Add to create an individual or solution in the collection. The new individual is placed at the end of the Items array. The Add method returns the new individual.
|
|
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.
|
|
Insert(Integer)
|
Creates a new instance and adds it to the Items array. Call Insert to add a new value 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 value.
|
|
LoadFromXML(IXMLNode)
|
Loads an entire population and their dna from the XML parameter. The old population is first cleared.
|
|
Notify(TCollectionItem,TCollectionNotification)
|
Represents method Notify(TCollectionItem,TCollectionNotification).
|
|
Owner
|
Returns the RSGeneticBase.TRSCustomGeneticComponent that owns the population.
|
|
SaveToXML(IXMLNode)
|
Saves every individual of the population and its chromosomes to the XML parameter.
|
|
Update(TCollectionItem)
|
Represents method Update(TCollectionItem).
|
Top
|