Genetic Algorithms (Java)

I needed to add a genetic algorithm to a network optimization program that I was writing.  It needed to be in Java, since that is a language that the main network graphing engine (Gephi) that I use is written in.   Surprisingly RapidMinder or KMine did not have any implementations available.  Luckily a comprehensive list is available at wiki:Genetic_programming#Implementations although it is filed under “Genetic Programming” and not under “Genetic Algorithms”; which makes it somewhat difficult to find.

I narrowed it down to briefly trying out 3 libraries: ECJ, JGAP, Watchmaker

Due to the features described bellow; I ended up using Watchmaker, although it was a tight call with  ECJ , JGAP came as a distant 3rd (Note: this might be different from person to person; so to be sure give all of them a try).


Advantages:  ECJ seems to be by far the most comprehensive.  It was also reported to achieve the best performance.  The primary author (Prof. Sean Luke) provides a great manual as well as a great textbook (for those interested in underlying concepts).  This is a very mature framework which has been actively developed since 1998; and incorporates a lot of current advances.

Limitations: I got somewhat lost in all of the options that were available.

It would be my library of choice if I needed to achieve the best performance or wanted to get deeper into the development of genetic algorithms.

If you just need to get something decent running quickly it might not be the best choice.


Advantages:  Is a nicely written package.  Quite easy to use, and has a number of nice features in particular:

  • Distributed Processing – Support for distributed fitness evaluations using either Hadoop (via the Apache Mahout project) or Terracotta.
  • UI: Swing Component Library – Re-usable components to simplify the building of graphical user interfaces for evolutionary programs. Includes a generic Evolution Monitor component that provides information about a running evolutionary program.


Due to a somewhat steep learning curve and different architectures of each framework (also corroborated by cvalcarcel); in addition to complexity of my particular algorithm; I  ended only with the implementation in Watchmaker.  The performance was good enough for me so I needed not to venture further.  Cvalcarcel did do a number of evaluations and have reported the following results (that seem quite reasonable to me):

ECJ: 7 generations @ 1024 individuals/generation;
JGAP: 25 generations @ 1000 individuals/generation;
Watchmaker: 33 generations @ 1000 individuals/generation;


This books are quite nice to get up to speed with some of the issues related to genetic algorithms:

Luke, S. (2009). Essentials of Metaheuristics. Optimization. Retrieved from

Weise, T. (2009). Global Optimization Algorithms: Theory and Application. Retrieved from

Riccardo Poli, William B Langdon, N. F. M. (2008). A field guide to genetic programming.  Retrieved from

keywords: genetic algorithm java program library framework open source 



About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *