def sutton_chen(x):
x = x.reshape((int(x.size/3), 3))
idx = np.array(list(np.arange(0, x.shape[0])) * x.shape[0])
jdx = np.concatenate([[a] * x.shape[0] for a in range(
0, x.shape[0])])
index = np.column_stack((idx, jdx))
index = index[index[:, 0] < index[:, 1], :]
rij = np.zeros(index.shape[0])
for i in range(index.shape[0]):
rij[i] = np.sqrt(np.sum((x[index[i, 0], :] - x[
index[i, 1], :]) ** 2))
f1s = np.zeros(index.shape[0])
rhos = np.zeros(index.shape[0])
for i in range(0, x.shape[0]):
idx = np.logical_or(index[:, 0] == i, index[:, 1] == i)
f1s[i] = 0.5 * (A**K) * np.sum(1/rij[idx] ** K)
rhos[i] = (A**M) * sum(1/(rij[idx]) ** M)
return np.sum(f1s - C * np.sqrt(rhos))
评论列表
文章目录