def getCandScoresMap(self, profile):
        """
        Returns a dictonary that associates the integer representation of each candidate with the
        score they recieved in the profile.

        :ivar Profile profile: A Profile object that represents an election profile.
        """

        # Currently, we expect the profile to contain complete ordering over candidates.
        elecType = profile.getElecType()
        if elecType != "soc" and elecType != "toc":
            print("ERROR: unsupported election type")
            exit()

        # Initialize our dictionary so that all candidates have a score of zero.
        candScoresMap = dict()
        for cand in profile.candMap.keys():
            candScoresMap[cand] = 0.0

        rankMaps = profile.getRankMaps()
        rankMapCounts = profile.getPreferenceCounts()
        scoringVector = self.getScoringVector(profile)

        # Go through the rankMaps of the profile and increment each candidates score appropriately.
        for i in range(0, len(rankMaps)):
            rankMap = rankMaps[i]
            rankMapCount = rankMapCounts[i]
            for cand in rankMap.keys():
                candScoresMap[cand] += scoringVector[rankMap[cand] - 1] * rankMapCount

        # print("candScoresMap=", candScoresMap)
        return candScoresMap
def getCandScoresMap ( self , profile ) : elecType = profile . getElecType ( ) if elecType != "soc" and elecType != "toc" : print ( "ERROR: unsupported election type" ) exit ( ) candScoresMap = dict ( ) for cand in profile . candMap . keys ( ) : candScoresMap [ cand ] = 0.0 rankMaps = profile . getRankMaps ( ) rankMapCounts = profile . getPreferenceCounts ( ) scoringVector = self . getScoringVector ( profile ) for i in range ( 0 , len ( rankMaps ) ) : rankMap = rankMaps [ i ] rankMapCount = rankMapCounts [ i ] for cand in rankMap . keys ( ) : candScoresMap [ cand ] += scoringVector [ rankMap [ cand ] - 1 ] * rankMapCount return candScoresMap
Returns a dictonary that associates the integer representation of each candidate with the
        score they recieved in the profile.

        :ivar Profile profile: A Profile object that represents an election profile.