Home | Trees | Index | Help |
|
---|
Package pygene :: Module prog :: Class ProgOrganism |
|
object
--+ |PGXmlMixin
--+ |BaseOrganism
--+ | ProgOrganism
Implements an organism for genetic programming
Introspects to discover functions and terminals.
You should add the folling class attribs:Method Summary | |
---|---|
Creates this organism | |
Executes this program organism, using the given keyword parameters | |
returns a deep copy of this organism | |
prints out this organism's node tree | |
Return the fitness level of this organism, as a float | |
Randomly generates a node to build in to this organism | |
Perform recombination of subtree elements | |
Mutates this organism's node tree | |
support for recombination, returns a tuple with four values: | |
this is the 'reference function' toward which organisms are trying to evolve | |
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 | |
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 | |
---|---|
type |
__metaclass__ = pygene.prog.ProgOrganismMetaclass |
list |
consts = []
|
dict |
funcs = {}
|
dict |
funcsDict = {}
|
list |
funcsList = []
|
int |
maxDepth = 4 |
float |
mutProb = 0.01 |
list |
vars = []
|
Method Details |
---|
__init__(self,
root=None)
Creates this organism
|
calc(self, **vars)Executes this program organism, using the given keyword parameters You shouldn't need to override this |
copy(self)returns a deep copy of this organism |
dump(self, node=None, level=1)prints out this organism's node tree
|
fitness(self)Return the fitness level of this organism, as a float Should return a number from 0.0 to infinity, where 0.0 means 'perfect' Organisms should evolve such that 'fitness' converges to zero. This method must be overridden In your override, you should generate a set of values, either deterministically or randomly, and pass each value to both .testFunc() and .calculate(), comparing the results and using this to calculate the fitness
|
genNode(self, depth=1)Randomly generates a node to build in to this organism |
mate(self, mate)Perform recombination of subtree elements
|
mutate(self)Mutates this organism's node tree returns the mutant
|
split(self)support for recombination, returns a tuple with four values:
|
testFunc(self, **kw)this is the 'reference function' toward which organisms are trying to evolve You must override this in your organism subclass |
xmlDumpSelf(self, doc, parent)Dumps out this object's contents into an xml tree Arguments:
|
Class Variable Details |
---|
consts
|
funcs
|
funcsDict
|
funcsList
|
maxDepth
|
mutProb
|
vars
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 12 14:37:12 2005 | http://epydoc.sf.net |