Пример #1
0
    def fitness(self, basepairs):
        bs = basepairs
        bs = [a for a in bs if a != []]
        f = hm.fitness(bs)
        f += self.add
        for seq in bs:
            a_sum = sum([s[0] for s in seq])
            if a_sum > 180:
                return 0.00001

        return (100000 / f)**10
Пример #2
0
    def bestRemaining(self, remaining, times):
        min = [None, None]
        for _ in range(times):
            random.shuffle(remaining)
            new = FindBestSequence(remaining).finalSequence
            v = hm.fitness(new)

            if min[0] == None or v <= min[0]:
                min[0] = v
                min[1] = new

        return min[1]