Hi PriNova,

thank you for the contribution. I'm a bit into soft computing techniques so this is pretty interesting for me. Here are some remarks concerning your code:

The way you do the selection is a bit special. If I interpreted your code correctly the selection happens in SelectOneOrganism. To be honest I'm quite surpised it really does work the way you realized it. I guess it's because organisms with a higher fitness value are more likely to get over the randomSelectPoint variable. So the selection you implemented works by giving the organisms with a higher fitness value better chances of recombining with other organisms.

In a standard genetic algorithm selection happens differently. You have a base population and by first recombining organisms and then mutating random genes you enlarge the population. Now for the selection you sort these organisms and let only the fittest of them survive. For example if you start with 20 organisms and create 20 new ones you got a new population of 40 members. You now sort them by fittness and let the 20 worst organisms die while the 20 best organisms may continue to live and recombine. In consequence organisms can live and reproduce an arbitrarily long time as long as their fitness value is better than the average. In your approach every organism has a maximum lifespan of one generation. This raises the danger of loosing already pretty good organisms and creating worse ones. You can even see this sometimes when the global fitness value decreases.

I have also a remark about your fitness function. In its current form it is pretty useless. You'd normally use a genetic algorithm whenever you have a problem that you don't have a numeric solution for or which is so hard (in the sense of computational hard) that bruteforce would take too long. This is where the genetic algortihm jumps in and offers improved performance by introducing a heuristic. The condition to be able to do so is, that you have means of measuring how good or bad a solution is, i.e. you need a fitness function. In your case the fitness function renders the algorithm useless as the desired result (i.e. your model organism) is well known from the beginning and the function just compares the current result to the already well known end result. While this is totally ok for a proof of concept the practical use of the algorithm is limited in this form, as finding a good representation of your problem solution as a genome and writing a good fitness function are often the hardest part of a GA.

Finally GAs are not well suited for real time applications as you cannot predict how long they will run until an acceptable solution is found.

EDIT: After reading my whole post again I have to admit it sounds negative. But it's meant to be the complete opposite. You already managed some of the most important parts. It's especially good that you have implemented recombination AND mutation. I've seen many people claiming they had a GA while they only had either recombination OR mutation implemented. Do you mind to tell how you got to GAs? Did you have a specific problem you wanted to solve with this?


Always learn from history, to be sure you make the same mistakes again...