Changeset 1139 for framspy/evolalg/base
- Timestamp:
- 05/08/21 12:42:58 (4 years ago)
- Location:
- framspy/evolalg/base
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/evolalg/base/frams_step.py
r1113 r1139 3 3 4 4 class FramsStep(Step): 5 def __init__(self, frams_lib, commands=None): 5 def __init__(self, frams_lib, commands=None, *args, **kwargs): 6 super(FramsStep, self).__init__(*args, **kwargs) 6 7 if commands is None: 7 8 commands = [] -
framspy/evolalg/base/lambda_step.py
r1114 r1139 18 18 19 19 def call(self, population): 20 super(LambdaStep, self).call(population) 20 21 if self.in_place: 21 22 [self.fun(_) for _ in population] -
framspy/evolalg/base/step.py
r1113 r1139 1 import logging 1 2 from abc import abstractmethod 2 3 … … 7 8 8 9 """ 10 11 def __init__(self, name=None): 12 self.name = name 13 if name is None: 14 self.name = type(self).__name__ 15 16 9 17 def pre(self): 10 18 pass 11 19 12 20 @abstractmethod 13 def call(self, *args, **kwargs):14 pass21 def call(self, population, *args, **kwargs): 22 logging.getLogger(self.name).debug(f"Population size {len(population)}") 15 23 16 24 def post(self): -
framspy/evolalg/base/union_step.py
r1113 r1139 5 5 6 6 class UnionStep(Step): 7 def __init__(self, steps): 7 def __init__(self, steps, *args, **kwargs): 8 super(UnionStep, self).__init__(*args, **kwargs) 8 9 if isinstance(steps, Iterable): 9 10 self.steps = steps … … 12 13 13 14 def call(self, population): 15 super(UnionStep, self).call(population) 14 16 for s in self.steps: 15 17 population = s(population) 16 18 return population 19 20 def __len__(self): 21 return len(self.steps) 22 23 def __iter__(self): 24 return iter(self.steps)
Note: See TracChangeset
for help on using the changeset viewer.