資源簡介
英文全稱:Technique for order performance by similarity to ideal solution
正理想解:各指標(biāo)屬性達(dá)到最滿意的解。
負(fù)理想解:各指標(biāo)屬性達(dá)到最不滿意的解。
代碼片段和文件信息
“““
層次分析法
“““
import?numpy?as?np
RI?=?{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?10:?1.49?11:?1.51}
A?=?[[14282][1/411/221/2][1/22141][1/81/21/411/4][1/22141]]
def?ahp(data):
data?=?np.array(data)
m?=?len(data)
#?計算特征向量
weight?=?(data?/?data.sum(axis=0)).sum(axis=1)?/?m
#?計算特征值
Lambda?=?sum((weight?*?data).sum(axis=1)?/?(m?*?weight))
#?判斷一致性
CI?=?(Lambda?-?m)?/?(m?-?1)
CR?=?CI?/?RI[m]
if?CR?0.1:
print(f‘最大特征值:lambda?=?{Lambda}‘)
print(f‘特征向量:weight?=?{weight}‘)
print(f‘\nCI?=?{round(CI2)}?RI?=?{RI[m]}?\nCR?=?CI/RI?=?{round(CR2)}?0.1,通過一致性檢驗(yàn)‘)
return?weight
else:
print(f‘\nCI?=?{round(CI2)}?RI?=?{RI[m]}?\nCR?=?CI/RI?=?{round(CR2)}?>=?0.1,不滿足一致性‘)
ahp(A)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-05-16?11:39??TOPSIS評價方法(python)\
?????文件?????????880??2019-05-05?23:34??TOPSIS評價方法(python)\AHP.py
?????文件?????????611??2019-05-05?23:34??TOPSIS評價方法(python)\shangquan.py
?????文件????????2843??2019-05-05?22:57??TOPSIS評價方法(python)\TOPSIS_1.py
?????文件????????3317??2019-05-05?23:34??TOPSIS評價方法(python)\TOPSIS_2.py
評論
共有 條評論