最近在看智能优化算法,关于局部最优和全局最优,有一部分代码看不明白
self.X = np.random.uniform(low=self.lb, high=self.ub, size=(self.pop, self.n_dim))
self.pbest_x = self.X.copy() # personal best location of every particle in history
self.gbest_x = self.pbest_x.mean(axis=0).reshape(1, -1) # global best location for all particles
self.gbest_x = self.pbest_x.mean(axis=0).reshape(1, -1)是什么意思?最后self.gbest_x是变成1*self.n_dim的矩阵了吗?
希望能解决我的疑惑!