- Python2
- 和积法
默认使用9级评分,如果需要增加,修改RI_dict
RI_dict = {1: 0, 2: 0, 3: 0.58, 4: 0.90, 5: 1.12, 6: 1.24, 7: 1.32, 8: 1.41, 9: 1.45}
修改A_arr
改变矩阵,注意使用小数,否则计算结果为整数
A_arr = [[1, 2, 1.0/3, 3],
[1.0/2, 1, 1.0/3, 2],
[3, 3, 1, 4],
[1.0/3, 1.0/2, 1.0/4, 1]]
cd到AHP
目录
python AHP.py
新矩阵:
[[ 0.20689655 0.30769231 0.17391304 0.3 ]
[ 0.10344828 0.15384615 0.17391304 0.2 ]
[ 0.62068966 0.46153846 0.52173913 0.4 ]
[ 0.06896552 0.07692308 0.13043478 0.1 ]]
新矩阵行和: [ 0.9885019 0.63120747 2.00396725 0.37632338]
W: [0.2471254757236766, 0.15780186829662091, 0.5009918117864145, 0.094080844193287966]
AW: [1.0119690154922538, 0.63652356514050656, 2.0920972206204591, 0.38060488986276086]
AW/W: [ 4.09496031 4.0336884 4.17591101 4.04550887]
λMax: 4.08751714694
CI: 0.0291723823126
CR: 0.0324137581251