views:

163

answers:

4

I'm looking to add some genetic algorithms to an Operations research project I have been involved in. Currently we have a program that aids in optimizing some scheduling and we want to add in some heuristics in the form of genetic algorithms. Are there any good libraries for generic genetic programming/algorithms in c++? Or would you recommend I just code my own?

I should add that while I am not new to c++ I am fairly new to doing this sort of mathematical optimization work in c++ as the group I worked with previously had tended to use a proprietary optimization package.

We have a fitness function that is fairly computationally intensive to evaluate and we have a cluster to run this on so parallelized code is highly desirable.

So is c++ a good language for this? If not please recommend some other ones as I am willing to learn another language if it makes life easier.

thanks!

+4  A: 

I would recommend rolling your own. 90% of the work in a GP is coding the genotype, how it gets operated on, and the fitness calculation. These are parts that change for every different problem/project. The actual evolutionary algorithm part is usually quite simple.

There are several GP libraries out there ( http://en.wikipedia.org/wiki/Symbolic_Regression#Implementations ). I would use these as examples and references though.

C++ is a good choice for GP because they tend to be very computationally intensive. Usually, the fitness function is the bottleneck, so it's worthwhile to at least make this part compiled/optimized.

Inverse
I ended up coding my own from scratch, was definitely an interesting learning experience. The next and potentially difficult task will be to parralelize the code.
shuttle87
A: 

I suggest you have a look into the matlab optimization toolkit - it comes with GAs out of the box, you only haver to code the fitness function (and a function to generate inital population eventually) and I believe matlab has some C++ interoperability so you could code you functions in C++. I am using it for my experiments and a very nice feature is that you get all sorts of charts out of the box as well.

Said so - if your aim is to learn about genetic algorithms you're better off coding it, but if you just want to run experiments matlab and C++ (or even just matlab) is a good option.

JohnIdol
Thanks for the suggestion, however I doubt that I will use Matlab due to it not being free software.
shuttle87
that's a good point - FYI student version is 89$ + 19$ for the optimization toolkit, which is not too bad
JohnIdol
It's not so much that the Matlab licence costs that much but rather the restrictions I have on packaging the code. Were there no restrictions on the Matlab licence I'd certainly do that.
shuttle87
if this is a commercial endeavor and you're not just running experiments I can see how that would be a drawback
JohnIdol
A: 

I use GAUL

it's a C library with all you want.
( pthread/fork/openmp/mpi )
( various crossover / mutation function )
( non GA optimisation: Hill-Climbing, N-M Simplex, Simulated annealling, Tabu, ... )

Why build your own library when there is such powerful tools ???

Guillaume Massé
A: 

I haven't used this personally yet, but the Age Layered Population Structure (ALPS) method has been used to generate human competitive results and has been shown to outperform several popular methods in finding optimal solutions in rough fitness landscapes. Additionally, the link contains source code in C++ FTW.

Nick