source: framspy/evolalg_steps/mutation_cross/frams_cross_and_mutate.py @ 1200

Last change on this file since 1200 was 1185, checked in by Maciej Komosinski, 2 years ago

Renamed a module; new name is "evolalg_steps"

File size: 855 bytes
Line 
1from evolalg_steps.base.frams_step import FramsStep
2from evolalg_steps.mutation_cross.frams_cross import FramsCross
3from evolalg_steps.mutation_cross.frams_mutation import FramsMutation
4
5
6class FramsCrossAndMutate(FramsStep):
7    def __init__(self, frams_lib, cross_prob, mutate_prob, mutate_commands=None, cross_commands=None, *args, **kwargs):
8        super().__init__(frams_lib, *args, **kwargs)
9
10        self.cross_prob = cross_prob
11        self.mutate_prob = mutate_prob
12
13        self.frams_mutate = FramsMutation(frams_lib, mutate_commands, mutate_prob)
14        self.frams_cross = FramsCross(frams_lib, cross_commands, cross_prob)
15
16    def call(self, population):
17        super(FramsCrossAndMutate, self).call(population)
18        population = self.frams_cross(population)
19        population = self.frams_mutate(population)
20        return population
Note: See TracBrowser for help on using the repository browser.