本文整理汇总了Python中profile.Profile.getRankMaps方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.getRankMaps方法的具体用法?Python Profile.getRankMaps怎么用?Python Profile.getRankMaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profile.Profile
的用法示例。
在下文中一共展示了Profile.getRankMaps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dict
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import getRankMaps [as 别名]
preferences = []
preferences.append(preference1)
preferences.append(preference2)
# Let's set up a dictionary that associates integer representations of our candidates with their names.
candMap = dict()
candMap[1] = "john"
candMap[2] = "jane"
candMap[3] = "jill"
# Now that we have this candidate mapping and a list of Preference objects, we can construct a
# Profile object.
profile = Profile(candMap, preferences)
# Let's print the output of some of the Profile object's methods.
print(profile.getRankMaps())
print(profile.getWmg())
print(profile.getElecType())
print(profile.getReverseRankMaps())
print(profile.getOrderVectors())
# Now let's see which candidate would win an election were we to use the Plurality rule.
# First, we construct a Mechanism object
mechanism = mechanism.MechanismPlurality()
# Let's print the ouputs of some of the Mechanism object's methods.
print(mechanism.getWinners(profile))
print(mechanism.getMov(profile))
# We can also call margin of victory functions directly without constructing a mechanism object.