Package pygene :: Module prog :: Class FuncNode
[show private | hide private]
[frames | no frames]

Class FuncNode

BaseNode --+
           |
          FuncNode


node which holds a function and its argument nodes
Method Summary
  __init__(self, org, depth, name, children)
creates this func node
  calc(self, **vars)
evaluates this node, plugging vars into the nodes
  copy(self, doSplit)
Copies this node and recursively its children, returning the copy
  dump(self, level)
  mutate(self, depth)
randomly mutates either this tree, or a child

Method Details

__init__(self, org, depth, name=None, children=None)
(Constructor)

creates this func node

calc(self, **vars)

evaluates this node, plugging vars into the nodes
Overrides:
pygene.prog.BaseNode.calc

copy(self, doSplit=False)

Copies this node and recursively its children, returning the copy

if doSplit is true, then cuts off a piece of the tree, to support the recombination phase of mating with another program

returns a quadruple:
  • copy - a copy of this node
  • fragment - fragment to be given to mate
  • lst - list within copy tree to which fragment from mate should be written
  • idx - index within the lst at which the fragment should be written
if doSplit is false, then the last 3 tuple items will be None

mutate(self, depth)

randomly mutates either this tree, or a child

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