Defines components for adding genetic algorithms to your applications.
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).
|
Name
|
Description
|
|
TRSCustomGeneticAlgorithm
|
The TRSCustomGeneticAlgorithm component is the base class for including genetic algorithms (GA) in your programs. The descendant class, RSGeneticAlgorithm.TRSGeneticAlgorithm, publishes the properties of this class and is what you will drop on your forms or data module.
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. NOTE: 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. Please see Tasks for more instructions.
|
|
TRSGABits
|
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.
|
|
TRSGAGene
|
Provides the mapping for one gene in the chromosome of the population of the RSGeneticAlgorithm.TRSCustomGeneticAlgorithm component and its descendants. 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 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 of the TRSGeneticAlgorithm component) 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. The TRSGAGenes collection maintains the list of all genes.
NOTE: 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.
|
|
TRSGAGenes
|
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. |
|
|
|
|
|
|
|
|
|
The TRSGAGene class is a helper class (available through the Genes property of the TRSGeneticAlgorithm component) 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.
Note
|
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.
|
|
|
|
|
TRSGAIndividual
|
Represents one individual, or candidate solution, in the Population of solutions in a genetic algorithm problem. In genetic algorithms ( RSGeneticAlgorithm.TRSGeneticAlgorithm component), there is 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 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.Genetic Algorithms then 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 chromosomes of the 2 parents together to make a child (the child inherits the parents chromosomes) • Optionally Mutating and Inverting the chromosome of the child to provide randomness • Repeating the above steps until the population of the new generation has been produced. |
After the new generation is bred, genetic algorithms looks at the new population to see if any of the individuals solve the problem. In genetic algorithms terms, this usually means evaluating the "fitness" of each individual (a numeric score that measures the ability of the individual). If any individual is "fit enough", the evolutionary search stops.
|
|
TRSGAPopulation
|
Represents the entire population (the collection of RSGeneticAlgorithm.TRSGAIndividual items) in a Genetic Algorithms problem. The population class represents the set of candidate solutions in a genetic algorithm problem. In genetic algorithms ( RSGeneticAlgorithm.TRSGeneticAlgorithm component), there is a population of individuals (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 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.
Genetic Algorithms then 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 chromosomes of the 2 parents together to make a child (the child inherits the parents chromosomes) • Optionally Mutating and Inverting the chromosome of the child to provide randomness • Repeating the above steps until the population of the new generation has been produced. |
After the new generation is bred, genetic algorithms looks at the new population to see if any of the individuals solve the problem. In genetic algorithms terms, this usually means evaluating the "fitness" of each individual (a numeric score that measures the ability of the individual). If any individual is "fit enough", the evolutionary search stops.
TRSGeneticAlgorithm
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.
Note
|
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.
Top
|
Name
|
Description
|
|
TRSGACrossoverEvent
|
Defines the method signature for the OnCrossover event. The Parent1 and Parent2 parameters identify the parents of the Child parameter and also the chromosomes that will be recombined into the child. The CrossoverBit defines the bit number to use where the crossover will take place. The DoMutation parameter controls whether the genetic operation will occur at all. Set DoMutation to False to prevent the crossover.
|
|
TRSGAFitnessEvent
|
Defines the method signature for the OnEvaluateFitness event.
|
|
TRSGAIndividualEvent
|
Defines the method signature for events that include a genetic algorithm individual.
|
|
TRSGAMutationEvent
|
Defines the method signature for mutation events like OnMutation and OnInversion in genetic algorithms. Set the DoMutation event to True to force the mutation to occur. Set the DoMutation event to False to prohibit the mutation from occuring for this individual.
|
|
TRSGAParentChildEvent
|
Defines the method signature for genetic algorithm events that contain parents and their child, e.g., OnReproduction.
|
|
TRSGASelectionEvent
|
Defines the method signature for selection events, e.g., where one individual from the Population of individuals must be selected. Set the Parent parameter to the individual you want to be selected and used.
|
|
TRSGeneEvent
|
Defines the method signature for events that work on genes.
|
Top
|