Package pyrobot :: Package brain :: Module ga :: Class Population
[frames | no frames]

Class Population


Method Summary
  __init__(self, cnt, geneConstructor, **args)
  __getitem__(self, val)
  __len__(self)
  copy(self)
  select(self)
Select a single individual via the roulette wheel method.
  statistics(self)
Maintains important statistics about the current population.

Method Details

select(self)

Select a single individual via the roulette wheel method.
Algorithm from Goldberg's book, page 63.  NOTE: fitness
function must return positive values to use this method
of selection.

statistics(self)

Maintains important statistics about the current population.
It calculates total fitness, average fitness, best fitness,
and worst fitness.  Stores the best individual in the variable
self.bestMember.  When the elitePercent is greater than zero,
this method also maintains a list of the elite members of the
population so that they can be saved for the next generation.

Generated by Epydoc 2.1 on Mon Jul 25 01:39:26 2005 http://epydoc.sf.net