an utility function to easily generate a stop function that stops when the convergence is stalling

stop_engine_if_stalling(nb_iterations)

Arguments

nb_iterations

number of iterations of the stalling: stops if the fitness has not increased during that number of iterations.

Value

a function: (engine) –> logical that stops (i.e/ returns TRUE) if the convergence is stalling

Examples

until <- stop_engine_on_first_of(max_generations = 1000, other_func = stop_engine_if_stalling(5))