Returns the fittest individual in the Population. The individual is chosen based on the FitnessMethod and the Fitness evaluations of all the individuals in the population. The FittestIndividual is chosen every time the population is evolved.
This property is nil if the component is not
Initialized.
Namespace: RSGeneticBase
Delphi
|
public
property FittestIndividual: TRSIndividual read FFittestIndividual;
|
Property Value
Type: TRSIndividual
The following example uses Diversity, Generation and Fitness to automatically stop evolution:
Delphi
|
var
i: Integer;
begin
// evolve population for number of generations, until diversity is too
// low, or best individual meets fitness cutoff and
// return number of generations executed
result := Generation;
for i := 0 to Generations - 1 do
begin
Evolve;
if (UseFitnessCutoff and
(((FitnessMethod in [fmMaximize, fmWeightedMaximize]) and (FittestIndividual.Fitness >= FitnessCutoff)) or
((FitnessMethod in [fmMinimize, fmWeightedMinimize]) and (FittestIndividual.Fitness <= FitnessCutoff)))) or
(UseDiversityLimit and (Diversity < DiversityLimit)) or
(UseGenerationLimit and (Generation >= GenerationLimit)) then Break;
end;
result := Generation - result;
end;
|
|