Show/Hide Toolbars

RiverSoftAVG Products Help

The TRSGeneticAlgorithm component is the descendant class of the RSGeneticAlgorithm.TRSCustomGeneticAlgorithm component which publishes all the properties needed to use genetic algorithms in your programs.

Genetic algorithms seek to solve optimization or search problems. They are inspired by evolutionary biology and approach the search problem as a task of evolving a group or population of candidate individuals through successive generations, selecting fitter (or better) child individuals for each generation, until a solution is found. It uses evolutionary biology techniques such as inheritance, mutation, selection, and crossover (also called recombination).

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.

The RSGeneticAlgorithm.TRSGAGene provides a mapping that gives meaning to the bits in the individual. The TRSGAGene class is a helper class (available through the Genes property) which helps you define and manipulate the genes of your population easily by defining n-bit integers, booleans, floats, etc. Each gene defines a characteristic of an individual. While the chromosomes are specific to an individual, the gene definition (TRSGAGene) defines the meaning of each gene for the entire population.


Genes are optional. 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.

After setting up the genes of your population (either by using the    Genes property to define each gene separately or the    GeneSize property to just define the number of bits in the chromosome with no mapping), you set the    InitialPopulation, define a fitness function (    OnEvaluateFitness event) to properly "score" each individual, and then Evolve your solution.

Namespace: RSGeneticAlgorithm

RiverSoftAVG Products Help © 1996-2016 Thomas G. Grubb