def getRanking(self, profile, sampleFileName = None):
        """
        Returns a list of lists that orders all candidates in tiers from best to worst when we use 
        MCMC approximation to compute Bayesian utilities for an election profile.

        :ivar Profile profile: A Profile object that represents an election profile.
        :ivar str sampleFileName: An optional argument for the name of the input file containing 
            sample data. If a file name is given, this method will use the samples in the file 
            instead of generating samples itself.
        """

        if sampleFileName != None:
            candScoresMap = self.getCandScoresMapFromSamplesFile(profile, sampleFileName)
        else:
            candScoresMap = self.getCandScoresMap(profile)

        # We generate a map that associates each score with the candidates that have that acore.
        reverseCandScoresMap = dict()
        for key, value in candScoresMap.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 getRanking ( self , profile , sampleFileName = None ) : if sampleFileName != None : candScoresMap = self . getCandScoresMapFromSamplesFile ( profile , sampleFileName ) else : candScoresMap = self . getCandScoresMap ( profile ) reverseCandScoresMap = dict ( ) for key , value in candScoresMap . 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 of lists that orders all candidates in tiers from best to worst when we use 
        MCMC approximation to compute Bayesian utilities for an election profile.

        :ivar Profile profile: A Profile object that represents an election profile.
        :ivar str sampleFileName: An optional argument for the name of the input file containing 
            sample data. If a file name is given, this method will use the samples in the file 
            instead of generating samples itself.