Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact


CA216      CA249      CA318

CA400      CA651      CA668

Sample code for Genetic Algorithms

Here is some sample C++ (pseudo)code for how to implement a basic Genetic Algorithm:

The basic Genetic Algorithm classes

Sample implementation - Optimise a function over some interval

Be warned though, that this GA code is a bit of a hack, and is not very object-oriented. In particular, the separation of the abstract GA classes from the user application is not very good. I'm sure you can figure out a more elegant design yourself.

Feeds      w2mind.org

On Internet since 1987.