GALib available now!

Over the past 2 weeks I’ve been putting time in creating a general purpose Genetic Algorithm (GA) library in C#. It provides the scaffolding for any GA based functionality. Although it’s not fully finished yet, it is now available under the GPL licence at SourceForge.

What does it provide and can it do ATM?

  • An abstract Individual class that can be inherited from to make your own individual type, with it’s own mutation, crossover, initialization and fitness functions and genotype.
  • A population class, which is basically a List<IndividualType>, which enables you to do the actual GA evolution. The evolution is done on a background thread, and events keep you up to date by reporting every time a generation has evolved, a new fittest individual is found, or the evolution is complete due to reaching the maximum amount of generations, reaching the stagnation limit or being cancelled. For the evolution you can choose between rank based selection, truncated rank based selection, and roulette wheel selection. You can also set properties like the mutation ratio, and elitism percentage.

What still needs to be finished/added?

  • The library contains a IslandGroup class, allowing you to do simultaneous evolution on multiple ‘islands’. This class still needs to be finished though.
  • The Population class contains a method for tournament based selection, but the code is not complete yet.
  • The performance of the library could probably be improved.
  • A lot of other neat things could be added, like multiple reproduction methods and varying genotype size support.

This is a class diagram of the library as it is at the moment.

Class diagram of GALib by Jeroen De Dauw

I’m going to release the TSP implementation I made with this lib on-line in a similar fashion, after the interface is fully finished. Also, once the library itself is finished, I’m going to create an article explaining how it works and should be used, and put it both on The Code Project and my wiki 🙂

Resources

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.