source: framspy/evolalg/repair/halloffame_repair.py @ 1139

Last change on this file since 1139 was 1139, checked in by Maciej Komosinski, 3 years ago

Added --debug mode that prints names of steps; final multiple evaluation now evaluates genotypes in hall of fame instead of the last population

File size: 483 bytes
Line 
1import copy
2import random
3
4from evolalg.repair import Repair
5
6
7class HallOfFameRepair(Repair):
8    def __init__(self, excepted_size, halloffame, top, *args, **kwargs):
9        super(HallOfFameRepair, self).__init__(excepted_size, *args, **kwargs)
10        self.halloffame = halloffame
11        self.top = top
12
13    def generate_new(self, population, missing_count):
14        ind = random.randint(0, min(self.top, len(self.halloffame)) - 1)
15        return copy.deepcopy(population[ind])
16
Note: See TracBrowser for help on using the repository browser.