|
OnCrossover
|
Occurs when two parents ( RSGeneticBase.TRSIndividual) have reproduced to create new children and some portion of the their DNA are about to be combined from the parents. The DoMutation parameter controls whether the crossover will occur. It has already been set based on the CrossoverProbability (and so sometimes will be True and sometimes will be False). Set the DoMutation parameter either to force the crossover to occur or to prohibit it from occuring.
|
|
OnEvaluateFitness
|
Occurs when the EvaluateFitness method is called. Use the OnEvaluateFitness event to define your fitness function for the genetic algorithm. Defining your fitness function is another highly important part of defining a genetic algorithm. The fitness function returns a floating point value that specifies the correctness of the individual solution. The fitness function needs to be able to allow the genetic component to decide which solution is better than another. The genetic component will seek to either maximize the solution (e.g., keep evolving for individuals whose fitness are greater than other individuals in the population) or to minimize the solution (e.g., find the individuals whose fitness are less than other individuals). Note you can specify which direction to evolve towards with the FitnessMethod property.
Use the OnEvaluateFitness event to calculate each TRSIndividual's fitness level. Without an OnEvaluateFitness event handler all individuals in the population will have a default Fitness of 0. Every generation, when the Evolve method is called, the OnEvaluateFitness event will occur Population.Count number of times.
|
|
OnEvaluateWeightedFitness
|
Occurs when the genetic component needs to evaluate weighted fitness for an individual.
Weighted Fitness allows weighting the fitness for searching the solution space to guide the search. Fitness still evaluates if an individual solves the problem, but the weighted fitness can help constrain the search. For example, genetic programs can weight the fitness by reducing the fitness by the size of the program (limiting growth).
|
|
OnInitialization
|
Occurs when the Initialize method is called. Use the OnInitialization event to react to the initialization of the genetic algorithm problem or to pre-seed the Population with specific individuals. The OnInitialization event occurs after the Population is created but before their DNA are randomized and their fitness evaluated. Set the Initialized variable to True to prevent the Initialize method from randomizing the Population's DNA.
|
|
OnInitializeChild
|
Occurs when the two Parent parameters are reproducing to create the new Child (Reproduce method). The OnInitializeChild event occurs after the Child has been created and been copied from the first Parent and before the genetic Operations are performed. Use the OnInitializeChild event to react to the creation of the new Child or to modify the Child.
|
|
OnInversion
|
Occurs when two parents (TRSIndividual) have reproduced to create a new child and some portion of the child's DNA is about to be inverted. The DoMutation parameter controls whether the inversion will occur. It has already been set based on the InversionProbability (and so sometimes will be True and sometimes will be False). Set the DoMutation parameter either to force the inversion to occur or to prohibit it from occurring.
|
|
OnMutation
|
Occurs when two parents (TRSIndividual) have reproduced to create a new child and some portion of the child's DNA is about to be mutated. The DoMutation parameter controls whether the mutation will occur. It has already been set based on the MutationProbability (and so sometimes will be True and sometimes will be False). Set the DoMutation parameter either to force the mutation to occur or to prohibit it from occurring.
|
|
OnReproduction
|
Occurs when two parent individuals (TRSIndividual) Reproduce to create a new child. The OnReproduction event occurs after the child has been created and then its DNA possibly combined, mutated, and inverted. Use the OnReproduction event to perform some action after reproduction has occurred. The OnReproduction event can also be useful for validation, to verify the various Operations haven't produced an invalid child.
|
|
OnSelection
|
Occurs when the genetic component needs to select parents for Reproduction. The OnSelection event is only called if the SelectionMethod is smCustom. Use the OnSelection event to write your own selection method.
|