Hide Comments
Hide Comments

Comments (0)

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.

Namespace: RSGeneticBase

expandingSyntax

Delphi

public
  property OnSelection: TRSSelectionEvent read FOnSelection write SetOnSelection stored IsCustomSelection;
 

Value

Type: TRSSelectionEvent

expandingExamples

The following code selects a random parent:

Delphi

procedure TForm1.RSGeneticAlgorithm1Selection(Sender: TObject;
   const Population: TRSGAPopulation; var Parent: TRSGAIndividual);
 begin
      // randomly select parents
      Parent := Population[Random(Population.Count)];
 end;

expandingSee Also

Comments (0)