本文整理汇总了Python中PyXMCDA.getCategoriesComparisonsValues方法的典型用法代码示例。如果您正苦于以下问题:Python PyXMCDA.getCategoriesComparisonsValues方法的具体用法?Python PyXMCDA.getCategoriesComparisonsValues怎么用?Python PyXMCDA.getCategoriesComparisonsValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyXMCDA
的用法示例。
在下文中一共展示了PyXMCDA.getCategoriesComparisonsValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getCategoriesComparisonsValues [as 别名]
#.........这里部分代码省略.........
break
else:
if not ('i' in alternativesRel[o][p]):
missing_eval = True
break
if not ('p+' in alternativesRel[o][p]):
missing_eval = True
break
if not ('p-' in alternativesRel[o][p]):
missing_eval = True
break
if not ('j' in alternativesRel[o][p]):
missing_eval = True
break
if missing_eval:
errorList.append("Not all alternatives from alternatives.xml contain evaluations in preferenceRelation.xml, or evaluations are incomplete. Possible inputs from different sources")
alternativesAffectations = PyXMCDA.getAlternativesAffectations(xmltree_alternativesAffectations)
Knames = []
for o in alternativesId:
clusterId = alternativesAffectations[o]
if not (clusterId in Knames):
Knames.append(clusterId)
if Knames == []:
errorList.append("No clusters found.")
K = {}
for clusterId in Knames:
K[clusterId] = []
for o in alternativesId:
K[alternativesAffectations[o]].append(o)
clustersRel = PyXMCDA.getCategoriesComparisonsValues(xmltree_clustersRelations, Knames)
if not clustersRel :
errorList.append("Problems with clusters relations.")
RK = {}
for cid1 in Knames:
RK[cid1] = {}
for cid2 in Knames:
if cid1 == cid2:
RK[cid1][cid2] = 'i'
else:
RK[cid1][cid2] = ''
missing_eval = False
for cid1 in Knames:
for cid2 in Knames:
if cid1 != cid2:
found = False
if cid1 in clustersRel:
if cid2 in clustersRel[cid1]:
found = True
RK[cid1][cid2] = clustersRel[cid1][cid2]
if clustersRel[cid1][cid2] == 'p+':
RK[cid2][cid1] = 'p-'
elif clustersRel[cid1][cid2] == 'p-':
RK[cid2][cid1] = 'p+'
else:
RK[cid2][cid1] = clustersRel[cid1][cid2]
if not found and cid2 in clustersRel:
if cid1 in clustersRel[cid2]:
found = True
RK[cid2][cid1] = clustersRel[cid2][cid1]
if clustersRel[cid2][cid1] == 'p+':
示例2: main
# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getCategoriesComparisonsValues [as 别名]
#.........这里部分代码省略.........
break
else:
if not ('i' in alternativesRel[o][p]):
missing_eval = True
break
if not ('p+' in alternativesRel[o][p]):
missing_eval = True
break
if not ('p-' in alternativesRel[o][p]):
missing_eval = True
break
if not ('j' in alternativesRel[o][p]):
missing_eval = True
break
if missing_eval:
errorList.append("Not all alternatives from alternatives.xml contain evaluations in preferenceRelation.xml, or evaluations are incomplete. Possible inputs from different sources")
alternativesAffectations = PyXMCDA.getAlternativesAffectations(xmltree_alternativesAffectations)
Knames = []
for o in alternativesId:
clusterId = alternativesAffectations[o]
if not (clusterId in Knames):
Knames.append(clusterId)
if Knames == []:
errorList.append("No clusters found.")
K = {}
for clusterId in Knames:
K[clusterId] = []
for o in alternativesId:
K[alternativesAffectations[o]].append(o)
clustersRel = PyXMCDA.getCategoriesComparisonsValues(xmltree_clustersRelations, Knames)
if not clustersRel :
errorList.append("Problems with clusters relations.")
RK = {}
for cid1 in Knames:
RK[cid1] = {}
for cid2 in Knames:
if cid1 == cid2:
RK[cid1][cid2] = 'i'
else:
RK[cid1][cid2] = ''
missing_eval = False
for cid1 in Knames:
for cid2 in Knames:
if cid1 != cid2:
found = False
if cid1 in clustersRel:
if cid2 in clustersRel[cid1]:
found = True
RK[cid1][cid2] = clustersRel[cid1][cid2]
if clustersRel[cid1][cid2] == 'p+':
RK[cid2][cid1] = 'p-'
elif clustersRel[cid1][cid2] == 'p-':
RK[cid2][cid1] = 'p+'
else:
RK[cid2][cid1] = clustersRel[cid1][cid2]
if not found and cid2 in clustersRel:
if cid1 in clustersRel[cid2]:
found = True
RK[cid2][cid1] = clustersRel[cid2][cid1]
if clustersRel[cid2][cid1] == 'p+':