def getRankingBruteForce(self, profile):
        """
        Returns a list that orders all candidates from best to worst when we use brute force to 
        compute Bayesian utilities for an election profile. This function assumes that 
        getCandScoresMapBruteForce(profile) is implemented for the child Mechanism class. Note that
        the returned list gives no indication of ties between candidates. 
        
        :ivar Profile profile: A Profile object that represents an election profile.
        """

        # We generate a map that associates each score with the candidates that have that score.
        candScoresMapBruteForce = self.getCandScoresMapBruteForce(profile) 
        reverseCandScoresMap = dict()
        for key, value in candScoresMapBruteForce.items():
            if value not in reverseCandScoresMap.keys():
                reverseCandScoresMap[value] = [key]
            else:   
                reverseCandScoresMap[value].append(key)
        
        # We sort the scores by either decreasing order or increasing order.
        if self.maximizeCandScore == True:
            sortedCandScores = sorted(reverseCandScoresMap.keys(), reverse=True)
        else:
            sortedCandScores = sorted(reverseCandScoresMap.keys())
        
        # We put the candidates into our ranking based on the order in which their score appears
        ranking = []
        for candScore in sortedCandScores:
            for cand in reverseCandScoresMap[candScore]:
                ranking.append(cand)

        return ranking
def getRankingBruteForce ( self , profile ) : candScoresMapBruteForce = self . getCandScoresMapBruteForce ( profile ) reverseCandScoresMap = dict ( ) for key , value in candScoresMapBruteForce . items ( ) : if value not in reverseCandScoresMap . keys ( ) : reverseCandScoresMap [ value ] = [ key ] else : reverseCandScoresMap [ value ] . append ( key ) if self . maximizeCandScore == True : sortedCandScores = sorted ( reverseCandScoresMap . keys ( ) , reverse = True ) else : sortedCandScores = sorted ( reverseCandScoresMap . keys ( ) ) ranking = [ ] for candScore in sortedCandScores : for cand in reverseCandScoresMap [ candScore ] : ranking . append ( cand ) return ranking
Returns a list that orders all candidates from best to worst when we use brute force to 
        compute Bayesian utilities for an election profile. This function assumes that 
        getCandScoresMapBruteForce(profile) is implemented for the child Mechanism class. Note that
        the returned list gives no indication of ties between candidates. 
        
        :ivar Profile profile: A Profile object that represents an election profile.