Selectors – selection methods module

This module have the selection methods, like roulette wheel, tournament, ranking, etc.

Selectors.GRankSelector(population, **args)

The Rank Selector - This selector will pick the best individual of the population every time.

Selectors.GRouletteWheel(population, **args)

The Roulette Wheel selector

Selectors.GRouletteWheel_PrepareWheel(population)

A preparation for Roulette Wheel selection

Selectors.GTournamentSelector(population, **args)

The Tournament Selector

It accepts the tournamentPool population parameter.

Note

the Tournament Selector uses the Roulette Wheel to pick individuals for the pool

Changed in version 0.6: Changed the parameter poolSize to the tournamentPool, now the selector gets the pool size from the population.

Selectors.GTournamentSelectorAlternative(population, **args)

The alternative Tournament Selector

This Tournament Selector don’t uses the Roulette Wheel

It accepts the tournamentPool population parameter.

Selectors.GUniformSelector(population, **args)

The Uniform Selector

Selectors.key_fitness_score(individual)

A key function to return fitness score, used by max()/min()

Parameters:individual – the individual instance
Return type:the individual fitness score

Note

this function is used by the max()/min() python functions

Selectors.key_raw_score(individual)

A key function to return raw score

Parameters:individual – the individual instance
Return type:the individual raw score

Note

this function is used by the max()/min() python functions