Open 24spiders opened 8 months ago
Can you please share a dummy fitness function so that we can better assist you?
@24spiders pygad tries to maximize fitness values. Does your fitness function result in positive dist values? You could try to multiply the output of your fitness function with -1 and see if pygad minimizes the error then.
As mentioned, I have constructed an instance of PyGAD along with a custom fitness function. However, PyGAD does not return the best solution - that is, I have modified my fitness function to print the loss value every time it is called. While it iterates, I can see it return values such as follows:
Solution 8, value [16. 0.24717325 0.4 ], dist 75884.1558043205
Where 'dist' is what should be minimized. These 3 parameters result in a fairly low value of
dist
. However, once PyGAD completes and exits, the result is output:This loss value is obviously larger than the one it found with solution 8 - I am wondering why it is returning an answer with such a large loss value?
Initialization: