In my last entry, the code sample that I added to show how to get the best in breed was totally wrong. It was just picking a random organism in the population. This should do the trick:
lists:nth(1, lists:keysort(1, lists:map(
fun(Organism) -> {simple_gp:fitness(Organism), Organism} end,
gerl:many_rounds(simple_gp, gerl:population(simple_gp, 100), 10)))).
{1,{mul,[95,5]}}
Also, added some simple testing assertions to the gerl module. I know that there is a testing framework out there for Erlang, but I haven’t had time to look at it. I’m just checking that things bind to true for now:
true = 10 =:= lookup_variable(x, [{x,10}]).