Genetic Algorithms in Elixir: Ch4. Cargo: odd population size produces error in crossover (page 54)

When running the Cargo problem with

soln = Genetic.run(Cargo, population_size: 25)

we get an error due to an odd population size against the crossover’s chromosome pairing strategy. Making the population even (i.e. 26) resolves the issue.

1 Like

I think this indicates the framework might need a minor adjustment to ensure the population size stays fixed even with an odd population. Let me go back through the code base so I can find a more permanent solution. In the meantime, even populations will work just fine. Thank you again!

2 Likes