关于数据是矩阵时,pso的程序
ggdstudy opened this issue · comments
ggdstudy commented
def demo_func(x):
x1, x2, x3,x4= x
Q=np.square(Xx1(Y/x2)-Yx3+Zx4+X-xp)
Q=Q.sum()
return Q
%% Do PSO
pso = PSO(func=demo_func, n_dim=4, pop=50, max_iter=150, lb=[0.001,0.001,0.001,0.001], ub=[1,1,1,1], w=0.8, c1=0.5, c2=0.5)
xp是目标值,这样将等式-目标值平方和后求列加和的最小值作为目标函数,能达到使参数最优的目的吗?每次出来都是0.0001或者1,就不太确定
郭飞 commented
没太明白,把完整数据贴出来我跑一下?