Package Bio :: Package GA :: Package Selection :: Module Tournament :: Class TournamentSelection
[show private | hide private]
[frames | no frames]

Class TournamentSelection

AbstractSelection --+
                    |
                   TournamentSelection


Implement tournament style selection.
Method Summary
  __init__(self, mutator, crossover, repairer, num_competitors)
Initialize the tournament selector.
  select(self, population)
Perform selection on the population using the Tournament model.
  _fitness_cmp(self, org_1, org_2)
Comparison function for comparing two organisms.
    Inherited from AbstractSelection
  mutate_and_crossover(self, org_1, org_2)
Perform mutation and crossover on the two organisms.

Method Details

__init__(self, mutator, crossover, repairer, num_competitors=2)
(Constructor)

Initialize the tournament selector.

Arguments:

o num_competitors-- The number of individiuals that should be involved in a selection round. By default we just have two individuals (head to head!).

See AbstractSelection for a description of the arguments to the initializer.
Overrides:
Bio.GA.Selection.Abstract.AbstractSelection.__init__

select(self, population)

Perform selection on the population using the Tournament model.

Arguments:

o population -- A population of organisms on which we will perform selection. The individuals are assumed to have fitness values which are due to their current genome (ie. the fitness is up to date).
Overrides:
Bio.GA.Selection.Abstract.AbstractSelection.select

_fitness_cmp(self, org_1, org_2)

Comparison function for comparing two organisms.

This just allows us to easily sort organisms by fitness.

Generated by Epydoc 2.1 on Thu Jun 30 22:06:12 2005 http://epydoc.sf.net