Open ckattenberg opened 2 years ago
The solution_idx
holds the solution index in its population.
One usage is updating the neural network corresponding to the solution: https://github.com/ahmedfgad/NeuralGenetic/blob/82e73d92dc1a32ad17f982cfa8230d6eb4d17321/example_XOR_classification.py#L9
It can be used for debugging purposes.
Just a quick follow up question, I wonder why it always gives me the solution_idx of 0?
@xshang93, most of the time the best solution is the first solution in the population. This is why the index 0 is returned almost frequently.
For some cases, it is something different. This only happens if a better solution is found in the last generation.
I advise you to run a code with few generations. You will likely find a different index than 0.
Why does the fitness function need solution_idx as an input parameter if it doesn't do anything with it?