For debugging purposes, I need to get the best particle (and do some computation with it) after each iteration of PSO. To my understanding, there is no direct way of doing it.
I thought that one workaround could be to set the gen parameter to 1, call the evolve method in a loop and get the best after each call. However, I was wondering whether calling many times evolve is the same as calling it once, with the gen parameter appropriately set.
Looking at the code of PSO, it seems that my solution would be inefficient (since it would repeat the initialization at the beginning of evolve many times), but it should not change the result. Am I right?
For debugging purposes, I need to get the best particle (and do some computation with it) after each iteration of PSO. To my understanding, there is no direct way of doing it. I thought that one workaround could be to set the
gen
parameter to 1, call theevolve
method in a loop and get the best after each call. However, I was wondering whether calling many timesevolve
is the same as calling it once, with thegen
parameter appropriately set. Looking at the code of PSO, it seems that my solution would be inefficient (since it would repeat the initialization at the beginning ofevolve
many times), but it should not change the result. Am I right?