@evolite/core
    Preparing search index...

    Function tournamentSelection

    • Selects two individuals from the population using tournament selection. *

      Type Parameters

      Parameters

      • population: Entity[]

        The current population of individuals.

      Returns Promise<[Entity, Entity]>

      A promise that resolves to a tuple containing the two tournament winners.

      For each parent selection, two individuals are randomly picked from the population, and their fitness values are compared. The individual with the higher fitness wins the tournament and is selected. This process is repeated twice to select both parents. This method balances genetic diversity and selection pressure. *

      If the population has fewer than 2 individuals.