-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Description
I have been reviewing the IsoFuelPopulation class in algorithms/genetic/population.py and noticed a potential issue with the fallback strategy for initial population generation.
Currently, in IsoFuelPopulation.generate, if the patcher returns fewer routes than n_samples, the code fills the remaining slots by copying the last available route (lines 163-165):
for j in range(i + 1, n_samples):
X[j, 0] = np.copy(X[j - 1, 0])Impact:
If IsoFuel generates only a few valid routes (e.g., 3 out of 50), the remaining 47 individuals become identical clones. This severely limits genetic diversity in the first generation, potentially causing premature convergence or stagnation.
Proposed Solution:
I propose adding a perturbation step to the fallback mechanism. Instead of exact copying, we could apply a small random mutation to the coordinates of the copied routes to ensure the initial population maintains diversity.
I am happy to draft a PR for this if this approach aligns with the project's goals.