ANN: pygene - genetic algorithms package

aum aum at spam.me.please
Wed Dec 7 05:13:35 EST 2005


On Tue, 06 Dec 2005 22:44:39 -0800, Erik Max Francis wrote:

> Peter Hansen wrote:
> 
>> Okay, good, I already knew all that then, except perhaps that key word 
>> "fixed".

One thing I should say here is that pygene is a collection of
inter-related classes for populations, organisms, gametes and genes.

Users are encouraged to subclass off these to address the
problems they're trying to solve.

For instance, the BaseGene class is completely agnostic about the actual
data contained in the gene. Any BaseGene subclass only has to implement
the methods:
 - __add__ - produce phenotype effect of combining a given gene pair
 - mutate - apply a random mutation to the gene
 - randomValue - set the gene's value to a legal random value

As for the gene's value - as long as the above 3 methods are supplied in a
subclass, the gene can hold any object - just as long as one's Organism
subclass' '.fitness()' method can understand what the gene class'
'.__add__()' method returns.

A Gene subclass could even hold an AST for a program to be generated.

It wasn't my original intention to support genetic programming, but in
theory at least, pygene could be extended into a GP system.

Hmm, it's tempting to try a bit of GP, perhaps initially generating
code for a tiny language like BrainFuck, then work up to Forth, Factor and
beyond.

-- 

Cheers
aum





More information about the Python-list mailing list