import numpy as np
#根据问题更改
importance = np.array([[1, 1 / 3, 1, 1 / 5, 2, 3], #这里输入构造矩阵
[3, 1, 2, 1 / 5, 3, 4],
[1, 1 / 2, 1, 1 / 4, 3, 2],
[5, 5, 4, 1, 5, 6],
[1 / 2, 1 / 3, 1 / 3, 1 / 5, 1, 1 / 3],
[1 / 3, 1 / 4, 1 / 2, 1 / 6, 3, 1]])
column_sum = np.sum(importance, 0)
importance /= column_sum
row_sum = np.sum(importance, 1)
w = row_sum / np.sum(row_sum)
print(w)
层次分析法(Python实现)
最新推荐文章于 2024-07-13 16:41:04 发布