Package pygene :: Module gene :: Class BaseGene
[show private | hide private]
[frames | no frames]

Type BaseGene

object --+    
         |    
PGXmlMixin --+
             |
            BaseGene

Known Subclasses:
BitGene, CharGene, ComplexGene, DiscreteGene, FloatGene, IntGene

Base class from which all the gene classes are derived.

You cannot use this class directly, because there are some methods that must be overridden.
Method Summary
  __init__(self, value)
  __add__(self, other)
Combines two genes in a gene pair, to produce an effect
  __repr__(self)
  copy(self)
Produce an exact copy of this gene
  maybeMutate(self)
  mutate(self)
Perform a mutation on the gene
  randomValue(self)
Generates a plausible random value for this gene.
  xmlDumpAttribs(self, tag)
sets attributes of tag
  xmlDumpSelf(self, doc, parent)
dump out this gene into parent tag
    Inherited from PGXmlMixin
  xmlDump(self, fileobj)
Dumps out the population to an open file in XML format.
  xmlDumpClass(self, tag)
dumps out class information
  xmlDumps(self)
dumps out to xml, returning a string of the raw generated xml
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
float mutProb = 0.01                                                                  
NoneType value = None                                                                  

Method Details

__add__(self, other)
(Addition operator)

Combines two genes in a gene pair, to produce an effect

This is used to determine the gene's phenotype

This default method computes the arithmetic mean of the two genes.

Override as needed

Must be overridden

copy(self)

Produce an exact copy of this gene

Shouldn't need to be overridden

mutate(self)

Perform a mutation on the gene

You MUST override this in subclasses

randomValue(self)

Generates a plausible random value for this gene.

Must be overridden

xmlDumpAttribs(self, tag)

sets attributes of tag
Overrides:
pygene.xmlio.PGXmlMixin.xmlDumpAttribs

xmlDumpSelf(self, doc, parent)

dump out this gene into parent tag
Overrides:
pygene.xmlio.PGXmlMixin.xmlDumpSelf

Class Variable Details

mutProb

Type:
float
Value:
0.01                                                                  

value

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.1 on Mon Dec 12 14:37:12 2005 http://epydoc.sf.net