Custom condition for stopping evolution
Currently the whileloop in evolve works with a maximal number of generations or a maximal number of calls of the objective function (with a break if termination fitness is reached). However other conditions might be desirable (eg. a max wall clock-time).
For maximum flexibility we could evaluate whether to continue or not, with a custom function:
def continue_run(pop, ea)
return _criterium_
# in hl_api.py
while continue_run(pop, ea)
# ...
Probably we would need some predefined functions for better user experience, eg:
def max_generations(max_generations)
def continue_run(pop, ea)
return pop.generation < max_generations
return continue_run
good idea :) we should keep in mind use cases where more than one exit criterion is desired, for example currently we exit upon reaching a max number of generations or a certain fitness value. how about allowing both a function and a list of functions to be passed to the hl_api.evolve function? internally we could then either evaluate just a the single function or evaluate all functions in the list and make sure they are all true.