Closed
Description
Feature request to support evaluating fitness_func
in batched / vectorized way (e.g. for the entire population / sub-batches of the population at once). This is very useful for cases where the fitness_func
benefits from vectorization. One example is when fitness_func
itself calls an ML model's prediction function. The model's prediction function benefits from batching e.g. predicting 1 million rows is 10x slower than predicting 10 rows. Hence I'd like to suggest a feature request (and possibly submit a PR) for batch evaluating fitness_func
.
Conceptually, this should just be taking the
for i in range(len(population)):
solution[i] = fitness_func(population[i])
and doing the following:
func_batch_size = 100
for i in range(ceiling(len(population) / func_batch_size)):
batch_indices = range(i * func_batch_size, min(population, (i + 1 * func_batch_size))
solution[batch_indices] = fitness_func_batch(population[batch_indices])