slim_gsgp.selection

Selection operator implementation.

slim_gsgp.selection.selection_algorithms.tournament_selection_max(pool_size)[source]

Returns a function that performs tournament selection to select an individual with the highest fitness from a population.

Parameters:

pool_size (int) – Number of individuals participating in the tournament.

Returns:

A function (‘ts’) that elects the individual with the highest fitness from a randomly chosen pool.

param pop:

The population from which individuals are drawn.

type pop:

Population

returns:

The individual with the lowest fitness in the pool.

rtype:

Individual

Return type:

Callable

Notes

The returned function performs tournament selection by receiving a population and returning the best of {pool_size} randomly selected individuals.

slim_gsgp.selection.selection_algorithms.tournament_selection_min(pool_size)[source]

Returns a function that performs tournament selection to select an individual with the lowest fitness from a population.

Parameters:

pool_size (int) – Number of individuals participating in the tournament.

Returns:

A function (‘ts’) that elects the individual with the lowest fitness from a randomly chosen pool.

param pop:

The population from which individuals are drawn.

type pop:

Population

returns:

The individual with the lowest fitness in the pool.

rtype:

Individual

Return type:

Callable

Notes

The returned function performs tournament selection by receiving a population and returning the best of {pool_size} randomly selected individuals.