Genetic Algorithms Continued

Well I got home and dinner needed an hour to cook so I thought I would make modifications to my initial simulation. The starting string can now be of length between 0 and 2 times the length of the target string. The algorithm to compute fitness now addresses this and I've added a second means of finding pairs to breed the next generation, this time random.

Honestly... now the prior "cheat" to keep the generated strings the same length as the target string seemed like a con. It actually solves the puzzle MUCH faster now. I believe this is due in part to a place where I deviated from the original tutorial combined with the actual changes themselves can explain it. Firstly, I modified mine to "kill off" a percentage of the weakest genes, a value which currently culls 97% of a population. Then, with the variable length and increased penalty for the varying length I'm likely ending up in a scenario where I'm getting much greater variety in my gene pool while still killing off a massive amount of the inferior results, then choosing the pairings at random I'm much more likely to find a value here and a value there which are better suited to the cause. In this particular example, I think it would have been brutal if I did not have that immediate trimming of the population before starting the next generation.

Next up I think is to build a framework for genetic algorithms.Well food is almost done so I'm out.

Comments

Popular Posts