As the title says, i want to use fitness scalling methods, such as sigma scalling, for i'm having problems with premature genetic conversion in non-optimal solutions.
I know that PyGAD has a on_fitness method that is called after the fitness values for all my individuals are calculated, and think i could use to solve my problem with it, but could not verify. Can i use it for this purpose?
Thanks for your input.
Well I don't know if this is the best way, but here is how I solved my problem.
With the release of PyGAD 2.19, a new constructor option was added, the
fitness_batch_size. As it's name sujests, you can now pass a batch of individuals at once to one execution of your fitness function, like so:With this in mind, now to scale my fitness, I have to adjust
fitness_batch_size = sol_per_popand generate all fitness values at once. Afterwards, it's matter of passing all values through some kind of scaling and returning this result as my fitness values.If you know a better way, please post it here. Thanks in advance.