source: framspy/evolalg/mutation_cross/frams_cross_and_mutate.py @ 1113

Last change on this file since 1113 was 1113, checked in by Maciej Komosinski, 19 months ago

Added a framework for evolutionary algorithms cooperating with FramsticksLib?.py

File size: 745 bytes
Line 
1from evolalg.base.frams_step import FramsStep
2from evolalg.mutation_cross.frams_cross import FramsCross
3from evolalg.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):
8        super().__init__(frams_lib)
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        population = self.frams_cross(population)
18        population = self.frams_mutate(population)
19        return population
Note: See TracBrowser for help on using the repository browser.