def getUtilities(self, decision, binaryRelations):
        """
        Returns a floats that contains the utilities of every candidate in the decision. This was 
        adapted from code written by Lirong Xia.

        :ivar list<int> decision: Contains a list of integer representations of candidates in the 
            current decision.
        :ivar list<list,int> binaryRelations: A two-dimensional array whose number of rows and 
            colums is equal to the number of candidates. For each pair of candidates, cand1 and
            cand2, binaryRelations[cand1-1][cand2-1] contains 1 if cand1 is ranked above cand2
            and 0 otherwise.
        """

        m = len(binaryRelations)
        utilities = []
        for cand in decision:
            tops = [cand-1]
            index = 0
            while index < len(tops):
                s = tops[index]
                for j in range(m):
                    if j == s:
                        continue
                    if binaryRelations[j][s] > 0:
                        if j not in tops:
                            tops.append(j)
                index += 1
            if len(tops) <= self.k:
                if self.isLoss == False:
                    utilities.append(1.0)
                elif self.isLoss == True:
                    utilities.append(-1.0)
            else:
                utilities.append(0.0)
        return utilities
def getUtilities ( self , decision , binaryRelations ) : m = len ( binaryRelations ) utilities = [ ] for cand in decision : tops = [ cand - 1 ] index = 0 while index < len ( tops ) : s = tops [ index ] for j in range ( m ) : if j == s : continue if binaryRelations [ j ] [ s ] > 0 : if j not in tops : tops . append ( j ) index += 1 if len ( tops ) <= self . k : if self . isLoss == False : utilities . append ( 1.0 ) elif self . isLoss == True : utilities . append ( - 1.0 ) else : utilities . append ( 0.0 ) return utilities
Returns a floats that contains the utilities of every candidate in the decision. This was 
        adapted from code written by Lirong Xia.

        :ivar list<int> decision: Contains a list of integer representations of candidates in the 
            current decision.
        :ivar list<list,int> binaryRelations: A two-dimensional array whose number of rows and 
            colums is equal to the number of candidates. For each pair of candidates, cand1 and
            cand2, binaryRelations[cand1-1][cand2-1] contains 1 if cand1 is ranked above cand2
            and 0 otherwise.