Implement tournament style selection.
Methods
|
|
__init__
_fitness_cmp
select
|
|
__init__
|
__init__ (
self,
mutator,
crossover,
repairer,
num_competitors=2,
)
Initialize the tournament selector.
Arguments:
See AbstractSelection for a description of the arguments to
the initializer.
Exceptions
|
|
ValueError( "Must have at least 2 competitors!" )
|
|
|
_fitness_cmp
|
_fitness_cmp (
self,
org_1,
org_2,
)
Comparison function for comparing two organisms.
This just allows us to easily sort organisms by fitness.
|
|
select
|
select ( self, population )
Perform selection on the population using the Tournament model.
Arguments:
|
|