Solution_FItness array and solutions arrays are in different length.
I am using pygad, for GA, to find combination of solutions which would satisfy conditions. I have got a code, which runs 15 generations with 40 populations. When GA stops running, the size of
Hello Javid-B
Just a speculative suggestion here from me.
You may think that 600 != 640 is a mismatch here. But, in fact, I think maybe when you say “40 populations” you mean n=40 competing algos in a generation?
Dividing 640 by 40 gives 15. So I suppose you have 15 “genes” and that 640 is the size of the whole “generation” of siblings.
It is just a thought. I hope this is the answer for you. If I wrong I apologise.
Best wishes
Keith
Sent from my iPhone
On 13 Sep 2021, at 08:23, javid-b @.***> wrote:
I am using pygad, for GA, to find combination of solutions which would satisfy conditions. I have got a code, which runs 15 generations with 40 populations. When GA stops running, the size of array is 640 where as array is 600. I am looking for a single array which would have solutions for all trials with fitness array next to it. However, i was expecting them to be equal. May be i am doing something wrong?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Hi Keith, Thanks for response. I did not quite understood, why 640/40 would give 15? Yes, you are right i have got 15 genes and 40 competing algos in a generation. Regardless if it gives 600 or 640, my expectation would be that number of iterated solutions would be equal to number of fitness values. Sorry, if i am saying something non-sensible.
Regards, Javid
I think I was talking nonsense and I’m sorry to have wasted your time. Either that or I was right and I have forgotten what I meant.
All best wishes, apologies,
Keith
On 16 Sep 2021, at 03:55, javid-b @.***> wrote:
Hi Keith, Thanks for response. I did not quite understood, why 640/40 would give 15? Yes, you are right i have got 15 genes and 40 competing algos in a generation. Regardless if it gives 600 or 640, my expectation would be that number of iterated solutions would be equal to number of fitness values. Sorry, if i am saying something non-sensible.
Regards, Javid
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Hi @javid-b,
Thanks for opening this issue. You are right as the fitness of the last population was not saved in the solutions_fitness list. This is solved by adding the next code at the end of the run() method.
if self.save_solutions:
self.solutions_fitness.extend(self.last_generation_fitness)
The project will be updated soon and a new release of PyGAD will be published too.
Please let me know if you have any bugs or enhancements.