Hide Comments
Hide Comments

Comments (0)

Specifies the minimum diversity the population must have in order to be considered viable. If the Diversity of the Population falls below this limit, the    Evolve method will abort evolution.

Note the    UseDiversityLimit property must be True to use the diversity limit.
 

Namespace: RSGeneticBase

expandingSyntax

Delphi

public
  property DiversityLimit: TGAProbability read FDiversityLimit write SetDiversityLimit stored IsDiversityLimitStored;
 

Property Value

Type: TGAProbability

expandingExamples

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;

expandingSee Also

Comments (0)