模糊综合评价方法,是应用模糊关系合成的原理,从多个因素(指标)对被评价事物隶属等级状况进行综合性评判的一种方法
def min_max_operator(A, R):
'''
利用最值算子合成矩阵
:param A:评判因素权向量 A = (a1,a2 ,L,an )
:param R:模糊关系矩阵 R
:return:
'''
B = np.zeros((1, R.shape[1]))
for column in range(0, R.shape[1]):
list = []
for row in range(0, R.shape[0]):
list.append(min(A[row], R[row, column]))
B[0, column] = max(list)
return B
def mul_max_operator(A, R):
'''
利用乘法最大值算子合成矩阵
:param A:评判因素权向量 A = (a1,a2 ,L,an )
:param R:模糊关系矩阵 R
:return:
'''
B = np.zeros((1, R.shape[1]))
for column in range(0, R.shape[1]):
list = []
for row in range(0, R.shape[0]):
list.append(A[row] * R[row, column])
B[0, column] = max(list)
return B
def min_mymin_operator(A, R):
'''
利用最小值最小值算子合成矩阵
:param A:评判因素权向量 A = (a1,a2 ,L,an )
:param R:模糊关系矩阵 R
:return:
'''
B = np.zeros((1, R.shape[1]))
for column in range(0, R.shape[1]):
list = []
for row in range(0, R.shape[0]):
list.append(min(A[row], R[row, column]))
B[0, column] = mymin(list)
return B
其中为了代码便于理解,单独封装了一个mymin来求那个特殊的最小值
def mymin(list):
for index in range(1, len(list)):
if index == 1:
temp = min(1, list[0]+list[1])
else:
temp = min(1, temp+list[index])
return temp
其中的mymin依旧是之前封装的
def mul_mymin_operator(A, R):
'''
利用乘法最小值算子合成矩阵
:param A:评判因素权向量 A = (a1,a2 ,L,an )
:param R:模糊关系矩阵 R
:return:
'''
B = np.zeros((1, R.shape[1]))
for column in range(0, R.shape[1]):
list = []
for row in range(0, R.shape[0]):
list.append(A[row] * R[row, column])
B[0, column] = mymin(list)
return B