粒子群优化算法中的粒子

Particles in particle swarm optimization algorithm

我有一个由矩阵组成的数据集,我想在粒子群优化 (PSO) 算法中使用它们,其中群中的每个粒子都由大小为 MxM 的矩阵表示。

我可以将粒子表示为大小为 MxM 的矩阵,还是必须将它们重新整形为大小为 1xM*M 的向量?最好的解决方案应该是矩阵而不是向量。

在矩阵的情况下,您的行(样本数)变为粒子,特征(矩阵中的列数)变为 dimensions.one 单个群包含 1 行和 M 维。 Swarm 具有属性 position (1*M) 、 Velocity(1*M) 和 Pbest(1*M)

for i in range(rows):             
            for j in range(dimensions): 
                  # write your code here for swarm