- 1 GeneticAlgorithm Object Events
- 2 Population Object Events
- 3 Crossover Object Events
- 4 See Also
GeneticAlgorithm Object Events
OnInitialEvaluationComplete(object sender, GaEventArgs e)
This event fires just after the initial evaluation has taken place. This can be thought of as Generation 0. It only fires once per run.
The event presents the GaEventArgs object which will contains the evaluated population, the generation number (0 in this case) and the number of evaluations.
OnGenerationComplete(object sender, GaEventArgs e)
This event fires when a generation has completed, i.e. when all of the genetic operators have been applied and the solutions have completed any final evaluations.
The event presents the GaEventArgs object which will contains the evaluated population, the generation number (1 to n in this case) and the number of evaluations. This event does not fire at generation 0.
OnRunComplete(object sender, GaEventArgs e)
This event fires when a GA run has completed.
The event presents the GaEventArgs object which will contains the evaluated population, the final generation number and the number of evaluations.
Population Object Events
OnEvaluationBegin(object sender, EvaluationEventArgs e)
This event is invoked just before the population is evaluated. The event arguments include the solutions selected for evaluation and a reference to the fitness function specified for use.
The Cancel event argument property, if set to true, will prevent the evaluation of the population from taking place. This can be useful if the event is used to perform an evaluation of the population. Returning _true_ prevents the normal evaluation from taking place. Where some evaluations are conducted within the event, the _Evaluations_ property can be used to pass back the number of evaluations that were undertaken. This will ensure that the statistics for the GA run remain accurate and allows any terminate function, that relies on the number of evaluations, to work correctly.
An specific example that makes full use of this event, can be found Evaluating on a Network of Computers.
Crossover Object Events
OnCrossoverComplete(object sender, CrossoverEventArgs e)
This event fires once a crossover has taken place. The Event arguments include the CrossoverData object which contains a list of integers representing the crossover point(s).