I’m interested in getting the interim population values for algorithms within Metaheuristics.jl
at each timestep, for example Differential Evolution.
I’ve seen examples where the single member of the population with the best fitness can be retrieved at each iteration using convergence()
, though I’d like to be able to interrogate each member of the population at a given timestep.
Is there a clean way to do this? I looked around but it doesn’t seem like Metaheuristics.optimize()
provides the ability to give a callback function or similar pattern.
The hacky approach I’ve found thus far is to inspect status.population
during internal calls to Metaheuristics.stop_criteria!
, which is based off this example from modifying an existing metaheuristic.
global POPULATION [];
function Metaheuristics.stop_criteria!(
status,
parameters::DE
problem,
information,
options,
args...;
kargs...
)
# Allow for traditional usage of DE algo to
# set status and determine when to stop
if status.stop
return
end
# Record state of population
push!(POPULATION, status.population)
end
Perhaps there are other lesser documented internal Metaheuristics
functions that
would be more direct in what I’m looking for?