source: framspy/evolalg/selection/identity.py @ 1113

Last change on this file since 1113 was 1113, checked in by Maciej Komosinski, 4 years ago

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

File size: 469 bytes
RevLine 
[1113]1import copy
2
3from evolalg.base.step import Step
4from evolalg.selection.selection import Selection
5
6
7class IdentitySelection(Selection):
8    def __init__(self, copy=False):
9        super(IdentitySelection, self).__init__(copy)
10
11    def call(self, population, selection_size=None):
12        res = population
13        if selection_size is not None:
14            res = population[:selection_size]
15
16        if self.copy:
17            res = copy.deepcopy(res)
18        return res
Note: See TracBrowser for help on using the repository browser.