...

/

Tracking Statistics in Your Framework

Tracking Statistics in Your Framework

Learn to track and access statistics in the tiger evolution framework.

Adding tracking feature in our framework

Before we can access the different statistics of evolution, we need to ensure our algorithm tracks them after every generation. To do this, we will have to implement a new function statistics that runs immediately after your population is evaluated and updates the statistics server appropriately.

Start by updating evolve/4 in lib/genetic.ex to call statistics/2, like this:

Press + to interact
def evolve(population, problem, generation, opts \\ []) do
population = evaluate(population, &problem.fitness_function/1, opts)
statistics(population, generation, opts)
best = hd(population)
# ...
end

Next, we need to implement statistics/3. To customize the statistics we take between generations, we can accept a ...