Genetic Algorithms in Elixir: Ch 4, changing evolve to track generation (~p 174

The definition for run/2 is also included but the call to evolve is omitted.

This solved the issue for me:

  def run(problem, opts \\ []) do
    population = initialize(&problem.genotype/0, opts)
    population
    |> evolve(problem, 0, opts)
  end

(To clarify where this is in the book: Just before you add temperature tracking in the evolve method.)

1 Like