PSO algorithm Python