ljvmiranda921 / pyswarms

A research toolkit for particle swarm optimization in Python
https://pyswarms.readthedocs.io/en/latest/
MIT License
1.28k stars 332 forks source link

compute_Pbest - compute gbest weird behavior #501

Open K1one44 opened 2 years ago

K1one44 commented 2 years ago

Hello, thanks for that job. i encounter an issue in usage: I prepare my own optimization loops and an issu eoccurs in gbest computing the output value is not the minimum value.

i modify and try directly using GlobalBestPSO or GeneralOptimizerPSO and both return me that error at the end of first iterations run : "mask_cost = swarm.current_cost < swarm.pbest_cost TypeError: '>' not supported between instances of 'float' and 'NoneType' "

resulting code stop i guess it look like at first run the swarm.pbest_cost not been initialize

i am on Win 10 Python 3.9.6 Pywswarms 1.3.0