运行时出现问题,请各位出出招

在我运行PSO程序的时候

if value <  self.get_bestFitnessValue():
            self.set_bestFitnessValue(value)
            for i in range(self.dim):
                self.set_bestPosition(i, part.get_pos()[i])

出现了如下错误:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

但是如果粒子数为1好像就没有这样的错误,请问这是为什么呢

告诉你了,只能用一个,报错是因为超过一,代码不全具体不知道。