Home | Trees | Index | Help |
|
---|
Package pygene :: Module organism :: Class Organism |
|
object
--+ |PGXmlMixin
--+ |BaseOrganism
--+ | Organism
Simple genetic algorithms organism
Contains only single genes, not pairs (ie, single-helix)
Note - all organisms are hermaphrodites, which can reproduce by mating with another. In this implementation, there is no gender.
Class variables (to override) are:Method Summary | |
---|---|
Initialises this organism randomly, or from a set of named gene keywords | |
allows shorthand for querying the phenotype of this organism | |
returns a deep copy of this organism | |
Produce a detailed human-readable report on this organism, its genotype and phenotype | |
Mates this organism with another organism to produce two entirely new organisms via random choice of genes from this or the partner | |
Implement the mutation phase, invoking the stochastic mutation method on each component gene | |
Returns the phenotype resulting from a given gene, OR the total phenotype resulting from all the genes | |
Dumps out this object's contents into an xml tree | |
Inherited from BaseOrganism | |
Allows '+' operator for sexual reproduction | |
Convenience method which invokes duel | |
Delivers a minimal string representation of this organism. | |
Duels this organism against an opponent | |
Return the fitness level of this organism, as a float | |
Dump out the custom attributes of this organism | |
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 | |
---|---|
float |
crossoverRate = 0.5 |
dict |
genome = {}
|
bool |
mutateOneOnly = False
|
Method Details |
---|
__init__(self,
**kw)
|
__getitem__(self,
item)
allows shorthand for querying the phenotype of this organism
|
copy(self)returns a deep copy of this organism |
dump(self)Produce a detailed human-readable report on this organism, its genotype and phenotype
|
mate(self, partner)Mates this organism with another organism to produce two entirely new organisms via random choice of genes from this or the partner
|
mutate(self)Implement the mutation phase, invoking the stochastic mutation method on each component gene Does not affect this organism, but returns a mutated copy of it
|
phenotype(self, geneName=None)Returns the phenotype resulting from a given gene, OR the total phenotype resulting from all the genes tries to invoke a child class' method called 'phen_<name>' |
xmlDumpSelf(self, doc, parent)Dumps out this object's contents into an xml tree Arguments:
|
Class Variable Details |
---|
crossoverRate
|
genome
|
mutateOneOnly
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 12 14:37:12 2005 | http://epydoc.sf.net |