# Ruby Genetic Algorithm Library

**URL:** <https://www.ruby-forum.com/t/ruby-genetic-algorithm-library/121754>\
**Category:** Ruby\
**Created:** [November 30, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/ruby-genetic-algorithm-library/121754 "2007-11-30T15:47:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [November 30, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/ruby-genetic-algorithm-library/121754/1 "2007-11-30T15:47:03Z")

</div>

Hi,

I’m looking for a (relatively) mature genetic algorithm library for use  
with Ruby, so I have a choice:

1. Use GALib (a C++ library) and connect it to Ruby somehow (bridge)
2. Find a decent native Ruby GA Library

So far Google has not been helpful for (2) so I am posting here seeking  
advice on whether I’ve missed anything. I’m aware of projects like DRP  
which look good for grammatical evolution, but I’m not sure whether they  
support being used for vanilla GAs. If anyone has any experience using  
GAs from Ruby, it would be great to hear of your experience.

Alternatively, if there’s nothing good that anyone can suggest native,  
I’d be very grateful to hear peoples’ opinion on using a C++ library  
like GALib from within Ruby. I.e. - is it feasible without too much  
hassle, and any pointers to any material that may help me build that  
bridge would be great.

I’ve exhausted Google as far as I can manage, so I’m turning to  
crowdsourcing here.

Thanks for your time and help, it’s much appreciated.

- N

---

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [November 30, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/ruby-genetic-algorithm-library/121754/2 "2007-11-30T16:15:23Z")

</div>

Peter L. wrote:

> Hi,  
> So far Google has not been helpful for (2) so I am posting here seeking  
> advice on whether I’ve missed anything. I’m aware of projects like DRP  
> which look good for grammatical evolution, but I’m not sure whether they  
> support being used for vanilla GAs. If anyone has any experience using  
> GAs from Ruby, it would be great to hear of your experience.

Some projects that might be of interest (I have no experience with any  
of them though 🙂 )  
[http://raa.ruby-lang.org/project/uni\_genetic/](http://raa.ruby-lang.org/project/uni_genetic/)  
[http://rubyforge.org/projects/gga4r/](http://rubyforge.org/projects/gga4r/)  
[http://rubyforge.org/projects/g2a/](http://rubyforge.org/projects/g2a/)  
[http://raa.ruby-lang.org/cat.rhtml?category\_major=Library;category\_minor=AI](http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=AI)

> Alternatively, if there’s nothing good that anyone can suggest native,  
> I’d be very grateful to hear peoples’ opinion on using a C++ library  
> like GALib from within Ruby. I.e. - is it feasible without too much  
> hassle, and any pointers to any material that may help me build that  
> bridge would be great.

Building c extensions for ruby is quite doable. I understand that c++ is  
a bit more hassle, but not too much. Another option would be to use  
jruby and directly access one of the java genetic algorithm libraries (I  
am pretty sure there must be quite a few of those).

---

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [November 30, 2007, 6:41pm UTC](https://www.ruby-forum.com/t/ruby-genetic-algorithm-library/121754/3 "2007-11-30T18:41:05Z")

</div>

Edwin Van leeuwen pisze:

> Building c extensions for ruby is quite doable. I understand that c++ is  
> a bit more hassle, but not too much. Another option would be to use  
> jruby and directly access one of the java genetic algorithm libraries (I  
> am pretty sure there must be quite a few of those).

Lots of them and no extensions/wrappers/bindings required. There is also  
a Scala one : [http://code.google.com/p/jiva-ng/](http://code.google.com/p/jiva-ng/)

might be worth a try to access it using JRuby.

lopex
