[SciPy-dev] Genetic algorithm optimization

John Travers jtravs at gmail.com
Fri Apr 20 14:03:42 EDT 2007


Hi all,
I have recently needed a genetic algorithm code for some work. There
appear to be various python implementations, which I didn't try and
the package in the sandbox looked promising initially but I think a
large amount of work needs to be done to get it going again. As I was
pushed for time a took an easy option and wrapped what appears to be a
fairly robust implementation in Fortran 77 called pikaia:

http://www.hao.ucar.edu/Public/models/pikaia/pikaia.html

It has apparently been used in a number of scientific research
projects and appears to be quite mature. I have a very simple f2py
interface (attached along with a patch to the pikaia source which I slightly
modified) and python calling function (also attached). While it
doesn't provide a fully customizable, all bells and whistles GA
library which some people may want (see attached ga.py for docs on
what features it does have), it does work very well for standard
global optimization problems (see example, also attached). It would
fit very neatly in the optimization package of scipy as it is a small
one function routine, see attached test script for an example.

The GA code itself is explicitly placed in the public domain. The file
you can download from the above website contains a quicksort and
uniform random number routine which are under the ACM license which is
incompatible with scipy. But these parts are easily replaced with
compatibly licensed versions (suggestions for such routines would be
welcome).

What do people think about including it in the optimization module?

Cheers,
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pikaia.diff
Type: text/x-patch
Size: 2966 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070420/0816f83a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pikaia.pyf
Type: application/octet-stream
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070420/0816f83a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ga.py
Type: text/x-python
Size: 4511 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070420/0816f83a/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_ga.py
Type: text/x-python
Size: 340 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070420/0816f83a/attachment-0001.py>


More information about the SciPy-Dev mailing list