def __init__(self, *args, **kwargs): MemeticSearch.__init__(self, *args, **kwargs) # lambada must be mu-ltiple of mu assert self.lambada % self.mu == 0 # population is a list of (fitness, individual) tuples. self.population = [(self.bestEvaluation, self.bestEvaluable.copy())] for dummy in range(1, self.mu + self.lambada): x = self.bestEvaluable.copy() x.mutate() self.population.append((self.evaluator(x), x)) self._sortPopulation() self.steps = self.mu + self.lambada
def _learnStep(self): self.switchMutations() MemeticSearch._learnStep(self) self.switchMutations()