_tournament

Module Contents

Functions

tournament(→ int)

Perform tournament selection and return the index of the best individual.

Attributes

Fitness

Fitness
tournament(rng: numpy.random.Generator, fitnesses: list[Fitness], k: int) int

Perform tournament selection and return the index of the best individual.

Parameters:
  • rng – Random number generator.

  • fitnesses – List of finesses of individuals that joint the tournamente.

  • k – Amount of individuals to participate in tournament.

Returns:

The index of te individual that won the tournament.