Genetic Algorithms in Elixir: Generation tracking. Chromosome already has "age"

The Chromosome struct has an “age” attribute.

This can be used in the “terminate?/1” function without need to alter the “Genetic evolve” algorithm.

This also means adopting the fix to track the fitness and age of the Chromosome here

In the cargo Problem terminate?/1 function simply…

def terminate?(population), do: hd(population).age == whatever

…and the problem will run with no change to the Genetic code required.

1 Like