def compute_utilities(self, fitnesses):
        n_fitnesses = fitnesses.shape[0]
        ranks = scipy.zeros_like(fitnesses)
        l = sorted(enumerate(fitnesses), key=lambda x: x[1])
        for i, (j, _) in enumerate(l):
            ranks[j] = i
        # smooth reshaping

        # If we do not cast to float64 here explicitly, scipy will at random
        # points crash with a weird AttributeError.
        utilities = -scipy.log((n_fitnesses - ranks).astype('float64'))
        utilities += scipy.log(n_fitnesses / 2. + 1.0)
        utilities = scipy.clip(utilities, 0, float('inf'))
        utilities /= utilities.sum()       # make the utilities sum to 1
        utilities -= 1. / n_fitnesses  # baseline
        return utilities
dataset/ETHPy150Open BRML/climin/climin/nes.py/Xnes.compute_utilities/original