Home | Trees | Index | Help |
|
---|
Package pygene :: Module population :: Class Population |
|
object
--+ |PGXmlMixin
--+ | Population
Represents a population of organisms
You might want to subclass this
Overridable class variables:Method Summary | |
---|---|
Create a population with zero or more members | |
Produce a whole new population consisting of an aggregate of this population and the other population's members | |
Return the nth member of this population, which we guarantee to be sorted in order from fittest first | |
return the number of organisms in this population | |
crude human-readable dump of population's members | |
Add an organism, or a population of organisms, to this population | |
returns the fittest member of the population | |
returns the average fitness value for the population | |
Executes a generation of the population. | |
randomly select one of the given items (or one of this population's members, if items not given). | |
Sorts this population in order of fitness, with the fittest first. | |
Writes out the contents of this population into the xml tree | |
Inherited from PGXmlMixin | |
Dumps out the population to an open file in XML format. | |
| |
dumps out class information | |
dumps out to xml, returning a string of the raw generated xml | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
int |
childCount = 100 |
int |
childCull = 20 |
int |
incest = 10 |
int |
initPopulation = 10 |
float |
mutants = 0.10000000000000001 |
bool |
mutateAfterMating = True
|
int |
numNewOrganisms = 0 |
type |
species = pygene.organism.Organism |
Method Details |
---|
__init__(self,
*items,
**kw)
|
__add__(self,
other)
Produce a whole new population consisting of an aggregate of this
population and the other population's members
|
__getitem__(self,
n)
Return the nth member of this population, which we guarantee to be
sorted in order from fittest first
|
__len__(self)
return the number of organisms in this population
|
__repr__(self)
crude human-readable dump of population's members
|
add(self, *args)Add an organism, or a population of organisms, to this population You can also pass lists or tuples of organisms and/or populations, to any level of nesting |
best(self)returns the fittest member of the population |
fitness(self)returns the average fitness value for the population |
gen(self, nfittest=None, nchildren=None)Executes a generation of the population. This consists of:
|
getRandom(self, items=None)randomly select one of the given items (or one of this population's members, if items not given). Favours fitter members |
sort(self)Sorts this population in order of fitness, with the fittest first. We keep track of whether this population is in order of fitness, so we don't perform unnecessary and costly sorting |
xmlDumpSelf(self, doc, parent)Writes out the contents of this population into the xml tree
|
Class Variable Details |
---|
childCount
|
childCull
|
incest
|
initPopulation
|
mutants
|
mutateAfterMating
|
numNewOrganisms
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 12 14:37:12 2005 | http://epydoc.sf.net |